多日不见的更新又来啦,今天是有关于IBGP邻居的下一跳属性,这也是一个CCNP认证考试中必须掌握好的知识要点,共需要五台路由器来完成这个组网配置。另祝有情人节日快乐,我等IT潘炕故羌绦啾频牡ド戆伞 拓扑图如下:
配置:
BGP是一个as-by-as的路由协议而不是router-by-router的路由协议,在bgp中下一跳并不代表下一跳路由器,而是代表到达下一个as的ip地址。对于ebgp来说,默认的下一跳ip地址为发送bgp更新的邻居路由器的地址,而对于ibgp来说,下一跳地址为ebgp邻居通告的发送到ibgp的地址。这导致一个问题,对于默认的ebgp来说不会出现问题,而对于ibgp来说就会出现问题,因为找不到下一跳路由器地址,所以发送到ebgp邻居的分组永远也到不了。而要解决这一问题也很简单,就是将自己做为邻居的下一跳路由器,这只需一条命令。
5台路由器,其中r1位于as 1中,r2,r3,r4位于as 2中。其中r2和r4运行ospf和bgp,r3运行ospf路由协议。r5位于as 3中。
r1:
in e1/1
ip add 192.168.1.1 255.255.255.0
no sh
router bgp 1
nei 192.168.1.2 remote-as 2
net 192.168.1.0
r2:
in e1/0
ip add 192.168.1.2 255.255.255.0
no sh
in e1/1
ip add 192.168.2.1 255.255.255.0
no sh
ip ospf 1 a 0
router bgp 2
nei 192.168.1.1 remote-as 1
nei 192.168.3.2 remote-as 2
nei 192.168.3.2 next-hop-self
r3:
in e1/0
ip add 192.168.2.2 255.255.255.0
no sh
ip ospf 1 a 0
in e1/1
ip add 192.168.3.1 255.255.255.0
no sh
ip ospf 1 a 0
ip route 192.168.1.0 255.255.255.0 192.168.2.1
ip route 172.16.1.0 255.255.255.0 192.168.3.2
http://www.luyouqiwang.com/14439/ r4:
in e1/0
ip add 192.168.3.2 255.255.255.0
no sh
ip ospf 1 a 0
in e1/1
ip add 172.16.1.1 255.255.255.0
no sh
router bgp 2
nei 192.168.2.1 remote-as 2
nei 172.16.1.2 remote-as 3
nei 192.168.2.1 next-hop-self
r5:
in e1/0
ip add 172.16.1.2 255.255.255.0
no sh
router bgp 3
nei 172.16.1.1 remote-as 2
net 172.16.1.0 mask 255.255.255.0
验证命令:
show ip bgp sum
show ip bgp
show ip route
分别看一下r2和r4在没有改变下一跳属性时这3个命令的输出
R2#show ip bgp
BGP table version is 6, local router ID is 192.168.2.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
* i172.16.1.0/24 172.16.1.2 0 100 0 3 i
r> 192.168.1.0 192.168.1.1 0 0 1 i
可以看到在r2上到达网段172.16.1.0的下一跳地址为ebgp邻居r5的地址
R2#show ip ro
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
C 192.168.1.0/24 is directly connected, Ethernet1/0
C 192.168.2.0/24 is directly connected, Ethernet1/1
O 192.168.3.0/24 [110/20] via 192.168.2.2, 01:22:45, Ethernet1/1
查看路由表输出发现没有bgp路由
R2#show ip bgp sum
BGP router identifier 192.168.2.1, local AS number 2
BGP table version is 6, main routing table version 6
2 network entries using 234 bytes of memory
2 path entries using 104 bytes of memory
3/2 BGP path/bestpath attribute entries using 372 bytes of memory
2 BGP AS-PATH entries using 48 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 758 total bytes of memory
BGP activity 2/0 prefixes, 2/0 paths, scan interval 60 secs
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
192.168.1.1 4 1 88 90 6 0 0 01:21:24 1
192.168.3.2 4 2 95 95 6 0 0 01:22:23 1
r4的输出也差不多,在此我就不再贴出输出结果了。现在我们用命令改变下一跳属性。
r2:
router bgp 2
nei 192.168.3.2 next-hop-self
r4:
router bgp 2
nei 192.168.2.1 next-hop-self
现在再查看r2的输出
R2#show ip bgp
BGP table version is 7, local router ID is 192.168.2.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
*>i172.16.1.0/24 192.168.3.2 0 100 0 3 i
r> 192.168.1.0 192.168.1.1 0 0 1 i
现在下一跳地址已经变为r4的地址了,而路由表中也出现了bgp路由。
R2#show ip ro
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/24 is subnetted, 1 subnets
B 172.16.1.0 [200/0] via 192.168.3.2, 00:00:25
C 192.168.1.0/24 is directly connected, Ethernet1/0
C 192.168.2.0/24 is directly connected, Ethernet1/1
O 192.168.3.0/24 [110/20] via 192.168.2.2, 01:28:40, Ethernet1/1
注意下一跳属性只针对ibgp。
|
不良信息举报Q:2000617|Archiver|ROS软路由论坛 ROSABC.com 网络方案网络工程交流
GMT+8, 2025-12-17 18:54 , Processed in 0.028949 second(s), 15 queries .
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.