S1720, S2700, S5700, S6720 V200R011C10 配置指南-IP单播路由
本文档介绍了设备支持的IP单播路由相关配置。主要内容包括IP路由概述,静态路由、RIP、RIPng、OSPF、OSPFv3、IS-IS(IPv4)、IS-IS(IPv6)、BGP、路由策略以及策略路由的基本原理和配置过程,并提供相关的配置案例。
配置BGP负载分担示例
组网需求
如图10-53所示,所有交换机都配置BGP,SwitchA在AS100中,SwitchB和SwitchC在AS300中,SwitchD在AS200中。要求减少SwitchA到目的地址10.1.1.0/24网络拥塞,充分利用网络资源。
请确保该场景下互联接口的STP处于未使能状态。因为在使能STP的环形网络中,如果用交换机的VLANIF接口构建三层网络,会导致某个端口被阻塞,从而导致三层业务不能正常运行。
配置思路
采用如下的思路配置BGP负载分担:
在SwitchA和SwitchB、SwitchA和SwitchC、SwitchD和SwitchB、SwitchD和SwitchC之间配置EBGP连接,实现AS之间使用BGP协议相互通信。
在SwitchA上配置负载分担功能,使从SwitchA发送的流量可以经过SwitchB和SwitchC两条路径到达SwitchD,实现对网络资源的充分利用。
操作步骤
- 配置各接口所属VLAN
# 配置SwitchA。SwitchB、SwitchC和SwitchD的配置与SwitchA类似。
<HUAWEI> system-view [HUAWEI] sysname SwitchA [SwitchA] vlan batch 10 20 [SwitchA] interface gigabitethernet 0/0/1 [SwitchA-GigabitEthernet0/0/1] port link-type trunk [SwitchA-GigabitEthernet0/0/1] port trunk allow-pass vlan 10 [SwitchA-GigabitEthernet0/0/1] quit [SwitchA] interface gigabitethernet 0/0/2 [SwitchA-GigabitEthernet0/0/2] port link-type trunk [SwitchA-GigabitEthernet0/0/2] port trunk allow-pass vlan 20 [SwitchA-GigabitEthernet0/0/2] quit
- 配置各VLANIF接口的IP地址
# 配置SwitchA。SwitchB、SwitchC和SwitchD的配置与SwitchA类似。
[SwitchA] interface vlanif 10 [SwitchA-Vlanif10] ip address 192.168.1.1 24 [SwitchA-Vlanif10] quit [SwitchA] interface vlanif 20 [SwitchA-Vlanif20] ip address 192.168.2.1 24 [SwitchA-Vlanif20] quit
- 配置BGP连接
# 配置SwitchA。
[SwitchA] bgp 100 [SwitchA-bgp] router-id 172.16.1.1 [SwitchA-bgp] peer 192.168.1.2 as-number 300 [SwitchA-bgp] peer 192.168.2.2 as-number 300 [SwitchA-bgp] quit
# 配置SwitchB。
[SwitchB] bgp 300 [SwitchB-bgp] router-id 172.16.2.2 [SwitchB-bgp] peer 192.168.1.1 as-number 100 [SwitchB-bgp] peer 192.168.3.1 as-number 200 [SwitchB-bgp] quit
# 配置SwitchC。
[SwitchC] bgp 300 [SwitchC-bgp] router-id 172.16.3.3 [SwitchC-bgp] peer 192.168.2.1 as-number 100 [SwitchC-bgp] peer 192.168.4.1 as-number 200 [SwitchC-bgp] quit
# 配置SwitchD。
[SwitchD] bgp 200 [SwitchD-bgp] router-id 172.16.4.4 [SwitchD-bgp] peer 192.168.3.2 as-number 300 [SwitchD-bgp] peer 192.168.4.2 as-number 300 [SwitchD-bgp] ipv4-family unicast [SwitchD-bgp-af-ipv4] network 10.1.1.0 255.255.255.0 [SwitchD-bgp-af-ipv4] quit [SwitchD-bgp] quit
# 查看SwitchA的路由表。
[SwitchA] display bgp routing-table 10.1.1.0 24 BGP local router ID : 172.16.1.1 Local AS number : 100 Paths: 2 available, 1 best, 1 select BGP routing table entry information of 10.1.1.0/24: From: 192.168.1.2 (172.16.2.2) Route Duration: 0d00h00m50s Direct Out-interface: Vlanif10 Original nexthop: 192.168.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: 192.168.2.2 192.168.1.2 BGP routing table entry information of 10.1.1.0/24: From: 192.168.2.2 (172.16.3.3) Route Duration: 0d00h00m51s Direct Out-interface: Vlanif20 Original nexthop: 192.168.2.2 Qos information : 0x0 AS-path 300 200, origin igp, pref-val 0, valid, external, pre 255, not preferred for router ID Not advertised to any peer yet
从路由表中可以看出,SwitchA到目的地址10.1.1.0/24有两条有效路由,其中下一跳为192.168.1.2的路由是最优路由(因为SwitchB的Router ID要小一些)。
- 配置负载分担
# 在SwitchA上配置负载分担。
[SwitchA] bgp 100 [SwitchA-bgp] ipv4-family unicast [SwitchA-bgp-af-ipv4] maximum load-balancing 2 [SwitchA-bgp-af-ipv4] quit [SwitchA-bgp] quit
- 检查配置结果
# 查看SwitchA的路由表。
[SwitchA] display bgp routing-table 10.1.1.0 24 BGP local router ID : 172.16.1.1 Local AS number : 100 Paths: 2 available, 1 best, 2 select BGP routing table entry information of 10.1.1.0/24: From: 192.168.1.2 (172.16.2.2) Route Duration: 0d00h03m55s Direct Out-interface: Vlanif10 Original nexthop: 192.168.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: 192.168.2.2 192.168.1.2 BGP routing table entry information of 10.1.1.0/24: From: 192.168.2.2 (172.16.3.3) Route Duration: 0d00h03m56s Direct Out-interface: Vlanif20 Original nexthop: 192.168.2.2 Qos information : 0x0 AS-path 300 200, origin igp, pref-val 0, valid, external, select, active, pre 255, not preferred for router ID Not advertised to any peer yet
从路由表中可以看到,BGP路由10.1.1.0/24存在两个下一跳,分别是192.168.1.2和192.168.2.2,且都被优选。
配置文件
SwitchA的配置文件
# sysname SwitchA # vlan batch 10 20 # interface Vlanif10 ip address 192.168.1.1 255.255.255.0 # interface Vlanif20 ip address 192.168.2.1 255.255.255.0 # interface GigabitEthernet0/0/1 port link-type trunk port trunk allow-pass vlan 10 # interface GigabitEthernet0/0/2 port link-type trunk port trunk allow-pass vlan 20 # bgp 100 router-id 172.16.1.1 peer 192.168.1.2 as-number 300 peer 192.168.2.2 as-number 300 # ipv4-family unicast undo synchronization maximum load-balancing 2 peer 192.168.1.2 enable peer 192.168.2.2 enable # return
SwitchB的配置文件
# sysname SwitchB # vlan batch 10 30 # interface Vlanif10 ip address 192.168.1.2 255.255.255.0 # interface Vlanif30 ip address 192.168.3.2 255.255.255.0 # interface GigabitEthernet0/0/1 port link-type trunk port trunk allow-pass vlan 10 # interface GigabitEthernet0/0/2 port link-type trunk port trunk allow-pass vlan 30 # bgp 300 router-id 172.16.2.2 peer 192.168.1.1 as-number 100 peer 192.168.3.1 as-number 200 # ipv4-family unicast undo synchronization peer 192.168.1.1 enable peer 192.168.3.1 enable # return
SwitchC的配置文件
# sysname SwitchC # vlan batch 20 40 # interface Vlanif20 ip address 192.168.2.2 255.255.255.0 # interface Vlanif40 ip address 192.168.4.2 255.255.255.0 # interface GigabitEthernet0/0/1 port link-type trunk port trunk allow-pass vlan 40 # interface GigabitEthernet0/0/2 port link-type trunk port trunk allow-pass vlan 20 # bgp 300 router-id 172.16.3.3 peer 192.168.2.1 as-number 100 peer 192.168.4.1 as-number 200 # ipv4-family unicast undo synchronization peer 192.168.2.1 enable peer 192.168.4.1 enable # return
SwitchD的配置文件
# sysname SwitchD # vlan batch 30 40 50 # interface Vlanif30 ip address 192.168.3.1 255.255.255.0 # interface Vlanif40 ip address 192.168.4.1 255.255.255.0 # interface Vlanif50 ip address 10.1.1.1 255.255.255.0 # interface GigabitEthernet0/0/1 port link-type trunk port trunk allow-pass vlan 40 # interface GigabitEthernet0/0/2 port link-type trunk port trunk allow-pass vlan 30 # interface GigabitEthernet0/0/3 port link-type trunk port trunk allow-pass vlan 50 # bgp 200 router-id 172.16.4.4 peer 192.168.3.2 as-number 300 peer 192.168.4.2 as-number 300 # ipv4-family unicast undo synchronization network 10.1.1.0 255.255.255.0 peer 192.168.3.2 enable peer 192.168.4.2 enable # return