欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

HuaWei ❀ 配置BGP负载分担

程序员文章站 2024-03-21 09:07:58
...

配置BGP负载分担

如下图所示,四台路由器配置BGP协议,要求R1通过R2与R3共同访问R4;
HuaWei ❀ 配置BGP负载分担

配置接口IP地址:

[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip address 12.1.1.1 24
配置类似,不做阐述;

配置BGP:

[r1]bgp 1   
[r1-bgp]router-id 1.1.1.1
[r1-bgp]peer 12.1.1.2 as-number 2
[r1-bgp]peer 13.1.1.2 as-number 2

[r2]bgp 2
[r2-bgp]router-id 2.2.2.2
[r2-bgp]peer 12.1.1.1 as-number 1
[r2-bgp]peer 24.1.1.2 as-number 3

[r3]bgp 2
[r3-bgp]router-id 3.3.3.3
[r3-bgp]peer 13.1.1.1 as-number 1
[r3-bgp]peer 34.1.1.2 as-number 3

[r4]bgp 3
[r4-bgp]router-id 4.4.4.4
[r4-bgp]peer 24.1.1.1 as-number 2
[r4-bgp]peer 34.1.1.1 as-number 2

配置R4引入路由信息:

[r4-bgp]ipv4-family unicast 
[r4-bgp-af-ipv4]network 4.4.4.4 255.255.255.0

配置BGP负载分担:

[r1]bgp 1
[r1-bgp]ipv4-family unicast 
[r1-bgp-af-ipv4]maximum load-balancing ?
  INTEGER<1-8>  Specify maximum equal cost routes
  ebgp          EBGP routes as equal cost route
  ibgp          IBGP routes as equal cost route
[r1-bgp-af-ipv4]maximum load-balancing 2

查看配置结果:

[r1]display bgp routing-table 

 BGP Local router ID is 1.1.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: 2
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn
 *>   4.4.4.0/24         12.1.1.2                              0      2 3i
 *                       13.1.1.2                              0      2 3i

[r1]display ip routing-table protocol bgp 

Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : BGP
         Destinations : 1        Routes : 2        
BGP routing table status : <Active>
         Destinations : 1        Routes : 2
Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface
        4.4.4.0/24  EBGP    255  0           D   13.1.1.2        GigabitEthernet0/0/1
                    EBGP    255  0           D   12.1.1.2        GigabitEthernet0/0/0
BGP routing table status : <Inactive>
         Destinations : 0        Routes : 0

[r1]display bgp routing-table 4.4.4.4

 BGP local router ID : 1.1.1.1
 Local AS number : 1
 Paths:   2 available, 1 best, 2 select
 BGP routing table entry information of 4.4.4.0/24:
 From: 12.1.1.2 (2.2.2.2)
 Route Duration: 00h00m06s  
 Direct Out-interface: GigabitEthernet0/0/0
 Original nexthop: 12.1.1.2
 Qos information : 0x0
 AS-path 2 3, origin igp, pref-val 0, valid, external, best, select, active, pre 255
 Advertised to such 2 peers:
    12.1.1.2
    13.1.1.2
 BGP routing table entry information of 4.4.4.0/24:
 From: 13.1.1.2 (3.3.3.3)
 Route Duration: 00h00m06s  
 Direct Out-interface: GigabitEthernet0/0/1
 Original nexthop: 13.1.1.2
 Qos information : 0x0
 AS-path 2 3, origin igp, pref-val 0, valid, external, select, active, pre 255, not preferred for router ID
 Not advertised to any peer yet
相关标签: HuaWei