R1(config)#router bgp 64512
R1(config-router)#net 172.16.0.0 mask 255.255.255.0
R1(config-router)#net 172.16.1.0 mask 255.255.255.0
R1(config-router)#net 172.16.255.0 mask 255.255.255.252
R1(config-router)#nei 172.16.16.1 remote 64512(
指定对端邻居的loopback0接口)
|
R2(config)#router bgp 64512
R2(config-router)#net 172.16.255.0 mask 255.255.255.252
R2(config-router)#net 172.16.16.0 mask 255.255.255.0
R2(config-router)#net 10.1.255.0 mask 255.255.255.252
R2(config-router)#nei 172.16.0.1 remote 64512 (
指定对端邻居的loopback0接口)
|
R1#show ip bgp sum
BGP router identifier 172.16.1.1, local AS number 64512
BGP table version is 1, main routing table version 1
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
172.16.16.1 4 64512 0 0 0 0 0 never Active (
还在尝试连接,发现并没有建立起来)
|
R1#debug ip bgp all
BGP debugging is on for all address families
R1#
*Mar 1 02:49:46.535: BGP: 172.16.16.1 open active, local address 172.16.255.1
*Mar 1 02:49:46.627: BGP: 172.16.16.1 open failed: Connection refused by remote host, open active delayed 29991ms (35000ms max, 28% jitter) (
发现被远程的主机拒绝了)
|
R1(config-router)#nei 172.16.16.1 update-source loopback 0
R2(config-router)#nei 172.16.0.1 update-source lo0(
分别在R1,R2指定用自己的lo0接口和对端建邻居)
|
R1#show ip bgp summary
BGP router identifier 172.16.1.1, local AS number 64512
BGP table version is 7, main routing table version 7
5 network entries using 585 bytes of memory
6 path entries using 312 bytes of memory
3/2 BGP path/bestpath attribute entries using 372 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 1269 total bytes of memory
BGP activity 8/3 prefixes, 9/3 paths, scan interval 60 secs
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
172.16.16.1 4 64512 12 12 7 0 0 00:07:26 3
(
邻居起来了)
|
R2(config)#ip route 192.168.0.0 255.255.255.0 10.1.255.2
R2(config-router)#net 10.1.255.0 mask 255.255.255.252
R2(config-router)#nei 192.168.0.1 remote 64513
R2(config-router)#nei 192.168.0.1 update-source lo0
R2(config-router)#nei 192.168.0.1 ebgp-multihop 2
|
R3(config)#ip route 172.16.16.0 255.255.255.0 10.1.255.1(
建静态由路保证指定地址TCP可达)
R3(config-router)#net 192.168.0.0
R3(config-router)#net 192.168.1.0 (
注入直连网络到BGP进程当中,有类地址没带子网发布)
R3(config-router)#net 10.1.255.0 mask 255.255.255.252(
无类地址带子网发布)
R3(config-router)#nei 172.16.16.1 remote 64512
R3(config-router)#nei 172.16.16.1 update-source lo0 (
用本地的lo0和对端指定邻居)
R3(config-router)#nei 172.16.16.1 ebgp-multihop 2 (
指出ebgp的邻居地址存在多跳特性)
|
R2#show ip bgp summary
BGP router identifier 172.16.16.1, local AS number 64512
BGP table version is 24, main routing table version 24
7 network entries using 819 bytes of memory
8 path entries using 416 bytes of memory
4/3 BGP path/bestpath attribute entries using 496 bytes of memory
1 BGP AS-PATH entries using 24 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 1755 total bytes of memory
BGP activity 9/2 prefixes, 13/5 paths, scan interval 60 secs
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
172.16.0.1 4 64512 41 47 24 0 0 00:36:55 3
192.168.0.1 4 64513 14 20 24 0 0 00:03:32 3
(
至此两条邻居都能看到了
)
|
R1
#sh ip route bgp
10.0.0.0/30 is subnetted, 1 subnets
B 10.1.255.0 [200/0] via 172.16.16.1, 01:16:50
(
发现只有一条bgp路由)
R2#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
172.16.0.0/16 is variably subnetted, 4 subnets, 2 masks
C 172.16.255.0/30 is directly connected, FastEthernet0/0
C 172.16.16.0/24 is directly connected, Loopback0
R 172.16.0.0/24 [120/1] via 172.16.255.1, 00:00:16, FastEthernet0/0
R 172.16.1.0/24 [120/1] via 172.16.255.1, 00:00:16, FastEthernet0/0
(ibgp
内以RIP来走)
10.0.0.0/30 is subnetted, 1 subnets
C 10.1.255.0 is directly connected, Serial1/1
S 192.168.0.0/24 [1/0] via 10.1.255.2
B 192.168.1.0/24 [20/0] via 192.168.0.1, 02:20:11
(
学到了域外的ebgp)
R3#sh ip route bgp
172.16.0.0/16 is variably subnetted, 4 subnets, 2 masks
B 172.16.255.0/30 [20/0] via 172.16.16.1, 01:16:15
B 172.16.0.0/24 [20/0] via 172.16.16.1, 01:16:15
B 172.16.1.0/24 [20/0] via 172.16.16.1, 01:16:15
(
能够全部学到,并以BGP呈现)
|
R2(config-router)#nei 172.16.0.1 next-hop-self
|
R1#sh ip route bgp
10.0.0.0/30 is subnetted, 1 subnets
B
10.1.255.0 [200/0] via 172.16.16.1, 02:43:56
B
192.168.0.0/24 [200/0] via 172.16.16.1, 00:00:02
B
192.168.1.0/24 [200/0] via 172.16.16.1, 00:00:02 (
现在学到了三条了。)
R1#
|