CCNP精粹系列之三十二--BGP下一跳问题,推荐

简介:


                                   

                   Bgp 的下一跳
R1:
R1(config)#int lo0
R1(config-if)#ip addr 192.168.10.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#exit
R1(config)#router bgp 64500
fig-router)#neighbor 202.110.100.2 remote-as 64500
R1(config-router)#net 202.110.100.0
R1(config-router)#net 192.168.10.0
R1(config-router)#exit
 
R2 上:
Router(config)#host R2
R2(config)#int s1/0
R2(config-if)#ip addr 202.110.100.2 255.255.255.0
R2(config-if)#encap hdlc
R2(config-if)#no shut
R2(config-if)#exit
 
R2(config)#int s1/1
R2(config-if)#ip addr 202.110.101.1 255.255.255.0
R2(config-if)#encap hdlc
R2(config-if)#clock rate 56000
R2(config-if)#no shut
R2(config-if)#exit
R2(config)#router bgp 64500
R2(config-router)#neighbor 202.110.100.1 remote-as 64500
R2(config-router)#neighbor 202.110.101.2 remote-as 64501
R2(config-router)#net 202.110.100.0
R2(config-router)#net 202.110.101.0
 
R3 上:
 
R3(config-if)#int fa0/0
R3(config-if)#ip addr 192.168.20.1 255.255.255.0
R3(config-if)#no shut
R3(config)#int s1/1
R3(config-if)#ip addr 202.110.101.2 255.255.255.0
 
R3(config-if)#encap hdlc
R3(config-if)#no shut
R3(config-if)#exit
 
R3(config)#router bgp 64501
R3(config-router)#neighbor 202.110.101.1 remote-as 64500
R3(config-router)#net 202.110.101.0
R3(config-router)#net 192.168.20.0
 
R1 上测试:
 
R1#show ip bgp
BGP table version is 7, local router ID is 202.110.100.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
*> 192.168.10.0     0.0.0.0                  0         32768 i
*>i192.168.20.0     202.110.101.2              0    100      0 64501 i
* i202.110.100.0    202.110.100.2            0    100      0 i
*>                  0.0.0.0                  0         32768 i
*>i202.110.101.0    202.110.100.2            0    100      0 i
R1#
我们在 R1 上查看 fa0/0 的路由下一跳不是常规下我们设想的 100.2 ,而是 101.2 
总结:路由器 ebgp 邻居处收到路由后,再把该路由转发给自己的 IBGP 邻居时,保留了路由的下一跳。
解决办法:
通告路由器转发“ EBGP 邻居的路由”给 IBGP 邻居时,修改路由的下一跳为自己的端口的下一跳 ip
语法格式:
config-router #neighbor   邻居 ip  next-hop-self
注意 ; 这里邻居 IP 是指 IBGP (内部路由器)。本试验中的 R1, 如果将这个 ip 写成 EBGP ,本试验的 202.110.101.2 ,那么试验结果是错误的,至于错误结果就不做了,所以朋友们一定要注意。
所以在 R2 上做如下修改:
 
R2(config)#router bgp 64500
R2(config-router)#neighbor 202.110.101.2 remote-as 64501
R2(config-router)#neighbor 202.110.100.1 next-hop-self
R2(config-router)#exit
再次在 R1 上看效果:
 
R1#show ip bgp
BGP table version is 9, local router ID is 202.110.100.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
*> 192.168.10.0     0.0.0.0                  0         32768 i
*>i192.168.20.0     202.110.100.2              0    100      0 64501 i
* i202.110.100.0    202.110.100.2            0    100      0 i
*>                  0.0.0.0                  0         32768 i
*>i202.110.101.0    202.110.100.2            0    100      0 i
 
 
显然可以看出 R1 学习到的 R3 路由 192.168.20.0 的下一跳变为 202.110.100.2   ,所以我们的修改下一跳成功。一切和理论符合。
 
BGP的med属性:
目睹实战现场:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
      本文转自shenleigang 51CTO博客,原文链接:http://blog.51cto.com/shenleigang/152633,如需转载请自行联系原作者
 

 
相关文章
|
网络协议 算法 网络架构