免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 4366 | 回复: 1
打印 上一主题 下一主题

Understand BGP Sychronization Rule [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-07-16 19:52 |只看该作者 |倒序浏览

实验目的:
1、深入理解BGP的同步规则。

实验拓扑图:


实验步骤及要求:
1、配置各台路由器的IP地址,并且使用Ping命令确认各路由器的直连口的互通。
2、配置各路由器的BGP协议:
R3#show ip protocols
Routing Protocol is "bgp 64513"
  Outgoing update filter list for all interfaces is not set
  Incoming update filter list for all interfaces is not set
  IGP synchronization is disabled
[stanley1]

  Automatic route summarization is disabled
  Neighbor(s):
    Address          FiltIn FiltOut DistIn DistOut Weight RouteMap
    10.1.255.5                                          
    10.1.255.10                                          
  Maximum path: 1
  Routing Information Sources:
    Gateway         Distance      Last Update
    10.1.255.5           200      00:02:52
    10.1.255.10          200      00:29:53
  Distance: external 20 internal 200 local 200

R3#
4、查看R2与R4的路由表:
R2#show ip 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:06:24
     130.130.0.0/24 is subnetted, 1 subnets
B       130.130.1.0 [20/0] via 10.1.255.1, 00:07:20
[stanley2]

R2#

R4#show ip 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:06:20
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:06:20
[stanley3]

R4#
5、出现这种问题的主要原因是:BGP规则:从iBGP对等体学习到路由,永远不会向其它的iBGP对等体通告。正是因为这个原因,所以R2和R4无法学习完整的网络路由。
6、在R2和R4的路由器上配置iBGP的邻居关系,配置如下:
R2(config)#router bgp 64513
R2(config-router)#neighbor 10.1.255.10 remote-as 64513
[stanley4]

R2(config-router)#exit
R2(config)#exit

R4(config)#router bgp 64513
R4(config-router)#neighbor 10.1.255.5 remote-as 64513
R4(config-router)#exit
R4(config)#exit
7、再次查看R2和R4的路由表:
R2#show ip 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:05:51
B       10.1.255.8 [200/0] via 10.1.255.6, 00:06:03
     130.130.0.0/24 is subnetted, 1 subnets
B       130.130.1.0 [20/0] via 10.1.255.1, 00:06:03
     150.150.0.0/24 is subnetted, 1 subnets
B       150.150.1.0 [200/0] via 10.1.255.14, 00:05:39
[stanley5]
R2#

R4#show ip route

     10.0.0.0/30 is subnetted, 4 subnets
B       10.1.255.4 [200/0] via 10.1.255.5, 00:00:06
B       10.1.255.0 [200/0] via 10.1.255.5, 00:00:06
[stanley6]
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:16:40
[stanley7]

R4#
8、查看bgp的内部路由表:
R4#show ip bgp


   Network          Next Hop            Metric LocPrf Weight Path
* i10.1.255.0/30    10.1.255.5               0    100      0 i
* i10.1.255.4/30    10.1.255.5               0    100      0 i
*>i                 10.1.255.9               0    100      0 i
* i10.1.255.8/30    10.1.255.9               0    100      0 i
*>                  0.0.0.0                  0         32768 i
*  10.1.255.12/30   10.1.255.14              0             0 64514 i
*>                  0.0.0.0                  0         32768 i
* i130.130.1.0/24   10.1.255.1               0    100      0 64512 i
[stanley8]

*> 150.150.1.0/24   10.1.255.14              0             0 64514 i
R4#
9、查看130.130.1.0/24网络路由,具体信息:
R4#show ip bgp 130.130.1.0
BGP routing table entry for 130.130.1.0/24, version 0
Paths: (1 available, no best path)
  Not advertised to any peer
  64512
    10.1.255.1 (inaccessible) from 10.1.255.5 (10.1.255.5)
[stanley9]

      Origin IGP, metric 0, localpref 100, valid, internal
10、继续分析:
R4#show ip bgp 10.1.255.0
…………
  Advertised to non peer-group peers:
  10.1.255.14
  Local
    10.1.255.5 from 10.1.255.5 (10.1.255.5)
      Origin IGP, metric 0, localpref 100, valid, internal, best
[stanley10]
R4#ping 10.1.255.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.255.1, timeout is 2 seconds:
.....
[stanley11]

Success rate is 0 percent (0/5)
11、产生此问题的原因是:BGP选路规则:当两条路由度量均相等时,而且都来自于相同自治系统的iBGP的邻居,会优先选择route id较的iBGP邻居的路由。
12、配置一个较高的router id给R2路由器解决此问题:
R2(config)#router bgp 64513
R2(config-router)#bgp router-id 172.16.255.254
[stanley12]

13、在等邻居重新建立后,再次观察R4的路由表:
R4#show ip route

     10.0.0.0/30 is subnetted, 4 subnets
B       10.1.255.4 [200/0] via 10.1.255.9, 00:02:28
[stanley13]

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
     130.130.0.0/24 is subnetted, 1 subnets
B       130.130.1.0 [200/0] via 10.1.255.1, 00:00:01
     150.150.0.0/24 is subnetted, 1 subnets
B       150.150.1.0 [20/0] via 10.1.255.14, 00:27:36
R4#
R4#ping 10.1.255.5

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.255.5, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 120/156/208 ms
R4#
14、在R2、R3和R4上配置OSPF路由协议并开启同步规则,配置如下:
R2(config)#router bgp 64513
R2(config-router)#synchronization
[stanley14]

R2(config-router)#exit
R2(config)#router ospf 1
R2(config-router)#network 10.1.255.0 0.0.0.3 area 0
R2(config-router)#network 10.1.255.4 0.0.0.3 area 0

R3(config)#router bgp 64513
R3(config-router)#synchronization
R3(config-router)#exit
R3(config)#router ospf 1
R3(config-router)#network 10.1.255.4 0.0.0.3 area 0
R3(config-router)#network 10.1.255.8 0.0.0.3 area 0

R4(config)#router bgp 64513
R4(config-router)#synchronization
R4(config-router)#exit
R4(config)#router ospf 1
R4(config-router)#network 10.1.255.8 0.0.0.3 area 0
R4(config-router)#network 10.1.255.12 0.0.0.3 area 0
15、查看R1路由器,确认是否学习到150.150.1.0/24网络路由:
R1#show ip route

     10.0.0.0/30 is subnetted, 4 subnets
B       10.1.255.4 [20/0] via 10.1.255.2, 00:21:11
C       10.1.255.0 is directly connected, Serial1/1
B       10.1.255.12 [20/0] via 10.1.255.2, 00:03:37
B       10.1.255.8 [20/0] via 10.1.255.2, 00:12:37
     130.130.0.0/24 is subnetted, 1 subnets
C       130.130.1.0 is directly connected, Loopback0
可以看出R1仍然没有学习到150.150.1.0/24网络路由。
16、查看R2路由表,可以其也无法学习到整个网络的路由:
R2#show ip route

     10.0.0.0/30 is subnetted, 4 subnets
O       10.1.255.4 [110/128] via 10.1.255.9, 00:00:44, Serial1/0
O       10.1.255.0 [110/192] via 10.1.255.9, 00:00:44, Serial1/0
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:45:28
17、查看R2的BGP表:
R2#show ip bgp
   Network          Next Hop            Metric LocPrf Weight Path
*  10.1.255.0/30    10.1.255.1               0             0 64512 i
*>                  0.0.0.0                  0         32768 i
*> 10.1.255.4/30    0.0.0.0                  0         32768 i
* i                 10.1.255.6               0    100      0 i
r i10.1.255.8/30    10.1.255.10              0    100      0 i
r>i                 10.1.255.6               0    100      0 i
r>i10.1.255.12/30   10.1.255.10              0    100      0 i
*> 130.130.1.0/24   10.1.255.1               0             0 64512 i
* i150.150.1.0/24   10.1.255.14              0    100      0 64514 i
[stanley15]

R2#
18、查看详细的150.150.1.0/24网络路由描述:
R2#show ip bgp 150.150.1.0
BGP routing table entry for 150.150.1.0/24, version 0
Paths: (1 available, no best path)
  Not advertised to any peer
[stanley16]

  64514
    10.1.255.14 (inaccessible) from 10.1.255.10 (10.1.255.13)
      Origin IGP, metric 0, localpref 100, valid, internal, not synchronized
[stanley17]

19、产生此问题的主要原因是:BGP同步规则,不使用或不通告给任何EBGP邻居从IBGP邻居学习到路由,直到IGPs也学习到相同路由。
20、使用路由重发布解决该问题,在R4上配置重发布:
R4(config)#router ospf 1
R4(config-router)#redistribute bgp 64513 metric 200 subnets
[stanley18]

R4(config-router)#exit
21、再次在R2上查看150.150.1.0/24网络路由的BGP描述:
R2#show ip bgp 150.150.1.0
BGP routing table entry for 150.150.1.0/24, version 16
Paths: (1 available, best #1, table Default-IP-Routing-Table, RIB-failure(17))
Flag: 0x820
  Advertised to non peer-group peers:
  10.1.255.1
  64514
    10.1.255.14 (metric 192) from 10.1.255.10 (10.1.255.13)
      Origin IGP, metric 0, localpref 100, valid, internal, synchronized, best
[stanley19]

22、查看R1的路由表,确认路由:
R1#show ip route



     10.0.0.0/30 is subnetted, 4 subnets
B       10.1.255.4 [20/0] via 10.1.255.2, 00:25:11
C       10.1.255.0 is directly connected, Serial1/1
B       10.1.255.12 [20/0] via 10.1.255.2, 00:07:37
B       10.1.255.8 [20/0] via 10.1.255.2, 00:16:37
     130.130.0.0/24 is subnetted, 1 subnets
C       130.130.1.0 is directly connected, Loopback0
     150.150.0.0/24 is subnetted, 1 subnets
B       150.150.1.0 [20/0] via 10.1.255.2, 00:01:36
R1#
23、同样,在R2上也需要配置重发布,来解决R4 BGP学习的130.130.1.0/24网络同步问题。具体配置不再列出。
24、实验完成。


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u3/99768/showart_1998548.html

论坛徽章:
0
2 [报告]
发表于 2011-01-17 16:59 |只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP