1、BGP组网实验简单配置BGP邻居建立与路由发布实验拓扑图:实验配置:1.接口ip地址配置r1#show ip int briefInterface IP-Address OK? Method Status ProtocolSerial0/0 10.10.13.1 YES manual up up Serial0/1 10.10.1.5 YES manual up up FastEthernet1/0 10.10.1.1 YES manual up up Loopback0 10.10.0.1 YES manual up upr2#show ip int briefInterface IP-Ad
2、dress OK? Method Status ProtocolSerial0/0 10.20.24.1 YES manual up up Serial0/1 10.10.1.9 YES manual up up FastEthernet1/0 10.10.1.2 YES manual up up Loopback0 10.10.0.2 YES manual up up r3#show ip int briefInterface IP-Address OK? Method Status ProtocolSerial0/0 10.10.13.2 YES manual up up FastEthe
3、rnet1/0 10.30.34.1 YES manual up up Ethernet3/0 10.30.3.1 YES manual up up Loopback0 10.30.0.1 YES manual up up r4#show ip int briefInterface IP-Address OK? Method Status ProtocolSerial0/0 10.20.24.2 YES manual up up FastEthernet1/0 10.30.34.2 YES manual up up Ethernet3/0 10.40.4.1 YES manual up up
4、Loopback0 10.40.0.1 YES manual up upr5#show ip int briefInterface IP-Address OK? Method Status ProtocolSerial0/0 10.10.1.6 YES manual up up FastEthernet1/0 10.10.1.13 YES manual up up Ethernet3/0 10.10.5.1 YES manual up up Loopback0 10.10.0.5 YES manual up upr6#show ip int briefInterface IP-Address
5、OK? Method Status ProtocolSerial0/0 10.10.1.10 YES manual up up FastEthernet1/0 10.10.1.14 YES manual up up Ethernet3/0 10.10.6.1 YES manual up up Loopback0 10.10.0.6 YES manual up up 保证直连的连通性:r1#ping 10.10.13.2Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 10.10.13.2, timeout is 2
6、seconds:!Success rate is 100 percent (5/5), round-trip min/avg/max = 8/22/40 msr1#ping 10.10.1.6 Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 10.10.1.6, timeout is 2 seconds:!Success rate is 100 percent (5/5), round-trip min/avg/max = 12/35/76 ms r1#ping 10.10.1.2Type escape seque
7、nce to abort.Sending 5, 100-byte ICMP Echos to 10.10.1.2, timeout is 2 seconds:.!Success rate is 80 percent (4/5), round-trip min/avg/max = 8/28/56 ms2.IGP路由协议配置r1(config)#router ospf 1r1(config-router)#router-id 1.1.1.1r1(config-router)#net 10.10.1.0 0.0.0.255 area 0r1(config-router)#net 10.10.0.1
8、0.0.0.0 area 0 r1(config-router)#net 10.10.13.1 0.0.0.3 area 0r1(config-router)#passive-interface s0/0 /*配置被动接口,保护内部安全不被外部网络学习到自己自治系统的路由r1(config-router)#$ormation originate always metric 2000 metric-type 1 /*下发缺省路由r2(config)#router ospf 1r2(config-router)#router-id 2.2.2.2r2(config-router)#net 10.1
9、0.0.2 0.0.0.0 area 0r2(config-router)#net 10.10.1.0 0.0.0.255 area 0r2(config-router)#redistribute connected metric 2000 metric-type 1 subnets /*重发布直连路由进ospf进程,让其他路由器学习到这条直连路由r2(config-router)#$ormation originate always metric 2000 metric-type 1 /*同样也发布缺省路由,作为r1的备份r5(config)#router ospf 1r5(config-r
10、outer)#net 10.10.0.5 0.0.0.0 area 0r5(config-router)#net 10.10.1.13 0.0.0.3 area 0r5(config-router)#net 10.10.1.6 0.0.0.3 area 0r5(config-router)#net 10.10.5.1 0.0.0.255 area 0r6(config)#router ospf 1r6(config-router)#router-id 6.6.6.6r6(config-router)#net 10.10.0.6 0.0.0.0 area 0r6(config-router)#n
11、et 10.10.1.14 0.0.0.3 area 0 r6(config-router)#net 10.10.6.1 0.0.0.255 area 0r6(config-router)#net 10.10.1.10 0.0.0.3 area 0/*AS30和AS40里面只有一台路由器,无需运行IGP将自治系统内的接口配置成点对点类型且ospf cost值配置为100:r1(config)#int f1/0r1(config-if)#ip ospf net point-to-p /*接口配置成点对点,节省收敛时间r1(config-if)#ip ospf cost 100 /*链路cost值
12、统一配成100r1(config)#int s0/1r1(config-if)#ip ospf net point-to-pr1(config-if)#ip ospf cost 100r2(config)#int f1/0r2(config-if)#ip ospf net point-to-pr2(config-if)#ip ospf cost 100r2(config)#int s0/1r2(config-if)#ip ospf net point-to-pr2(config-if)#ip ospf cost 100r5(config)#int s0/0r5(config-if)#ip os
13、pf net point-to-pr5(config)#int f1/0r5(config-if)#ip ospf net point-to-pr5(config-if)#ip ospf cost 100r5(config-if)#int s0/0r5(config-if)#ip ospf cost 100r6(config)#int f1/0r6(config-if)#ip ospf net p r6(config-if)#ip ospf net point-to-pr6(config)#int s0/1r6(config-if)#ip ospf net point-to-pr6(confi
14、g)#int f1/0r6(config-if)#ip ospf cost 100r6(config-if)#int s0/0r6(config-if)#ip ospf cost 100查看邻居关系的建立:r1#show ip ospf neiNeighbor ID Pri State Dead Time Address Interface2.2.2.2 0 FULL/ - 00:00:35 10.10.1.2 FastEthernet1/010.10.0.5 0 FULL/ - 00:00:32 10.10.1.6 Serial0/1r2#show ip ospf neiNeighbor I
15、D Pri State Dead Time Address Interface1.1.1.1 0 FULL/ - 00:00:30 10.10.1.1 FastEthernet1/06.6.6.6 0 FULL/ - 00:00:34 10.10.1.10 Serial0/1r5#show ip ospf neiNeighbor ID Pri State Dead Time Address Interface6.6.6.6 0 FULL/ - 00:00:34 10.10.1.14 FastEthernet1/01.1.1.1 0 FULL/ - 00:00:36 10.10.1.5 Seri
16、al0/0r6#show ip ospf neiNeighbor ID Pri State Dead Time Address Interface10.10.0.5 0 FULL/ - 00:00:33 10.10.1.13 FastEthernet1/02.2.2.2 0 FULL/ - 00:00:39 10.10.1.9 Serial0/0BGP邻居建立:r1(config)#router bgp 10 /*定义自治系统号为10r1(config-router)#no synchronization /*关同步r1(config-router)#no auto-summary /*关闭自
17、动汇总r1(config-router)#neighbor 10.10.0.2 remote-as 10 /*与自治系统为10的10.10.0.2建立邻居关系r1(config-router)#neighbor 10.10.0.2 update-source loopback 0 /*使用loopback 0接口来建立邻居关系r1(config-router)#neighbor 10.10.13.2 remote-as 30 /*与自治系统30的10.10.13.2建立邻居关系r2(config)#router bgp 10r2(config-router)#no synr2(config-r
18、outer)#no aur2(config-router)#nei 10.10.0.1 remote-as 10r2(config-router)#neighbor 10.10.0.1 update-source loop 0r2(config-router)#nei 10.20.24.2 remote-as 40r3(config)#router bgp 30r3(config-router)#no synchronization r3(config-router)#no aur3(config-router)#nei 10.10.13.1 remote-as 10r3(config-rou
19、ter)#nei 10.30.34.2 remote-as 40r4(config)#router bgp 40r4(config-router)#no synr4(config-router)#no aur4(config-router)#nei 10.20.24.1 remote-as 10r4(config-router)#nei 10.30.34.1 remote-as 30查看bgp邻居表:r1#show ip bgp sumBGP router identifier 10.10.0.1, local AS number 10BGP table version is 4, main
20、routing table version 43 network entries using 351 bytes of memory5 path entries using 260 bytes of memory6/3 BGP path/bestpath attribute entries using 744 bytes of memory3 BGP AS-PATH entries using 72 bytes of memory0 BGP route-map cache entries using 0 bytes of memory0 BGP filter-list cache entrie
21、s using 0 bytes of memoryBGP using 1427 total bytes of memoryBGP activity 3/0 prefixes, 5/0 paths, scan interval 60 secsNeighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd10.10.0.2 4 10 115 115 4 0 0 01:49:09 210.10.13.2 4 30 113 113 4 0 0 01:47:49 2r2#show ip bgp sumNeighbor V AS Msg
22、Rcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd10.10.0.1 4 10 115 115 7 0 0 01:49:43 210.20.24.2 4 40 116 114 7 0 0 01:47:12 2r3#show ip bgp sumNeighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd10.10.13.1 4 10 114 114 4 0 0 01:48:46 210.30.34.2 4 40 116 114 4 0 0 01:47:19 2r4#show
23、ip bgp sumNeighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd10.20.24.1 4 10 115 117 6 0 0 01:48:23 210.30.34.1 4 30 115 117 6 0 0 01:48:08 2/* i表示network发布的igp/* e表示egp协议发布 egp/* ?表示redistribute发布 incompleteBGP路由发布(静态注入):r1(config)#ip route 10.10.0.0 255.255.0.0 null0 /*黑洞路由配置,当去往目标网
24、段down时,能够在本路由器上就丢包,不会在去往其他路由器而占用带宽r1(config)#router bgp 10r1(config-router)#network 10.10.0.0 mask 255.255.0.0 /*将10.10.0.0 网段手动静态注入BGP,使BGP能承载这些路由其他路由器也进行相应配置:r2(config)#ip route 10.10.0.0 255.255.0.0 null0 r2(config)#router bgp 10r2(config-router)#net 10.10.0.0 mask 255.255.0.0 r3(config)#ip route
25、 10.30.0.0 255.255.0.0 null0r3(config)#router bgp 30r3(config-router)#net 10.30.0.0 mask 255.255.0.0r4(config)#ip route 10.40.0.0 255.255.0.0 null0r4(config)#router bgp 40r4(config-router)#net 10.40.0.0 mask 255.255.0.0查看bgp表和全局路由表:r1#show ip bgpBGP table version is 4, local router ID is 10.10.0.1St
26、atus codes: s suppressed, d damped, h history, * valid, best, i - internal, r RIB-failure, S StaleOrigin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path* i10.10.0.0/16 10.10.0.2 0 100 0 i* 0.0.0.0 0 32768 i* 10.30.0.0/16 10.10.13.2 0 0 30 i* 10.40.0.0/16 10.10.13.2
27、 0 30 40 i*i 10.20.24.2 0 100 0 40 i/*Bgp表只选择最佳路由,*表示存在这样一条链路但是没有选择其进路由表,原因是选10.10.13.2作为下一跳要经过30 和 40两个自治系统,而如果选择10.20.24.2为下一跳只需经过40这一个自治系统,路由器会选择AS_path最短的路由r1#show ip route 10.0.0.0/8 is variably subnetted, 15 subnets, 4 masksS 10.10.0.0/16 is directly connected, Null0C 10.10.1.0/30 is directly
28、connected, FastEthernet1/0C 10.10.0.1/32 is directly connected, Loopback0O 10.10.0.2/32 110/101 via 10.10.1.2, 01:02:20, FastEthernet1/0O 10.10.5.0/24 110/110 via 10.10.1.6, 01:02:20, Serial0/1C 10.10.1.4/30 is directly connected, Serial0/1O 10.10.0.5/32 110/101 via 10.10.1.6, 01:02:20, Serial0/1O E
29、1 10.20.24.0/30 110/2100 via 10.10.1.2, 01:02:20, FastEthernet1/0O 10.10.6.0/24 110/210 via 10.10.1.6, 01:02:20, Serial0/1 110/210 via 10.10.1.2, 01:02:20, FastEthernet1/0O 10.10.0.6/32 110/201 via 10.10.1.6, 01:02:20, Serial0/1 110/201 via 10.10.1.2, 01:02:20, FastEthernet1/0O 10.10.1.8/30 110/200
30、via 10.10.1.2, 01:02:21, FastEthernet1/0C 10.10.13.0/30 is directly connected, Serial0/0O 10.10.1.12/30 110/200 via 10.10.1.6, 01:02:21, Serial0/1B 10.30.0.0/16 20/0 via 10.10.13.2, 01:55:17B 10.40.0.0/16 200/0 via 10.20.24.2, 01:54:25 /*两条bgp路由一条管理距离为20,为外部r3学习到的,一条管理距离为200为自己自治系统r2发的。r2#show ip bg
31、pBGP table version is 7, local router ID is 10.10.0.2Status codes: s suppressed, d damped, h history, * valid, best, i - internal, r RIB-failure, S StaleOrigin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path* 10.10.0.0/16 0.0.0.0 0 32768 i/*Cisco:选择weight值最高的,其他厂家:选择本地始发路由,下一跳为0.0.0.0,只有向邻居通告是才将下一跳改为自己* i 10.10.0.1 0 100 0 i* 10.30.0.0/16 10.20.24.2 0 40 30 i*i 10.10.13.2 0 100
copyright@ 2008-2023 冰点文库 网站版权所有
经营许可证编号:鄂ICP备19020893号-2