8. 再查看R3上的bgp表和路由表:
R3(config-router)#do sh ip bgp
BGP table version is 5, local router ID is 3.3.3.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path * 1.1.1.0/24 34.0.0.4 0 100 i *> 23.0.0.2 0 100 i *> 2.2.2.0/24 23.0.0.2 0 0 100 i *> 3.3.3.0/24 0.0.0.0 0 32768 i *> 4.4.4.0/24 34.0.0.4 0 0 100 i R3(config-router)#do sh ip rout
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, 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
34.0.0.0/24 is subnetted, 1 subnets C 34.0.0.0 is directly connected, Serial0/0 1.0.0.0/24 is subnetted, 1 subnets B 1.1.1.0 [20/0] via 23.0.0.2, 00:00:55 2.0.0.0/24 is subnetted, 1 subnets
B 2.2.2.0 [20/0] via 23.0.0.2, 00:00:55 3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Loopback0 4.0.0.0/24 is subnetted, 1 subnets
B 4.4.4.0 [20/0] via 34.0.0.4, 00:00:55 23.0.0.0/24 is subnetted, 1 subnets
C 23.0.0.0 is directly connected, Serial0/1
以上输出结果说明,R3在到达R1的时候优选R2到达,因为R2的接口具有更小的ip地址
//将R2的router-id改回4.4.4.4,R4的router-id依然为2.2.2.2,再次查看路径选择情况
R3(config-router)#do sh ip bgp
BGP table version is 13, local router ID is 3.3.3.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path * 1.1.1.0/24 34.0.0.4 0 100 i *> 23.0.0.2 0 100 i *> 2.2.2.0/24 23.0.0.2 0 0 100 i *> 3.3.3.0/24 0.0.0.0 0 32768 i *> 4.4.4.0/24 34.0.0.4 0 0 100 i R3(config-router)#do sh ip rout
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, 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
34.0.0.0/24 is subnetted, 1 subnets
C 34.0.0.0 is directly connected, Serial0/0 1.0.0.0/24 is subnetted, 1 subnets
B 1.1.1.0 [20/0] via 23.0.0.2, 00:01:42 2.0.0.0/24 is subnetted, 1 subnets
B 2.2.2.0 [20/0] via 23.0.0.2, 00:01:42 3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Loopback0 4.0.0.0/24 is subnetted, 1 subnets
B 4.4.4.0 [20/0] via 34.0.0.4, 00:01:00 23.0.0.0/24 is subnetted, 1 subnets
C 23.0.0.0 is directly connected, Serial0/1
以上输出结果指出,虽然R2的router-id大于R4的router-id,但是R4到R1的路径依然优选R2,这说明router-id指作为IBGP路径选择的条件,对EBGP不适用,对于EBGP来说,不论邻居的router-id怎样,优选接口ip地址小的邻居转发数据。可以通过查看R1的bgp表和路由表得到验证。
//再次查看R1的bgp表和路由表
R1#sh ip bgp
BGP table version is 40, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path *> 1.1.1.0/24 0.0.0.0 0 32768 i
*>i2.2.2.0/24 12.0.0.2 0 100 0 i *>i3.3.3.0/24 14.0.0.4 0 100 0 200 i * i 12.0.0.2 0 100 0 200 i *>i4.4.4.0/24 14.0.0.4 0 100 0 i R1#sh ip rout
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, 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
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0 2.0.0.0/24 is subnetted, 1 subnets
B 2.2.2.0 [200/0] via 12.0.0.2, 00:05:15 3.0.0.0/24 is subnetted, 1 subnets
B 3.3.3.0 [200/0] via 14.0.0.4, 00:04:33 4.0.0.0/24 is subnetted, 1 subnets
B 4.4.4.0 [200/0] via 14.0.0.4, 00:04:33 12.0.0.0/24 is subnetted, 1 subnets
C 12.0.0.0 is directly connected, Serial0/0 14.0.0.0/24 is subnetted, 1 subnets
C 14.0.0.0 is directly connected, Serial0/1
以上结果再次说明,在IBGP邻居间,不论邻居的ip地址怎样,如果router-id不一样,则优选router-id较小的邻居转发数据,如果router-id相同,则优选邻居ip地址小的邻居转发数据。