一、拓扑图:
深入分析bgp选路规则(上)_第1张图片
二、IBGP邻居学来的信息,不会传递给另外IBGP邻居,需要再去手动指定邻居,BGP这条路径能不能通,要看这条路径否成为最佳路径和下一跳是否正确与可达:
1、配置各路由器的IP地址以及配置BGP协议。现在来看一下R3的路由表,看到R3能学到全网的路由:
 
 
3、再去R4上看一下R4的路由表发现没有学到10.1.255.0/30130.130.1.0/24这两条路由:
 
 
8、但我在R4traceroute 10.1.255.4之后,发现R4的路由表发生了变化10.1.255.0/30 不存在了。
   
R4#traceroute 10.1.255.4
 
Type escape sequence to abort.
Tracing the route to 10.1.255.4
 
  1 10.1.255.9 52 msec 32 msec 16 msec
  2  *  *  *
  3  *  *  *
  4  *  *  *
 
R4#sh ip route
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
 
     10.0.0.0/30 is subnetted, 3 subnets
B       10.1.255.4 [200/0] via 10.1.255.9, 00:00:24
C       10.1.255.12 is directly connected, Serial1/1
C       10.1.255.8 is directly connected, Serial1/0
     150.150.0.0/24 is subnetted, 1 subnets
B       150.150.1.0 [20/0] via 10.1.255.14, 00:23:42
 
R4#ping 10.1.255.4
 
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.255.4, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/26/52 ms
R4#

 
         (超过8万字一篇发不了。待续,请接着看下篇)
R4#sh ip route
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
 
     10.0.0.0/30 is subnetted, 3 subnets
B       10.1.255.4 [200/0] via 10.1.255.9, 00:00:21
C       10.1.255.12 is directly connected, Serial1/1
C       10.1.255.8 is directly connected, Serial1/0
     150.150.0.0/24 is subnetted, 1 subnets
B       150.150.1.0 [20/0] via 10.1.255.14, 00:02:27
 
4 、终其原因是因为:IBGP对等体学习到的路由,是不会向其它的IBGP对等体通告的。拓扑中的R3IBGP对等体R4学来的路由是不会向R2这个IBGP对等体通告,同理R3R2学来的路由也不会向R4通告。所以就造成了R2R4学不到完整的路由信息。
5、先在R2R4上互指IBGP邻居,一定要互指,不然邻居不能完全建立起来:
 
R2(config)#router bgp 64513
R2(config-router)#nei 10.1.255.10 remote 64513
R4(config)#router bgp 64513
R4(config-router)#nei 10.1.255.5 remote 64513
 
6、相互指定完IBGP邻居之后,用clear ip bgp  *  把路由表涮新一下。然后再来看一下R2R4的路由表:
 
R2#sh ip route
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
 
     10.0.0.0/30 is subnetted, 4 subnets
C       10.1.255.4 is directly connected, Serial1/1
C       10.1.255.0 is directly connected, Serial1/0
B       10.1.255.12 [200/0] via 10.1.255.10, 00:00:47
B       10.1.255.8 [200/0] via 10.1.255.6, 00:00:56
     130.130.0.0/24 is subnetted, 1 subnets
B       130.130.1.0 [20/0] via 10.1.255.1, 00:00:45
     150.150.0.0/24 is subnetted, 1 subnets
B       150.150.1.0 [200/0] via 10.1.255.14, 00:00:24
R2#
R4#sh ip route
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
 
     10.0.0.0/30 is subnetted, 4 subnets
B       10.1.255.4 [200/0] via 10.1.255.5, 00:00:11
B       10.1.255.0 [200/0] via 10.1.255.5, 00:00:11
C       10.1.255.12 is directly connected, Serial1/1
C       10.1.255.8 is directly connected, Serial1/0
     150.150.0.0/24 is subnetted, 1 subnets
B       150.150.1.0 [20/0] via 10.1.255.14, 00:05:26
R4#
 
7 、通过互指邻居,发现R2能学到全网的路由但是R4却不能学到130.130.1.0/24这条路由,而且还发现到10.1.255.410.1.255.0 走的都是10.1.255.5
 
R4#ping 10.1.255.4
 
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.255.4, timeout is 2 seconds:
.....    (发现不通)
Success rate is 0 percent (0/5)

R3#sh ip route
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
 
     10.0.0.0/30 is subnetted, 4 subnets
C       10.1.255.4 is directly connected, Serial1/0
B       10.1.255.0 [200/0] via 10.1.255.5, 00:07:05
B       10.1.255.12 [200/0] via 10.1.255.10, 00:06:59
C       10.1.255.8 is directly connected, Serial1/1
     130.130.0.0/24 is subnetted, 1 subnets
B       130.130.1.0 [200/0] via 10.1.255.1, 00:06:50
     150.150.0.0/24 is subnetted, 1 subnets
B       150.150.1.0 [200/0] via 10.1.255.14, 00:06:29
 
2 、去看一下R2的路由表,发现R2没有学到10.1.255.12/24150.150.1.0/24这两条路由:
 
R2#sh ip route
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
 
     10.0.0.0/30 is subnetted, 3 subnets
C       10.1.255.4 is directly connected, Serial1/1
C       10.1.255.0 is directly connected, Serial1/0
B       10.1.255.8 [200/0] via 10.1.255.6, 00:01:16
     130.130.0.0/24 is subnetted, 1 subnets
B       130.130.1.0 [20/0] via 10.1.255.1, 00:00:46