BGP路由汇总

组网介绍

BGP AS号、互联地址如图所示,所有设备均创建Loopback0接口,IP地址为10.0.x.x/32,其中x为设备编号。

R1、R2、R3使用Loopback0地址作为BGP Router ID,基于直连接口建立EBGP对等体关系。

R1、R3上存在Loopback1、Loopback2接口,用于模拟用户网段。

任务思路

  1. 设备IP地址配置。
  2. 按照规划配置R1、R2、R3之间的EBGP对等体关系。
  3. 在R1上将Loopback1、Loopback2接口路由发布到BGP中并进行自动汇总,在R2上观察BGP汇总路由的明细信息。
  4. 在R3上将Loopback1、Loopback2接口路由发布到BGP中,在R2上执行手动汇总,观察R2、R3上的BGP汇总路由的明细信息。之后在R2上执行手动汇总并增加关键字as-set,再次观察R2上的BGP汇总路由的明细信息。

AR6

The device is running!
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys AR6
[AR6]int lo0
[AR6-LoopBack0]ip add 10.0.1.1 32
[AR6-LoopBack0]int lo1
[AR6-LoopBack1]ip add 172.16.1.0 24
[AR6-LoopBack1]ip add 172.16.1.1
[AR6-LoopBack1]int lo2
[AR6-LoopBack2]ip add 172.16.2
[AR6-LoopBack2]q
[AR6]int g0/0/0
[AR6-GigabitEthernet0/0/0]ip add 10.0.12.1 24
Jul 25 2024 18:49:18-08:00 AR6 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
 on the interface GigabitEthernet0/0/0 has entered the UP state. 
[AR6-GigabitEthernet0/0/0]q
[AR6]bgp 64511
[AR6-bgp]rou	
[AR6-bgp]route-select
[AR6-bgp]router-id 10.0.1.1
[AR6-bgp]peer 10.0.1 as 64512
[AR6-bgp]
Jul 25 2024 18:55:32-08:00 AR6 %%01BGP/3/STATE_CHG_UPDOWN(l)[1]:The status of th
e peer 10.0.12.2 changed from OPENCONFIRM to ESTABLISHED. (InstanceName=Public, 
StateChangeReason=Up)  
<AR6>sys
Enter system view, return user view with Ctrl+Z.
[AR6]ip ip	
[AR6]ip ip-prefix 1 permit 172.16.0.0 16 g	
[AR6]ip ip-prefix 1 permit 172.16.0.0 16 greater-equal 24 le	
[AR6]ip ip-prefix 1 permit 172.16.0.0 16 greater-equal 24 less-equal 24
[AR6]rou	
[AR6]route
[AR6]route-policy hcip per	
[AR6]route-policy hcip permit node 10
Info: New Sequence of this List.
[AR6-route-policy]if	
[AR6-route-policy]if-match ip	
[AR6-route-policy]if-match ip
[AR6-route-policy]if-match ip-prefix 1
[AR6-route-policy]q
[AR6]bgp 64511
[AR6-bgp]im	
[AR6-bgp]import-route d	
[AR6-bgp]import-route direct rou	
[AR6-bgp]import-route direct route-policy hcip
[AR6-bgp]su	
[AR6-bgp]summary au	
[AR6-bgp]summary automatic 
Info: Automatic summarization is valid only for the routes imported through the 
import-route command.
[AR6-bgp]q
[AR6]q
<AR6>dis bgp rou	
<AR6>dis bgp routing-table 
 BGP Local router ID is 10.0.1.1 
 Status codes: * - valid, > - best, d - damped,
               h - history,  i - internal, s - suppressed, S - Stale
               Origin : i - IGP, e - EGP, ? - incomplete
 Total Number of Routes: 3
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn
 *>   172.16.0.0         127.0.0.1                             0      ?
 s>   172.16.1.0/24      0.0.0.0         0                     0      ?
 s>   172.16.2.0/24      0.0.0.0         0                     0      ?
<AR6>save
  The current configuration will be written to the device. 
  Are you sure to continue? (y/n)[n]:y
  It will take several minutes to save configuration file, please wait.......
  Configuration file had been saved successfully
  Note: The configuration file will take effect after being activated

AR7

The device is running!
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys AR7
[AR7]int lo0
[AR7-LoopBack0]ip add 10.0.2.2 32
[AR7-LoopBack0]int g0/0/0
[AR7-GigabitEthernet0/0/0]ip add 10.0.12.2 24
Jul 25 2024 18:50:04-08:00 AR7 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
 on the interface GigabitEthernet0/0/0 has entered the UP state. 
[AR7-GigabitEthernet0/0/0]int g0/0/1
[AR7-GigabitEthernet0/0/1]ip add 10.0.23
[AR7-GigabitEthernet0/0/1]
Jul 25 2024 18:50:19-08:00 AR7 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
 on the interface GigabitEthernet0/0/1 has entered the UP state. 
[AR7-GigabitEthernet0/0/1]q
[AR7]bgp 64512
[AR7-bgp]rou	
[AR7-bgp]route-select
[AR7-bgp]router-id 10.0.2.2
[AR7-bgp]peer 10.0.12.1 as 64511
[AR7-bgp]peer 10.0.23.3 as 64513
[AR7-bgp]
Jul 25 2024 18:55:32-08:00 AR7 %%01BGP/3/STATE_CHG_UPDOWN(l)[2]:The status of th
e peer 10.0.12.1 changed from OPENCONFIRM to ESTABLISHED. (InstanceName=Public, 
StateChangeReason=Up)  
[AR7-bgp]q
[AR7]q
<AR7>display bgp peer
 BGP local router ID : 10.0.2.2
 Local AS number : 64512
 Total number of peers : 2		  Peers in established state : 1
  Peer            V          AS  MsgRcvd  MsgSent  OutQ  Up/Down       State Pre
fRcv
  10.0.12.1       4       64511        4        4     0 00:02:58 Established    
   0
  10.0.23.3       4       64513        0        1     0 00:03:02      Active    
   0
<AR7>
Jul 25 2024 18:58:31-08:00 AR7 %%01BGP/3/STATE_CHG_UPDOWN(l)[3]:The status of th
e peer 10.0.23.3 changed from OPENCONFIRM to ESTABLISHED. (InstanceName=Public, 
StateChangeReason=Up)  
<AR7>display bgp peer
 BGP local router ID : 10.0.2.2
 Local AS number : 64512
 Total number of peers : 2		  Peers in established state : 2
  Peer            V          AS  MsgRcvd  MsgSent  OutQ  Up/Down       State Pre
fRcv
  10.0.12.1       4       64511        5        5     0 00:03:05 Established    
   0
  10.0.23.3       4       64513        2        3     0 00:00:05 Established    
   0
<AR7>dis bgp rou	
<AR7>dis bgp routing-table 
 BGP Local router ID is 10.0.2.2 
 Status codes: * - valid, > - best, d - damped,
               h - history,  i - internal, s - suppressed, S - Stale
               Origin : i - IGP, e - EGP, ? - incomplete
 Total Number of Routes: 1
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn
 *>   172.16.0.0         10.0.12.1                             0      64511?
<AR7>dis bgp routing-table 172.16.0.0
 BGP local router ID : 10.0.2.2
 Local AS number : 64512
 Paths:   1 available, 1 best, 1 select
 BGP routing table entry information of 172.16.0.0/16:
 From: 10.0.12.1 (10.0.1.1)
 Route Duration: 00h00m52s  
 Direct Out-interface: GigabitEthernet0/0/0
 Original nexthop: 10.0.12.1
 Qos information : 0x0
 AS-path 64511, origin incomplete, pref-val 0, valid, external, best, select, ac
tive, pre 255
 Aggregator: AS 64511, Aggregator ID 10.0.1.1
 Advertised to such 2 peers:
    10.0.12.1
    10.0.23.3
<AR7>dis bgp routing-table 
 BGP Local router ID is 10.0.2.2 
 Status codes: * - valid, > - best, d - damped,
               h - history,  i - internal, s - suppressed, S - Stale
               Origin : i - IGP, e - EGP, ? - incomplete
 Total Number of Routes: 3
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn
 *>   172.16.0.0         10.0.12.1                             0      64511?
 *>   172.17.1.0/24      10.0.23.3       0                     0      64513?
 *>   172.17.2.0/24      10.0.23.3       0                     0      64513?
<AR7>sys
Enter system view, return user view with Ctrl+Z.
[AR7]bgp 64512
[AR7-bgp]ag	
[AR7-bgp]aggregate 172.17.0.0 22 d	
[AR7-bgp]aggregate 172.17.0.0 22 detail-suppressed 
[AR7-bgp]q
[AR7]q
<AR7>dis bgp rou	
<AR7>dis bgp routing-table 
 BGP Local router ID is 10.0.2.2 
 Status codes: * - valid, > - best, d - damped,
               h - history,  i - internal, s - suppressed, S - Stale
               Origin : i - IGP, e - EGP, ? - incomplete
 Total Number of Routes: 4
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn
 *>   172.16.0.0         10.0.12.1                             0      64511?
 *>   172.17.0.0/22      127.0.0.1                             0      ?
 s>   172.17.1.0/24      10.0.23.3       0                     0      64513?
 s>   172.17.2.0/24      10.0.23.3       0                     0      64513?
<AR7>dis bgp routing-table 172.17.0.0 
 BGP local router ID : 10.0.2.2
 Local AS number : 64512
 Paths:   1 available, 1 best, 1 select
 BGP routing table entry information of 172.17.0.0/22:
 Aggregated route. 
 Route Duration: 00h00m49s  
 Direct Out-interface: NULL0
 Original nexthop: 127.0.0.1
 Qos information : 0x0
 AS-path Nil, origin incomplete, pref-val 0, valid, local, best, select, active,
 pre 255
 Aggregator: AS 64512, Aggregator ID 10.0.2.2, Atomic-aggregate
 Advertised to such 2 peers:
    10.0.12.1
    10.0.23.3
<AR7>sys
Enter system view, return user view with Ctrl+Z.
[AR7]bgp 64512
[AR7-bgp]ag	
[AR7-bgp]aggregate 172.17.0.0 255.255.252.0 de	
[AR7-bgp]aggregate 172.17.0.0 255.255.252.0 detail-suppressed as	
[AR7-bgp]aggregate 172.17.0.0 255.255.252.0 detail-suppressed as-set 
[AR7-bgp]q
[AR7]q
<AR7>dis bgp routing-table 172.17.0.0 22
 BGP local router ID : 10.0.2.2
 Local AS number : 64512
 Paths:   1 available, 1 best, 1 select
 BGP routing table entry information of 172.17.0.0/22:
 Aggregated route. 
 Route Duration: 00h00m15s  
 Direct Out-interface: NULL0
 Original nexthop: 127.0.0.1
 Qos information : 0x0
 AS-path 64513, origin incomplete, pref-val 0, valid, local, best, select, activ
e, pre 255
 Aggregator: AS 64512, Aggregator ID 10.0.2.2, Atomic-aggregate
 Advertised to such 2 peers:
    10.0.12.1
    10.0.23.3
<AR7>save
  The current configuration will be written to the device. 
  Are you sure to continue? (y/n)[n]:y
  It will take several minutes to save configuration file, please wait.......
  Configuration file had been saved successfully
  Note: The configuration file will take effect after being activated

AR8

The device is running!
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys AR8
[AR8]
  Please check whether system data has been changed, and save data in time
  Configuration console time out, please press any key to log on
<AR8>sys
Enter system view, return user view with Ctrl+Z.
[AR8]int lo0
[AR8-LoopBack0]ip add 10.0.3.3 32
[AR8-LoopBack0]int lo1
[AR8-LoopBack1]ip add 172.17.1.1 24
[AR8-LoopBack1]int lo2
[AR8-LoopBack2]ip add 172.17.2
[AR8-LoopBack2]int g0/0/1
[AR8-GigabitEthernet0/0/1]ip add 10.0.23.3 24
Jul 25 2024 18:51:40-08:00 AR8 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
 on the interface GigabitEthernet0/0/1 has entered the UP state. 
[AR8-GigabitEthernet0/0/1]q
[AR8]bgp 64513
[AR8-bgp]rou	
[AR8-bgp]route-select
[AR8-bgp]router-id 10.0.3.3
[AR8-bgp]peer 10.0.23.2 as 64512
[AR8-bgp]dis th
[V200R003C00]
#
bgp 64513
 router-id 10.0.3.3
 peer 10.0.23.2 as-number 64512 
 #
 ipv4-family unicast
  undo synchronization
  peer 10.0.23.2 enable
#
return
[AR8-bgp]
Jul 25 2024 18:58:31-08:00 AR8 %%01BGP/3/STATE_CHG_UPDOWN(l)[1]:The status of th
e peer 10.0.23.2 changed from OPENCONFIRM to ESTABLISHED. (InstanceName=Public, 
StateChangeReason=Up)  
[AR8-bgp]q
[AR8]ip ip	
[AR8]ip ip-prefix 1 per	
[AR8]ip ip-prefix 1 permit 172.17.0.0 16 g	
[AR8]ip ip-prefix 1 permit 172.17.0.0 16 greater-equal 24 le	
[AR8]ip ip-prefix 1 permit 172.17.0.0 16 greater-equal 24 less-equal 24
[AR8]rou	
[AR8]route
[AR8]route-policy hcip per	
[AR8]route-policy hcip permit node 10
Info: New Sequence of this List.
[AR8-route-policy]if	
[AR8-route-policy]if-match ip	
[AR8-route-policy]if-match ip
[AR8-route-policy]if-match ip-prefix 1
[AR8-route-policy]q
[AR8]bgp 64513
[AR8-bgp]im	
[AR8-bgp]import-route di	
[AR8-bgp]import-route direct r	
[AR8-bgp]import-route direct route-policy hcip
[AR8-bgp]q
[AR8]q
<AR8>dis bgp rou	
<AR8>dis bgp routing-table 
 BGP Local router ID is 10.0.3.3 
 Status codes: * - valid, > - best, d - damped,
               h - history,  i - internal, s - suppressed, S - Stale
               Origin : i - IGP, e - EGP, ? - incomplete
 Total Number of Routes: 4
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn
 *>   172.16.0.0         10.0.23.2                             0      64512 6451
1?
 *>   172.17.0.0/22      10.0.23.2                             0      64512?
 *>   172.17.1.0/24      0.0.0.0         0                     0      ?
 *>   172.17.2.0/24      0.0.0.0         0                     0      ?
<AR8>dis bgp routing-table
 BGP Local router ID is 10.0.3.3 
 Status codes: * - valid, > - best, d - damped,
               h - history,  i - internal, s - suppressed, S - Stale
               Origin : i - IGP, e - EGP, ? - incomplete
 Total Number of Routes: 3
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn
 *>   172.16.0.0         10.0.23.2                             0      64512 6451
1?
 *>   172.17.1.0/24      0.0.0.0         0                     0      ?
 *>   172.17.2.0/24      0.0.0.0         0                     0      ?
<AR8>
  Please check whether system data has been changed, and save data in time
  Configuration console time out, please press any key to log on
<AR8>save
  The current configuration will be written to the device. 
  Are you sure to continue? (y/n)[n]:y
  It will take several minutes to save configuration file, please wait.......
  Configuration file had been saved successfully
  Note: The configuration file will take effect after being activated

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值