本文主要是介绍华为设备配置BGP负载分担,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
- 配置各接口所属VLAN
[LSW1]vlan batch 10 20
[LSW1-GigabitEthernet0/0/2]port link-type trunk
[LSW1-GigabitEthernet0/0/2]port trunk allow-pass vlan 10
[LSW1-GigabitEthernet0/0/3]port link-type trunk
[LSW1-GigabitEthernet0/0/3]port trunk allow-pass vlan 20
[LSW2]vlan batch 10 30
[LSW2-GigabitEthernet0/0/1]port link-type trunk
[LSW2-GigabitEthernet0/0/1]port trunk allow-pass vlan 10
[LSW2-GigabitEthernet0/0/4]port link-type trunk
[LSW2-GigabitEthernet0/0/4]port trunk allow-pass vlan 30
[LSW3]vlan batch 20 40
[LSW3-GigabitEthernet0/0/1]port link-type trunk
[LSW3-GigabitEthernet0/0/1]port trunk allow-pass vlan 20
[LSW3-GigabitEthernet0/0/4]port link-type trunk
[LSW3-GigabitEthernet0/0/4]port trunk allow-pass vlan 40
[LSW4]vlan batch 30 40 50
[LSW4-GigabitEthernet0/0/2]port link-type trunk
[LSW4-GigabitEthernet0/0/2]port trunk allow-pass vlan 30
[LSW4-GigabitEthernet0/0/3]port link-type trunk
[LSW4-GigabitEthernet0/0/3]port trunk allow-pass vlan 40
[LSW4-GigabitEthernet0/0/5]port link-type trunk
[LSW4-GigabitEthernet0/0/5]port trunk allow-pass vlan 50 - 配置各VLANIF接口的IP地址
[LSW1-Vlanif10]ip add 10.1.1.1 24
[LSW1-Vlanif20]ip add 10.1.2.1 24
[LSW2-Vlanif10]ip add 10.1.1.2 24
[LSW2-Vlanif30]ip add 10.1.3.2 24
[LSW3-Vlanif20]ip add 10.1.2.3 24
[LSW3-Vlanif40]ip add 10.1.4.3 24
[LSW4-Vlanif30]ip add 10.1.3.4 24
[LSW4-Vlanif40]ip add 10.1.4.4 24
[LSW4-Vlanif50]ip add 192.168.1.4 24
[LSW1]stp disable
[LSW2]stp disable
[LSW3]stp disable
[LSW4]stp disable - 配置BGP连接
[LSW1]bgp 100
[LSW1-bgp]router-id 1.1.1.1
[LSW1-bgp]peer 10.1.1.2 as-number 300
[LSW1-bgp]peer 10.1.2.3 as-number 300
[LSW2]bgp 300
[LSW2-bgp]router-id 2.2.2.2
[LSW2-bgp]peer 10.1.1.1 as-number 100
[LSW2-bgp]peer 10.1.3.4 as-number 200
[LSW3]bgp 300
[LSW3-bgp]router-id 3.3.3.3
[LSW3-bgp]peer 10.1.2.1 as-number 100
[LSW3-bgp]peer 10.1.4.4 as-number 200
[LSW4]bgp 200
[LSW4-bgp]router-id 4.4.4.4
[LSW4-bgp]peer 10.1.3.2 as-number 300
[LSW4-bgp]peer 10.1.4.3 as-number 300
[LSW4-bgp]ipv4-family unicast
[LSW4-bgp-af-ipv4]network 192.168.1.0 24
从路由表中可以看出,LSW1到目的地址192.168.1.0/24有两条有效路由,其中下一跳为10.1.1.2的路由是最优路由(因为LSW2的Router ID要小一些)
4. 配置负载分担
[LSW1]bgp 100
[LSW1-bgp]ipv4-family unicast
[LSW1-bgp-af-ipv4]maximum load-balancing 2
5. 检查配置结果
从路由表中可以看到,BGP路由192.168.1.0/24存在两个下一跳,分别是10.1.1.2和10.1.2.3,且都被优选
这篇关于华为设备配置BGP负载分担的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!