实验要求:在汇聚交换机上SW1和SW2中实施VRRP以保证终端网关的高可靠性(当某一个网关设备失效时,其他网关设备依旧可以实现业务数据的转发。)
1.在SW1和SW2之间配置链路聚合,以提高带宽速度。
2.PC1 访问远端网络8.8.8.8 ,优先走SW1。
3.PC2、PC3访问远端网络8.8.8.8,优先走SW2。
配置步骤:
1.先完成VLAN的基础配置
2.完成VLANIF的配置
3.配置一致的VRRP虚拟IP地址
4.配置优先级管理Master设备
配置R1基础配置:
[Huawei]sysname R1
[R1]undo in en
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]
[R1-GigabitEthernet0/0/1]ip add 10.1.11.1 29
[R1-GigabitEthernet0/0/1]int g0/0/2
[R1-GigabitEthernet0/0/2]ip add 10.1.12.1 29
[R1-GigabitEthernet0/0/2]quit
[R1]int lo0
[R1-LoopBack0]ip add 8.8.8.8 32
[R1-LoopBack0]
[R1-LoopBack0]quit
配置SW1基础配置:
[Huawei]sysname SW1
[SW1]undo info-center en
Info: Information center is disabled.
[SW1]vlan batch 8 9 10 11
[SW1]int vlanif11
[SW1-Vlanif11]ip add 10.1.11.2 29
[SW1-Vlanif11]qui
[SW1]int g0/0/1
[SW1-GigabitEthernet0/0/1]port link-type access
[SW1-GigabitEthernet0/0/1]port default vlan 11
[SW1-GigabitEthernet0/0/1]quit
配置SW2基础配置:
[Huawei]sysname SW2
[SW2]undo info-center en
[SW2]vlan batch 8 9 10 12
[SW2]int vlanif12
[SW2-Vlanif12]ip add 10.1.12.2 29
[SW2-Vlanif12]quit
[SW2]int g0/0/2
[SW2-GigabitEthernet0/0/2]port link-type access
[SW2-GigabitEthernet0/0/2]port default vlan 12
[SW2-GigabitEthernet0/0/2]quit
[SW2]int vlanif 8
[SW2-Vlanif8]ip add 10.1.10.12 28
[SW2-Vlanif8]
配置SW3基础配置
[SW3]vlan batch 8 9 10 11 12
[SW3]interface GigabitEthernet0/0/3
[SW3-GigabitEthernet0/0/1] port link-type trunk
[SW3-GigabitEthernet0/0/1] port trunk allow-pass vlan 2 to 4094
[SW3]interface GigabitEthernet0/0/1
[SW3-GigabitEthernet0/0/1] port link-type trunk
[SW3-GigabitEthernet0/0/1] port trunk allow-pass vlan 2 to 4094
[SW3]int g0/0/10
[SW3-GigabitEthernet0/0/10]port lin acc
[SW3-GigabitEthernet0/0/10]port def vlan 8
[SW3-GigabitEthernet0/0/10]quit
[SW3]int g0/0/11
[SW3-GigabitEthernet0/0/11]port link acc
[SW3-GigabitEthernet0/0/11]port def vlan 9
[SW3-GigabitEthernet0/0/11]int g0/0/12
[SW3-GigabitEthernet0/0/12]port link acc
[SW3-GigabitEthernet0/0/12]port def vlan 10
[SW3-GigabitEthernet0/0/12]quit
配置SW1和SW2之间链路聚合:
[SW1]int Eth-Trunk 1
[SW1-Eth-Trunk1]trunkport g 0/0/5 to 0/0/6
[SW1-Eth-Trunk1]port link-type trunk
[SW1-Eth-Trunk1]port trunk vlan all
[SW2]int Eth-Trunk 1
[SW2-Eth-Trunk1]port link-type trunk
[SW2-Eth-Trunk1]port trunk allow-pass vlan all
[SW2-Eth-Trunk1]quit
[SW2]dis eth-trunk 1
Eth-Trunk1's state information is:
WorkingMode: NORMAL Hash arithmetic: According to SIP-XOR-DIP
Least Active-linknumber: 1 Max Bandwidth-affected-linknumber: 8
Operate status: up Number Of Up Port In Trunk: 2
--------------------------------------------------------------------------------
PortName Status Weight
GigabitEthernet0/0/5 Up 1
GigabitEthernet0/0/6 Up 1
配置SW1、SW2的MSTP:
[SW1]stp mode mstp
[SW1]stp region-configuration
[SW-mst-region]region-name s12
[SW1-mst-region]revision-level 1
[SW1-mst-region]instance 1 vlan 8
[SW1-mst-region]instance 2 vlan 9 10
[SW1-mst-region]active region-configuration
[SW1-mst-region]qui
[SW1]stp instance 1 root primary
[SW1]stp instance 2 root secondary
[SW2]stp mode mstp
[SW2]stp region-configuration
[SW2-mst-region]region-name s12
[SW2-mst-region]instance 1 vlan 8
[SW2-mst-region]instance 2 vlan 9 10
[SW2-mst-region]active region-configuration
[SW2-mst-region]quit
[SW2]stp instance 2 root primary
[SW2]stp instance 1 root secondary
[SW2]qui
配置SW1、SW2的VRRP:
[SW1]int vlan 8
[SW1-Vlanif8]ip add 10.1.10.13 28
[SW1-Vlanif8]vrrp vrid 8 virtual-ip 10.1.10.14
[SW1-Vlanif8]vrrp vrid 8 priority 110
[SW1]int vlan 9
[SW1-Vlanif9]ip add 10.1.10.28 28
[SW1-Vlanif9]vrrp vrid 9 virtual-ip 10.1.10.30
[SW1-Vlanif9]int vlan 10
[SW1-Vlanif10]ip add 10.1.10.45 28
[SW1-Vlanif10]vrrp vrid 10 virtual-ip 10.1.10.46
[SW1-Vlanif10]
[SW2-Vlanif8]int vlan 8
[SW2-Vlanif8]ip add 10.1.10.12 28
[SW2-Vlanif8]vrrp vrid 8 virtual-ip 10.1.10.14
[SW2-Vlanif8]quit
[SW2]int vlan 9
[SW2-Vlanif9]ip add 10.1.10.29 28
[SW2-Vlanif9]vrrp vrid 9 virtual-ip 10.1.10.30
[SW2-Vlanif9]vrrp vrid 9 priority 110
[SW2]int vlan 10
[SW2-Vlanif10]ip add 10.1.10.44 28
[SW2-Vlanif10]vrrp vrid 10 virtual-ip 10.1.10.46
[SW2-Vlanif10]vrrp vrid 10 priority 110
[SW2-Vlanif10]quit
SW1、SW2和R1之间运行ospf:
[SW2]ospf 1
[SW2-ospf-1]area 0
[SW2-ospf-1-area-0.0.0.0]net 10.1.12.0 0.0.0.7
[SW2-ospf-1-area-0.0.0.0]net 10.1.10.0 0.0.0.15
[SW2-ospf-1-area-0.0.0.0]net 10.1.10.16 0.0.0.15
[SW2-ospf-1-area-0.0.0.0]net 10.1.10.32 0.0.0.15
[SW2-ospf-1-area-0.0.0.0]quit
[SW1]ospf 1
[SW1-ospf-1]area 0
[SW1-ospf-1-area-0.0.0.0]net 10.1.11.0 0.0.0.7
[SW1-ospf-1-area-0.0.0.0]net 10.1.10.0 0.0.0.15
[SW1-ospf-1-area-0.0.0.0]net 10.1.10.16 0.0.0.15
[SW1-ospf-1-area-0.0.0.0]net 10.1.10.32 0.0.0.15
[SW1-ospf-1-area-0.0.0.0]quit
[R1]ospf 1
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]net 8.8.8.8 0.0.0.0
[R1-ospf-1-area-0.0.0.0]net 10.1.11.0 0.0.0.7
[R1-ospf-1-area-0.0.0.0]net 10.1.12.0 0.0.0.7
[R1-ospf-1-area-0.0.0.0]quit
最后配置PC1、PC2和PC3的IP地址
测试:
测试正常,PC1优先走SW1.因为SW1是VLAN 8 的主根桥,PC2优先走SW2,因为SW2是VLAN 9 的主根桥,PC3自行测试,不一一列举。
下面我们手动断开SW1的g0/0/1端口,再测试PC1能否ping通8.8.8.8
[SW1]int g0/0/1
[SW1-GigabitEthernet0/0/1]shut
[SW1-GigabitEthernet0/0/1]shutdown
[SW1-GigabitEthernet0/0/1]
测试PC1:
连通性没有问题。
直接把SW1断电测试,依旧可以ping通