BGP中使用Lo接口后的问题

请努力,活下来,豁出去
 
BGP基本理伦:
由eBGP邻居学来的信息肯定会传给其他eBGP邻居。
由eBGP邻居学来的信息肯定会传给所有iBGP邻居。
由iBGP邻居学来的信息不会再传给另外的iBGP邻居。(reflector除外)
由iBGP邻居学来的信息:
(1)如果同步关了,会传给eBGP邻居
(2)如果同步开了,先查找自己的IGP。如果IGP里面有这个网络,就把这个网络传给eBGP;如果IGP里面没有这个网络,就不会传给eBGP邻居。
 
上述转自 [url]http://hi.baidu.com/zhoujiemoon/blog/item/6232994b70861cf183025c6c.html[/url]
 
不过今天我的实验不是研究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进行过滤。

你可能感兴趣的:(职场,休闲,lo,BGP)