BGP中使用Lo接口后的问题

简介:
请努力,活下来,豁出去
 
BGP基本理伦:
由eBGP邻居学来的信息肯定会传给其他eBGP邻居。
由eBGP邻居学来的信息肯定会传给所有iBGP邻居。
由iBGP邻居学来的信息不会再传给另外的iBGP邻居。(reflector除外)
由iBGP邻居学来的信息:
(1)如果同步关了,会传给eBGP邻居
(2)如果同步开了,先查找自己的IGP。如果IGP里面有这个网络,就把这个网络传给eBGP;如果IGP里面没有这个网络,就不会传给eBGP邻居。
 
 
不过今天我的实验不是研究iBGP的同步问题,而是neighbor *.*.*.* update-source loopback 0 所带来的问题。
 
R1(S1/1)--(S1/0)R2(S1/1)--(S1/0)R3
R1、R2的as为64512,R3为64513
 
R1#show run
interface Loopback0
 ip address 1.1.1.1 255.255.255.255
!
interface Loopback1
 ip address 172.16.0.1 255.255.255.0
!
interface Loopback2
 ip address 172.16.1.1 255.255.255.0
!
interface Loopback3
 ip address 172.16.2.1 255.255.255.0
!
interface Loopback4
 ip address 172.16.3.1 255.255.255.0
!
interface Serial1/1
 description DCE,BGP 64512,connected to R1's S1/0,ip 172.16.255.2/30
 ip address 172.16.255.1 255.255.255.252
 clock rate 9600
!
router bgp 64512
 no synchronization
 network 172.16.0.0 mask 255.255.255.0
 network 172.16.1.0 mask 255.255.255.0
 network 172.16.2.0 mask 255.255.255.0
 network 172.16.3.0 mask 255.255.255.0
 network 172.16.255.0 mask 255.255.255.252
 neighbor 2.2.2.2 remote-as 64512
 neighbor 2.2.2.2 update-source Loopback0
 no auto-summary
!
ip route 2.2.2.2 255.255.255.255 Serial1/1
 
/////
R2#show run
interface Loopback0
 ip address 2.2.2.2 255.255.255.255
!
interface Serial1/0
 description DTE,BGP 64512,connected to R1's S1/1,ip 172.16.255.1/30
 ip address 172.16.255.2 255.255.255.252
!
interface Serial1/1
 description description DCE,BGP 64512,connected to R3's S1/0,ip 10.1.255.2/30
 ip address 10.1.255.1 255.255.255.252
 clock rate 9600
!
router bgp 64512
 no synchronization
 network 10.1.255.0 mask 255.255.255.252
 network 172.16.255.0 mask 255.255.255.252
 neighbor 1.1.1.1 remote-as 64512
 neighbor 1.1.1.1 update-source Loopback0
 neighbor 3.3.3.3 remote-as 64513
 neighbor 3.3.3.3 ebgp-multihop 2
 neighbor 3.3.3.3 update-source Loopback0
 no auto-summary
!
ip route 1.1.1.1 255.255.255.255 Serial1/0
ip route 3.3.3.3 255.255.255.255 Serial1/1
 
/////
R3#show run
interface Loopback0
 ip address 3.3.3.3 255.255.255.255
!
interface Loopback1
 ip address 192.168.0.1 255.255.255.0
!
interface Loopback2
 ip address 192.168.1.1 255.255.255.0
!
interface Loopback3
 ip address 192.168.2.1 255.255.255.0
!
interface Loopback4
 ip address 192.168.3.1 255.255.255.0
!
interface Serial1/0
 description DTE,BGP 64513,connected to R2's S1/1,ip 10.1.255.1/30
 ip address 10.1.255.2 255.255.255.252
!
router bgp 64513
 no synchronization
 network 10.1.255.0 mask 255.255.255.252
 network 192.168.0.0
 network 192.168.1.0
 network 192.168.2.0
 network 192.168.3.0
 neighbor 2.2.2.2 remote-as 64512
 neighbor 2.2.2.2 ebgp-multihop 2
 neighbor 2.2.2.2 update-source Loopback0
 no auto-summary
!
ip route 2.2.2.2 255.255.255.255 Serial1/0
//////
 
乍看配置,没有任何问题,察看路由表
R1#show ip route
     1.0.0.0/32 is subnetted, 1 subnets
C       1.1.1.1 is directly connected, Loopback0
     2.0.0.0/32 is subnetted, 1 subnets
S       2.2.2.2 is directly connected, Serial1/1
     3.0.0.0/32 is subnetted, 1 subnets
S       3.3.3.3 is directly connected, Serial1/1
     172.16.0.0/16 is variably subnetted, 5 subnets, 2 masks
C       172.16.255.0/30 is directly connected, Serial1/1
C       172.16.0.0/24 is directly connected, Loopback1
C       172.16.1.0/24 is directly connected, Loopback2
C       172.16.2.0/24 is directly connected, Loopback3
C       172.16.3.0/24 is directly connected, Loopback4
     10.0.0.0/30 is subnetted, 1 subnets
B       10.1.255.0 [200/0] via 2.2.2.2, 00:44:01
 
R2#show ip route
     1.0.0.0/32 is subnetted, 1 subnets
S       1.1.1.1 is directly connected, Serial1/0
     2.0.0.0/32 is subnetted, 1 subnets
C       2.2.2.2 is directly connected, Loopback0
     3.0.0.0/32 is subnetted, 1 subnets
S       3.3.3.3 is directly connected, Serial1/1
     172.16.0.0/16 is variably subnetted, 5 subnets, 2 masks
C       172.16.255.0/30 is directly connected, Serial1/0
B       172.16.0.0/24 [200/0] via 1.1.1.1, 00:01:29
B       172.16.1.0/24 [200/0] via 1.1.1.1, 00:01:29
B       172.16.2.0/24 [200/0] via 1.1.1.1, 00:01:29
B       172.16.3.0/24 [200/0] via 1.1.1.1, 00:01:29
     10.0.0.0/30 is subnetted, 1 subnets
C       10.1.255.0 is directly connected, Serial1/1
B    192.168.0.0/24 [20/0] via 3.3.3.3, 00:01:00
B    192.168.1.0/24 [20/0] via 3.3.3.3, 00:01:00
B    192.168.2.0/24 [20/0] via 3.3.3.3, 00:01:01
B    192.168.3.0/24 [20/0] via 3.3.3.3, 00:01:01
 
R3#show ip route
     2.0.0.0/32 is subnetted, 1 subnets
S       2.2.2.2 is directly connected, Serial1/0
     3.0.0.0/32 is subnetted, 1 subnets
C       3.3.3.3 is directly connected, Loopback0
     172.16.0.0/16 is variably subnetted, 5 subnets, 2 masks
B       172.16.255.0/30 [20/0] via 2.2.2.2, 00:01:33
B       172.16.0.0/24 [20/0] via 2.2.2.2, 00:01:33
B       172.16.1.0/24 [20/0] via 2.2.2.2, 00:01:33
B       172.16.2.0/24 [20/0] via 2.2.2.2, 00:01:33
B       172.16.3.0/24 [20/0] via 2.2.2.2, 00:01:33
     10.0.0.0/30 is subnetted, 1 subnets
C       10.1.255.0 is directly connected, Serial1/0
C    192.168.0.0/24 is directly connected, Loopback1
C    192.168.1.0/24 is directly connected, Loopback2
C    192.168.2.0/24 is directly connected, Loopback3
C    192.168.3.0/24 is directly connected, Loopback4
 
R1没有192.168/22网段的路由。由于R2的路由表完整,因此初步判断问题出现在R1的配置或R2的bgp配置上。
 
因为R2的问题只可能在neighbor 3.3.3.3的语句中,检查发现没有问题,因此问题再次定格到R1上。
 
由于R3属于ebgp路由,R1能否获得该路由,可通过上述四条规则判断。
 
R1#debug bgp updates
*May 15 00:31:08.615: BGP(0): no valid path for 192.168.0.0/24
*May 15 00:31:08.615: BGP(0): no valid path for 192.168.1.0/24
*May 15 00:31:08.615: BGP(0): no valid path for 192.168.2.0/24
*May 15 00:31:08.615: BGP(0): no valid path for 192.168.3.0/24
 
上述更加表明R2没有配置问题。关键是为R1何由没有把R2通告的路由直接放到路由表里,而是变成了no valid path了呢?
 
百思不得其解,但解决的方法倒是想到了。由于R1没有有效的路由到R3,估计是R1不知道R3在哪里,也就是R1不知道3.3.3.3在哪里。告诉它就行了。
R1(config)#ip route 3.3.3.3 255.255.255.255 s1/1
 
R1#show ip route
     1.0.0.0/32 is subnetted, 1 subnets
C       1.1.1.1 is directly connected, Loopback0
     2.0.0.0/32 is subnetted, 1 subnets
S       2.2.2.2 is directly connected, Serial1/1
     3.0.0.0/32 is subnetted, 1 subnets
S       3.3.3.3 is directly connected, Serial1/1
     172.16.0.0/16 is variably subnetted, 5 subnets, 2 masks
C       172.16.255.0/30 is directly connected, Serial1/1
C       172.16.0.0/24 is directly connected, Loopback1
C       172.16.1.0/24 is directly connected, Loopback2
C       172.16.2.0/24 is directly connected, Loopback3
C       172.16.3.0/24 is directly connected, Loopback4
     10.0.0.0/30 is subnetted, 1 subnets
B       10.1.255.0 [200/0] via 2.2.2.2, 00:21:39
B    192.168.0.0/24 [200/0] via 3.3.3.3, 00:00:56
B    192.168.1.0/24 [200/0] via 3.3.3.3, 00:00:56
B    192.168.2.0/24 [200/0] via 3.3.3.3, 00:00:56
B    192.168.3.0/24 [200/0] via 3.3.3.3, 00:00:56
 
察看路由表,发现192.168/22的路由,居然是通过3.3.3.3到达的。也就是说,R1把3.3.3.3当作是可达的下一条,这就是为何R1不把R2通告的路由当作有效路由的原因了。
 
那应该如何添加静态路由呢?应该在那些路由器上添加呢?为解决上述两个问题,我修改了上述拓扑图,增加了一台R4路由器,R3的S1/1与R4的S1/0连接,R4属于as 64513,原来R3的lo1、lo2、lo3、lo4改为R4的lo1、lo2、lo3、lo4,设置如下:
R3#show run
interface Loopback0
 ip address 3.3.3.3 255.255.255.255
interface Serial1/0
 description DTE,BGP 64513,connected to R2's S1/1,ip 10.1.255.1/30
 ip address 10.1.255.2 255.255.255.252
!
interface Serial1/1
 description DCE,BGP 64513,connected to R4's S1/0,ip 192.168.255.2/30
 ip address 192.168.255.1 255.255.255.252
 clock rate 9600
!
router bgp 64513
 no synchronization
 neighbor 2.2.2.2 remote-as 64512
 neighbor 2.2.2.2 ebgp-multihop 2
 neighbor 2.2.2.2 update-source Loopback0
 neighbor 4.4.4.4 remote-as 64513
 neighbor 4.4.4.4 update-source Loopback0
 no auto-summary
!
ip route 2.2.2.2 255.255.255.255 10.1.255.1
ip route 4.4.4.4 255.255.255.255 Serial1/1
 
 
R4#show run
interface Loopback0
 ip address 4.4.4.4 255.255.255.255
!
interface Loopback1
 ip address 192.168.0.1 255.255.255.0
!
interface Loopback2
 ip address 192.168.1.1 255.255.255.0
!
interface Loopback3
 ip address 192.168.2.1 255.255.255.0
!
interface Loopback4
 ip address 192.168.3.1 255.255.255.0
!
interface Serial1/0
 description DTE,BGP 64513,connected to R3's S1/1,ip 192.168.255.1/30
 ip address 192.168.255.2 255.255.255.252
!
router bgp 64513
 no synchronization
 network 192.168.0.0
 network 192.168.1.0
 network 192.168.2.0
 network 192.168.3.0
 network 192.168.255.0 mask 255.255.255.252
 neighbor 3.3.3.3 remote-as 64513
 neighbor 3.3.3.3 update-source Loopback0
 no auto-summary
!
ip route 2.2.2.2 255.255.255.255 Serial1/0
ip route 3.3.3.3 255.255.255.255 Serial1/0
 
察看R1的路由表:
R1#show ip route 
     1.0.0.0/32 is subnetted, 1 subnets
C       1.1.1.1 is directly connected, Loopback0
     2.0.0.0/32 is subnetted, 1 subnets
S       2.2.2.2 is directly connected, Serial1/1
     3.0.0.0/32 is subnetted, 1 subnets
S       3.3.3.3 is directly connected, Serial1/1
     172.16.0.0/16 is variably subnetted, 5 subnets, 2 masks
C       172.16.255.0/30 is directly connected, Serial1/1
C       172.16.0.0/24 is directly connected, Loopback1
C       172.16.1.0/24 is directly connected, Loopback2
C       172.16.2.0/24 is directly connected, Loopback3
C       172.16.3.0/24 is directly connected, Loopback4
B    192.168.0.0/24 [200/0]  via 3.3.3.3, 00:05:54
B    192.168.1.0/24 [200/0] via 3.3.3.3, 00:05:55
B    192.168.2.0/24 [200/0] via 3.3.3.3, 00:05:55
B    192.168.3.0/24 [200/0] via 3.3.3.3, 00:05:55
 
以及其中一条路由
R1#show ip route 192.168.0.0
Routing entry for 192.168.0.0/24
  Known via "bgp 64512", distance 200, metric 0
  Tag 64513, type internal
   Last update from 3.3.3.3 00:06:00 ago
  Routing Descriptor Blocks:
  * 3.3.3.3, from 2.2.2.2, 00:06:00 ago
      Route metric is 0, traffic share count is 1
      AS Hops 1
 
可以发现,路由表完全正常。每台路由器均配了两条静态路由,其中蓝色标识的路由用语iBGP获取路由,这些一般在as里面应该由IGP实现,目的是所有iBGP Peers的路由一致。关键是红字的部分,可以看到,所有非直联的iBGP Peer与eBGP Peer之间的路由,均由对端AS的网关作为源。因此必须配置一条到对端网关的静态路由。
该静态路由可在与该eBGP peer连接的iBGP peer上设置,然后在IGP里进行重分配。若该iBGP peer上有其他私有的static routes,可使用分配控制列表或route-map进行过滤。


本文转自 gole_huang 51CTO博客,原文链接:http://blog.51cto.com/golehuang/76972

相关文章
|
3天前
|
网络虚拟化
配置BGP/MPLS IP VPN示例
配置BGP/MPLS IP VPN示例
|
5月前
|
负载均衡 网络协议 算法
IP路由协议(RIP、IGRP、OSPF、IS-IS、BGP)
1、路由分类 路由产生方式: 直接路由:路由器会自动生成本路由器激活端口所在网段的路由条目 静态路由:网络管理员手工配置,静态路由信息在缺省的情况下私有的,不会传递给其他的路由器
|
网络协议
配置OSPF
配置OSPF
74 0
配置OSPF
|
网络协议 网络架构 iOS开发
概述、 BGP AS 、BGP 邻居、 BGP 更新源 、BGP TTL 、BGP路由表、 BGP 同步(下)
文章目录 系列文件 概述 BGP AS BGP 邻居 BGP 更新源 BGP TTL BGP路由表 BGP 同步
354 0
概述、 BGP AS 、BGP 邻居、 BGP 更新源 、BGP TTL 、BGP路由表、 BGP 同步(下)
|
网络协议 算法 数据库
概述、 BGP AS 、BGP 邻居、 BGP 更新源 、BGP TTL 、BGP路由表、 BGP 同步(上)
文章目录 系列文件 概述 BGP AS BGP 邻居 BGP 更新源 BGP TTL BGP路由表 BGP 同步
298 0
概述、 BGP AS 、BGP 邻居、 BGP 更新源 、BGP TTL 、BGP路由表、 BGP 同步(上)
|
网络协议 网络架构
OSPF中的次优外部路由——Forwarding Address
在OSPF中外部路由是从ASBR(自治系统边界路由器)中导进来的(第五类的LSA)
310 0
OSPF中的次优外部路由——Forwarding Address