使用回环地址建立bgp邻居

来源:互联网 发布:学西班牙语的软件 编辑:程序博客网 时间:2024/05/02 18:50

本文后续中可能存在一处小错误的地方,请自己分辨。

一、拓扑图:
二、详细说明与配置:
1
、配置各接口IP地址,以及R1和R2运行RIP V2,并关闭自动汇总,保证链路的互通性:
2、我们先在R1上配置BGP,这次我们不用对端接口地址来建立bgp的邻居,而是用loopback地址来建立,因为大家知道loopback地址是不会down 的,对于bgp而言这种方式是最好的了。这样有利于bgp邻居关系的稳健性。下面看一下R1的配置:
R1(config)#router bgp 64512
R1(config-router)#net 172.16.0.0 mask 255.255.255.0
R1(config-router)#net 172.16.1.0 mask 255.255.255.0
R1(config-router)#net 172.16.255.0 mask 255.255.255.252
R1(config-router)#nei 172.16.0.1 remote 64512 (指定对端邻居的loopback0接口)
4、查看一下有没有建立起邻居:
R1#show ip bgp sum
BGP router identifier 172.16.1.1, local AS number 64512
BGP table version is 1, main routing table version 1
Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
172.16.16.1     4 64512       0       0        0    0    0 Active (还在尝试连接,发现并没有建立起来)
5、我们在R1上debug ip bgp all看一下:
R1#debug ip bgp all
BGP debugging is on for all address families
R1#
*Mar  1 02:49:46.535: BGP: 172.16.16.1 open active, local address 172.16.255.1
*Mar  1 02:49:46.627: BGP: 172.16.16.1 open failed: Connection lo0(分别在R1,R2指定用自己的lo0接口和对端建邻居)
7、再来看一下邻居关系:
R1#show ip bgp summary
BGP router identifier 172.16.1.1, local AS number 64512
BGP table version is 7, main routing table version 7
5 network entries using 585 bytes of memory
6 path entries using 312 bytes of memory
3/2 BGP path/bestpath attribute entries using 372 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 1269 total bytes of memory
BGP activity 8/3 prefixes, 9/3 paths, scan interval 60 secs
 
Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
update-source lo0
R2(config-router)#nei 192.168.0.1 ebgp-multihop 2 (指出ebgp的邻居地址存在多跳特性)
3、再到R2上看一下bgp的邻居汇总:
R2#show ip bgp summary
BGP router identifier 172.16.16.1, local AS number 64512
BGP table version is 24, main routing table version 24
7 network entries using 819 bytes of memory
8 path entries using 416 bytes of memory
4/3 BGP path/bestpath attribute entries using 496 bytes of memory
1 BGP AS-PATH entries using 24 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 1755 total bytes of memory
BGP activity 9/2 prefixes, 13/5 paths, scan interval 60 secs
 
Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
192.168.0.1     4 64513      14      20       24    0    0 00:03:32        3  (至此两条邻居都能看到了)
 
三、设置邻居的下一跳:
1、现在我们再来看一下R1、R2、R3的bgp路由表:
B       10.1.255.0 [200/0] via 172.16.16.1, 01:16:50 (发现只有一条bgp路由)
 
R2#show 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
 
     172.16.0.0/16 is variably subnetted, 4 subnets, 2 masks
C       172.16.255.0/30 is directly connected, FastEthernet0/0
C       172.16.16.0/24 is directly connected, Loopback0
R       172.16.1.0/24 [120/1] via 172.16.255.1, 00:00:16, FastEthernet0/0 (ibgp内以RIP来走)
     10.0.0.0/30 is subnetted, 1 subnets
C       10.1.255.0 is directly connected, Serial1/1
S    192.168.0.0/24 [1/0] via 10.1.255.2
B       172.16.255.0/30 [20/0] via 172.16.16.1, 01:16:15
B       172.16.1.0/24 [20/0] via 172.16.16.1, 01:16:15  (能够全部学到,并以BGP呈现)
2、因为R1和R2运行了RIP 协议,R3运行的是静态路由。而且BGP运行的是两个AS,从上面的各路由器学到的bgp邻居的情况,我们看到了R3能学到所有的bgp路由,但R1只学到了一条路由,原因是BGP speaker从IBGP获得的路由不向它的IBGP相邻体通告,所以R2并没有把学到的ebgp的路由通告给R1,那么我们只需要在R2上指定从R3那边来的路由指定下一跳为自己,把它通告给R1:
R2(config-router)#nei 172.16.0.1 B       B    B    <span mso-highlight:="" red"="" style="padding: 0px; margin: 0px;">192.168.1.0/24 [200/0] via 172.16.16.1, 00:00:02  (现在学到了三条了。)
R1#
 
 
四、总结:因为只要路由器开启,回环口一直都会是up状态。用回环地址去建立bgp连接能够提高bgp邻居关系的稳健性,但需要注意的是配置时需保证到loopback地址的TCP可达性,而且还要指出用本地回环地址和对端建立邻居,当和ebgp端跨子网建立邻居时,则需要使用ebgp多跳功能来指定ebgp邻居,最大支持255跳。BGP speaker从IBGP获得的路由不向它的IBGP相邻体通告,所以我们要在边缘的路由器上指定下一跳为自己进行路由的转发通告。在BGP中所说的下一跳,是指下一跳AS,而并非是下一跳路由器。由EBGP学来的路由信息,在传递给IBGP邻居时,不改变其下一跳属性值。


本文出自 “超越技术@成就价值” 博客,请务必保留此出处http://supercisco.blog.51cto.com/672109/264891


原创粉丝点击