拓扑:
R1 与R2建立EBGP对等体,R2与R1建立EBGP对等体, R3与R2建立IBGP对等体与R4建立EBGP 对等体, R4与R3是EBGP对等体
R1通告1.1.10/24网络给EBGP对等体R2,R2通告给R3,R3会再转发给R4么???
答案是不会的,因为,当R3学到这一路由时,1.1.1.0/24这一网络的下一跳是10.1.1.1而R3是不可到达的,此时可在R2上做next-hop-self来解决这一问题
R1配置
Router>EN
Router#conf t
R1(config)#int s1/1
R1(config-if)#ip add 10.1.1.1 255.255.255.0
R1(config-if)#no sh
R1(config-if)#int lo 0
R1(config-if)#ip add 1.1.1.1 255.255.255.0
R1(config-if)#no sh
R1(config-if)#exi
R1(config)#router bgp 100
R1(config-router)#net 1.1.1.0 mask 255.255.255.0
R1(config-router)#nei 10.1.1.2 remote 200
R2配置:
Router>en
Router#conf t
R2(config)#int s1/0
R2(config-if)#ip add 10.1.1.2 255.255.255.0
R2(config-if)#no sh
R2(config-if)#int s1/1
R2(config-if)#ip add 10.2.2.1 255.255.255.0
R2(config-if)#no sh
R2(config-if)#exi
R2(config)#router bgp 200
R2(config-router)#nei 10.1.1.1 remote 100
R2(config-router)#nei 10.2.2.2 remote 200
R3配置:
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#host R3
R3(config)#int s1/0
R3(config-if)#ip add 10.2.2.2 255.255.255.0
R3(config-if)#no sh
R3(config-if)#int s1/1
R3(config-if)#ip add 10.3.3.1 255.255.255.0
R3(config-if)#no sh
R3(config-if)#exi
R3(config)#router bgp 200
R3(config-router)#nei 10.2.2.1 remote 200
R3(config-router)#nei 10.3.3.2 remote 300
R4配置:
Router>en
Router#conf t
R4(config)#int s1/0
R4(config-if)#ip add 10.3.3.2 255.255.255.0
R4(config-if)#no sh
R4(config-if)#exi
R4(config)#router bgp 300
R4(config-router)#nei 10.3.3.1 remote 200
查看R3 R4 的BGP 转发表:
R3#sh ip bgp
BGP table version is 1, local router ID is 10.3.3.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
* i1.1.1.0/24 10.1.1.1 0 100 0 100
(标注为不是最优的)
就不会再转发这一路由,只有同时是*>才转发
R4#sh ip bgp
R4#sh 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
10.0.0.0/24 is subnetted, 1 subnets
C 10.3.3.0 is directly connected, Serial1/0
R4没学到1.1.1.0/24!!!!!!55555555
在R2上做NEXT-HO-SELF
R2(config)#router bgp 200
R2(config-router)#nei 10.2.2.2 next-hop-self
再查看R4的转发表和路由表:
R4#sh ip bgp
BGP table version is 2, local router ID is 10.3.3.2
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 10.3.3.1 0 200
R4#sh 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
1.0.0.0/24 is subnetted, 1 subnets
B 1.1.1.0 [20/0] via 10.3.3.1, 00:01:32 (学的了咯!!!o(∩_∩)o…)
10.0.0.0/24 is subnetted, 1 subnets
C 10.3.3.0 is directly connected, Serial1/0