1、如图所示,所有路由器都配置BGP,RouterA在AS100中,RouterB和RouterC在AS300中,RouterD在AS200中。要求减少充分利用网络资源RouterA到目的地址8.1.1.0/24网络拥塞,充分利用网络资源。
2、网络拓扑
3、配置思路
采用如下的思路配置BGP负载分担:
在RouterA和RouterB、RouterA和RouterC、RouterD和RouterB、RouterD和RouterC之间配置EBGP连接,实现AS之间使用BGP协议相互通信。
在RouterA上配置负载分担功能,使从RouterA发送的流量可以经过RouterB和RouterC两条路径到达RouterD,实现对网络资源的充分利用。
1、配置各接口的IP地址
system-view
[Huawei]sysname RouterA
[RouterA]interface GigabitEthernet 0/0/1
[RouterA-GigabitEthernet0/0/1]ip address 200.1.1.1 24
[RouterA-GigabitEthernet0/0/1]q
[RouterA-GigabitEthernet0/0/2]ip address 200.1.2.1 24
[RouterA-GigabitEthernet0/0/2]q
system-view
[Huawei]sysname RouterB
[RouterB]interface GigabitEthernet 0/0/1
[RouterB-GigabitEthernet0/0/1]ip address 200.1.1.2 24
[RouterB-GigabitEthernet0/0/1]q
[RouterB]interface GigabitEthernet 0/0/2
[RouterB-GigabitEthernet0/0/2]ip address 200.1.3.2 24
[RouterB-GigabitEthernet0/0/2]q
system-view
[Huawei]sysname RouterC
[RouterC]interface GigabitEthernet 0/0/2
[RouterC-GigabitEthernet0/0/2]ip address 200.1.2.2 24
[RouterC-GigabitEthernet0/0/2]q
[RouterC]interface GigabitEthernet 0/0/1
[RouterC-GigabitEthernet0/0/1]ip address 200.1.4.2 24
[RouterC-GigabitEthernet0/0/1]q
system-view
[Huawei]sysname RouterD
[RouterD]interface GigabitEthernet 0/0/2
[RouterD-GigabitEthernet0/0/2]ip address 200.1.3.1 24
[RouterD-GigabitEthernet0/0/2]q
[RouterD]interface GigabitEthernet 0/0/1
[RouterD-GigabitEthernet0/0/1]ip address 200.1.4.1 24
[RouterD-GigabitEthernet0/0/1]q
[RouterD]interface GigabitEthernet 0/0/0
[RouterD-GigabitEthernet0/0/0]ip address 8.1.1.1 24
[RouterD-GigabitEthernet0/0/0]q
2、配置BGP连接
[RouterA]bgp 100
[RouterA-bgp]router-id 1.1.1.1
[RouterA-bgp]peer 200.1.1.2 as-number 300
[RouterA-bgp]peer 200.1.2.2 as-number 300
[RouterA-bgp]q
[RouterB]bgp 300
[RouterB-bgp]router-id 2.2.2.2
[RouterB-bgp]peer 200.1.1.1 as-number 100
[RouterB-bgp]peer 200.1.3.1 as-number 200
[RouterB-bgp]q
[RouterC]bgp 300
[RouterC-bgp]router-id 3.3.3.3
[RouterC-bgp]peer 200.1.2.1 as-number 100
[RouterC-bgp]peer 200.1.4.1 as-number 200
[RouterC-bgp]q
[RouterD]bgp 200
[RouterD-bgp]router-id 4.4.4.4
[RouterD-bgp]peer 200.1.3.2 as-number 300
[RouterD-bgp]peer 200.1.4.2 as-number 300
[RouterD-bgp]ipv4-family unicast
[RouterD-bgp-af-ipv4]network 8.1.1.0 24
[RouterD-bgp-af-ipv4]q
[RouterD-bgp]q
3、查看RouterA的路由表,从路由表中可以看出,RouterA到目的地址8.1.1.0/24有两条有效路由,其中下一跳为200.1.1.2的路由是最优路由(因为RouterB的Router ID要小一些)。
[RouterA]display bgp routing-table 8.1.1.0 24
BGP local router ID : 1.1.1.1
Local AS number : 100
Paths: 2 available, 1 best, 1 select
BGP routing table entry information of 8.1.1.0/24:
From: 200.1.1.2 (2.2.2.2)
Route Duration: 00h00m33s
Direct Out-interface: GigabitEthernet0/0/1
Original nexthop: 200.1.1.2
Qos information : 0x0
AS-path 300 200, origin igp, pref-val 0, valid, external, best, select, active,
pre 255
Advertised to such 2 peers:
200.1.1.2
200.1.2.2
BGP routing table entry information of 8.1.1.0/24:
From: 200.1.2.2 (3.3.3.3)
Route Duration: 00h00m26s
Direct Out-interface: GigabitEthernet0/0/2
Original nexthop: 200.1.2.2
Qos information : 0x0
AS-path 300 200, origin igp, pref-val 0, valid, external, pre 255, not preferre
d for router ID
Not advertised to any peer yet
4、在RouterA上配置负载分担为两条,maximum load-balancing命令用来设置形成负载分担的等价路由的最大条数
[RouterA]bgp 100
[RouterA-bgp]ipv4-family unicast
[RouterA-bgp-af-ipv4]maximum load-balancing 2
[RouterA-bgp-af-ipv4]q
[RouterA-bgp]q
5、查看RouterA的路由表进行验证,从路由表中可以看到,BGP路由8.1.1.0/24存在两个下一跳,分别是200.1.1.2和200.1.2.2,且都被优选。
RouterA]display bgp routing-table 8.1.1.0 24
BGP local router ID : 1.1.1.1
Local AS number : 100
Paths: 2 available, 1 best, 2 select
BGP routing table entry information of 8.1.1.0/24:
From: 200.1.1.2 (2.2.2.2)
Route Duration: 00h02m06s
Direct Out-interface: GigabitEthernet0/0/1
Original nexthop: 200.1.1.2
Qos information : 0x0
AS-path 300 200, origin igp, pref-val 0, valid, external, best, select, active,
pre 255
Advertised to such 2 peers:
200.1.1.2
200.1.2.2
BGP routing table entry information of 8.1.1.0/24:
From: 200.1.2.2 (3.3.3.3)
Route Duration: 00h01m59s
Direct Out-interface: GigabitEthernet0/0/2
Original nexthop: 200.1.2.2
Qos information : 0x0
AS-path 300 200, origin igp, pref-val 0, valid, external, select, active, pre 2
55, not preferred for router ID
Not advertised to any peer yet