BGP路由聚合配置实例

如下图示:

BGP路由聚合配置实例_第1张图片

R1:
interface Loopback0
 ip address 1.1.1.1 255.255.255.255
interface Loopback11
 ip address 11.11.11.1 255.255.255.0
interface Loopback101
 ip address 101.1.1.1 255.255.255.0
interface FastEthernet0/0
 ip address 12.1.1.1 255.255.255.0
 no sh
interface FastEthernet0/1
 ip address 13.1.1.1 255.255.255.0
 no sh
router ospf 1
 network 1.1.1.1 0.0.0.0 area 0
 network 12.1.1.0 0.0.0.255 area 0
 network 13.1.1.0 0.0.0.255 area 0
router bgp 1
 bgp router-id 1.1.1.1
 network 11.11.11.0 mask 255.255.255.0
 network 101.1.1.0 mask 255.255.255.0
 neighbor 2.2.2.2 remote-as 1
 neighbor 2.2.2.2 update-source Loopback0
 neighbor 3.3.3.3 remote-as 1
 neighbor 3.3.3.3 update-source Loopback0

R2:
interface Loopback0
 ip address 2.2.2.2 255.255.255.255
interface Loopback22
 ip address 22.22.22.2 255.255.255.0
interface FastEthernet0/0
 ip address 12.1.1.2 255.255.255.0
 no sh
interface FastEthernet0/1
 ip address 24.1.1.2 255.255.255.0
 no sh
router ospf 1
 network 2.2.2.2 0.0.0.0 area 0
 network 12.1.1.0 0.0.0.255 area 0
 network 24.1.1.0 0.0.0.255 area 0
router bgp 1
 bgp router-id 2.2.2.2
 network 22.22.22.0 mask 255.255.255.0
 neighbor 1.1.1.1 remote-as 1
 neighbor 1.1.1.1 update-source Loopback0
 neighbor 4.4.4.4 remote-as 4
 neighbor 4.4.4.4 ebgp-multihop 255
 neighbor 4.4.4.4 update-source Loopback0

R3:
interface Loopback0
 ip address 3.3.3.3 255.255.255.255
interface Loopback33
 ip address 33.33.33.3 255.255.255.0
interface FastEthernet0/0
 ip address 34.1.1.3 255.255.255.0
 no sh
interface FastEthernet0/1
 ip address 13.1.1.3 255.255.255.0
 no sh
router ospf 1
 network 3.3.3.3 0.0.0.0 area 0
 network 13.1.1.0 0.0.0.255 area 0
 network 34.1.1.0 0.0.0.255 area 0
router bgp 1
 bgp router-id 3.3.3.3
 network 33.33.33.0 mask 255.255.255.0
 neighbor 1.1.1.1 remote-as 1
 neighbor 1.1.1.1 update-source Loopback0
 neighbor 4.4.4.4 remote-as 4
 neighbor 4.4.4.4 ebgp-multihop 255
 neighbor 4.4.4.4 update-source Loopback0

R4:
interface Loopback0
 ip address 4.4.4.4 255.255.255.255
interface Loopback44
 ip address 44.44.44.4 255.255.255.0
interface FastEthernet0/0
 ip address 34.1.1.4 255.255.255.0
 no sh
interface FastEthernet0/1
 ip address 24.1.1.4 255.255.255.0
 no sh    
interface FastEthernet1/0
 ip address 45.1.1.4 255.255.255.0
 no sh
interface FastEthernet1/1
 ip address 46.1.1.4 255.255.255.0
 no sh
router ospf 1
 network 4.4.4.4 0.0.0.0 area 0
 network 24.1.1.0 0.0.0.255 area 0
 network 34.1.1.0 0.0.0.255 area 0
 network 45.1.1.0 0.0.0.255 area 0
 network 46.1.1.0 0.0.0.255 area 0
router bgp 4
 bgp router-id 4.4.4.4
 network 44.44.44.0 mask 255.255.255.0
 //aggregate-address 101.1.0.0 255.255.252.0 as-set summary-only  //抑制全部的101.1.0.0/22明细路由,只发汇总路由。(在此实验,这一条命令是多余的。)
 neighbor 2.2.2.2 remote-as 1
 neighbor 2.2.2.2 ebgp-multihop 255
 neighbor 2.2.2.2 update-source Loopback0
 neighbor 3.3.3.3 remote-as 1
 neighbor 3.3.3.3 ebgp-multihop 255
 neighbor 3.3.3.3 update-source Loopback0
 neighbor 5.5.5.5 remote-as 5
 neighbor 5.5.5.5 ebgp-multihop 255
 neighbor 5.5.5.5 update-source Loopback0
 neighbor 6.6.6.6 remote-as 6
 neighbor 6.6.6.6 ebgp-multihop 255
 neighbor 6.6.6.6 update-source Loopback0
access-list 1 permit 101.1.1.0   //以下五行命令是抑制101.1.1.0这个网段不予通告路由。
route-map apple permit 10
 match ip address 1
router bgp 4
 aggregate-address 101.1.0.0 255.255.252.0 as-set suppress-map apple


R5:
interface Loopback0
 ip address 5.5.5.5 255.255.255.255
interface Loopback55
 ip address 55.55.55.5 255.255.255.0
interface FastEthernet1/0
 ip address 45.1.1.5 255.255.255.0
 no sh
router ospf 1
 network 5.5.5.5 0.0.0.0 area 0
 network 45.1.1.0 0.0.0.255 area 0
router bgp 5
 bgp router-id 5.5.5.5
 network 55.55.55.0 mask 255.255.255.0
 neighbor 4.4.4.4 remote-as 4
 neighbor 4.4.4.4 ebgp-multihop 255
 neighbor 4.4.4.4 update-source Loopback0

R6:
interface Loopback0
 ip address 6.6.6.6 255.255.255.255
interface Loopback66
 ip address 66.66.66.6 255.255.255.0
interface Loopback101
 ip address 101.1.3.6 255.255.255.0 secondary
 ip address 101.1.2.6 255.255.255.0
interface FastEthernet1/1
 ip address 46.1.1.6 255.255.255.0
 no sh
router ospf 1
 network 6.6.6.6 0.0.0.0 area 0
 network 46.1.1.0 0.0.0.255 area 0
router bgp 6
 bgp router-id 6.6.6.6
 network 66.66.66.0 mask 255.255.255.0
 network 101.1.2.0 mask 255.255.255.0
 network 101.1.3.0 mask 255.255.255.0
 neighbor 4.4.4.4 remote-as 4
 neighbor 4.4.4.4 ebgp-multihop 255
 neighbor 4.4.4.4 update-source Loopback0

R5(config-router)#do show ip bgp
BGP table version is 32, local router ID is 5.5.5.5
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 11.11.11.0/24    4.4.4.4                                0 4 1 i
*> 22.22.22.0/24    4.4.4.4                                0 4 1 i
*> 33.33.33.0/24    4.4.4.4                                0 4 1 i
*> 44.44.44.0/24    4.4.4.4                  0             0 4 i
*> 55.55.55.0/24    0.0.0.0                  0         32768 i
*> 66.66.66.0/24    4.4.4.4                                0 4 6 i
*> 101.1.0.0/22     4.4.4.4                  0             0 4 {1,6} i
*> 101.1.2.0/24     4.4.4.4                                0 4 6 i
*> 101.1.3.0/24     4.4.4.4                                0 4 6 i

R1(config-router)#do show ip bgp
BGP table version is 52, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 11.11.11.0/24    0.0.0.0                  0         32768 i
*>i22.22.22.0/24    2.2.2.2                  0    100      0 i
*>i33.33.33.0/24    3.3.3.3                  0    100      0 i
* i44.44.44.0/24    4.4.4.4                  0    100      0 4 i
*>i                 4.4.4.4                  0    100      0 4 i
* i55.55.55.0/24    4.4.4.4                  0    100      0 4 5 i
*>i                 4.4.4.4                  0    100      0 4 5 i
* i66.66.66.0/24    4.4.4.4                  0    100      0 4 6 i
*>i                 4.4.4.4                  0    100      0 4 6 i
*> 101.1.1.0/24     0.0.0.0                  0         32768 i
* i101.1.2.0/24     4.4.4.4                  0    100      0 4 6 i
*>i                 4.4.4.4                  0    100      0 4 6 i
* i101.1.3.0/24     4.4.4.4                  0    100      0 4 6 i
*>i                 4.4.4.4                  0    100      0 4 6 i

R1(config-router)#do ping 101.1.2.6

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 101.1.2.6, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 44/64/112 ms

 

增加语句:
R1:
router bgp 1
 neighbor 3.3.3.3 route-reflector-client //这两句必须加,否R2和R3不知道对方的存在。
 neighbor 2.2.2.2 route-reflector-client 

 

转载于:https://www.cnblogs.com/vincent-liang/p/6441860.html

你可能感兴趣的:(BGP路由聚合配置实例)