CCNP精粹系列之三十--BGP源地址问题,推荐



 
                                                      
              BGP 源地址问题
------------ 同一自治系统
引导思路简图:
R1 lo0  1.1.1.1
R2 lo1  2.2.2.2
  按照上面的配置 R2 学习不到 R1 环回口的路由。
我们来看下面的试验:
   试验环境:
R1:lo0    192.168.10.1 255.255.255.0
lo1    172.16.10.1 255.255.0.0
 
   S1/0   202.110.100.1 255.255.255.0
S1/1   202.110.101.1 255.255.255.0
 
R2:
lo0     172.16.20.1 255.255.0.0
 S1/0   202.110.100.2 255.255.255.0
S1/1   202.110.101.2 255.255.255.0
 
 
R1:
Router(config)#host 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)#int lo1
R1(config-if)#ip addr 172.16.10.1 255.255.0.0
R1(config-if)#exit
R1(config)#int s1/0
R1(config-if)#ip addr 202.110.100.1 255.255.255.0
R1(config-if)#encap hdlc
R1(config-if)#clock rate 56000
R1(config-if)#no shut
R1(config-if)#int s1/1
R1(config-if)#ip addr 202.110.101.1 255.255.255.0
R1(config-if)#encap hdlc
R1(config-if)#clock rate 56000
R1(config-if)#no shut
R1(config-if)#
R1(config)#router bgp 64500
R1(config-router)#neighbor 202.110.100.2 remote-as 64500
R1(config-router)#neighbor 172.16.20.2 remote-as 64500
R1(config-router)#net 192.168.10.0
R1(config-router)#net 172.16.0.0
R1(config-router)#net 202.110.100.0
R1(config-router)#net 202.110.101.0
 
R1(config)#router rip
R1(config-router)#ver 2
R1(config-router)#net 192.168.10.0
R1(config-router)#net 172.16.10.0
R1(config-router)#net 202.110.100.0
R1(config-router)#net 202.110.101.0
 
 
R2:
Router(config)#host R2
R2(config)#int lo0
R2(config-if)#ip addr 172.16.20.1 255.255.255.0
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)#int s1/1
R2(config-if)#ip addr 202.110.101.2 255.255.255.0
R2(config-if)#encap hdlc
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 172.16.10.1 remote-as 64500
R2(config-router)#net 202.110.100.0
R2(config-router)#net 172.16.20.0
 
 
R2(config)#router rip
R2(config-router)#ver 2
R2(config-router)#net 172.16.20.0
R2(config-router)#net 202.110.100.0
R2(config-router)#net 202.110.101.0
R2(config-router)#exit
 
R2 上测试:
 
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    202.110.100.0/24 is directly connected, Serial1/0
R    192.168.10.0/24 [120/1] via 202.110.100.1, 00:00:21, Serial1/0
     172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
C       172.16.20.0/24 is directly connected, Loopback0
R       172.16.0.0/16 [120/1] via 202.110.100.1, 00:00:21, Serial1/0
由于有冗余链路,我们可以测试关闭一个端口,看是否还能正常学习到路由。
 
R1(config-if)#int s1/0
R1(config-if)#shut
R2 上再做测试:
 
C    202.110.100.0/24 is directly connected, Serial1/0
B    192.168.10.0/24 [200/0] via 202.110.100.1, 00:00:10
     172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
C       172.16.20.0/24 is directly connected, Loopback0
B       172.16.0.0/16 [200/0] via 202.110.100.1, 00:00:10
R2#
试验结果正常的,
当两个端口都关闭后,显然肯定 R2 上学不到路由,
 
R1(config)#int s1/1
R1(config-if)#shut
R1(config-if)#exit
再在 R2 上测试:
 
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
C       172.16.20.0 is directly connected, Loopback0
R2#
这个结果是必然的,我们试验很顺利。
路由器源地址原理:路由器发送 bgp 包时,默认把“包的流出端口”的 ip 地址作为包的“源地址”。路由器接受到 bgp 包后,把包的“源地址”与自己 neighbor 后的 ip 地址进行比较:
匹配时,正常处理包;不匹配时,丢弃该包。
解决的办法:
通告路由器发送 bgp 包时,把环回口的 ip 地址作为源地址,而不使用“包流出端口 ip 地址”作为包的源地址。
 
 
语法:
config-router #neighbor   邻居环回口 ip remote-as  自治系统号
config-router #neighbor    邻居环回口 ip   update-source   环回口
 
再举出一例:
相同自治系统bgp通信:
 
 
 
 
 
 
 
 
 
 
 
关闭s1/0之前:
关闭s1/0之后:
 
起到的链路冗余的作用,试验结束。




     本文转自shenleigang 51CTO博客,原文链接: http://blog.51cto.com/shenleigang/152629 ,如需转载请自行联系原作者

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值