[H3C]hostname SwitchA
[SwitchA]inter range g 1/0/21 to g 1/0/24
[SwitchA-if-range]port link-type trunk
[SwitchA-if-range]port trunk per vlan all
[SwitchA-if-range]quit
[SwitchA] vlan 2
[SwitchA-vlan2] quit
[SwitchA] interface vlan-interface 2
[SwitchA-Vlan-interface2] ip address 10.1.1.1 255.255.255.128
[SwitchA-Vlan-interface2] vrrp vrid 1 virtual-ip 10.1.1.100
[SwitchA-Vlan-interface2] vrrp vrid 1 priority 110
[SwitchA-Vlan-interface2] quit
[SwitchA] vlan 3
[SwitchA-vlan3] quit
[SwitchA] interface vlan-interface 3
[SwitchA-Vlan-interface3] ip address 10.1.1.130 255.255.255.128
[SwitchA-Vlan-interface3] vrrp vrid 2 virtual-ip 10.1.1.200
[SwitchA-Vlan-interface3]quit
[SwitchA]inter g 1/0/1
[SwitchA-GigabitEthernet1/0/1]port link-m r
[SwitchA-GigabitEthernet1/0/1]ip add 10.1.3.1 24
[SwitchA-GigabitEthernet1/0/1]undo shut
[SwitchA-GigabitEthernet1/0/1]quit
[SwitchA]ip route-static 0.0.0.0 0 10.1.3.2
[H3C]hostname SwitchB
[SwitchB]inter range g 1/0/21 to g 1/0/24
[SwitchB-if-range]port link-type trunk
[SwitchB-if-range]port trunk per vlan all
[SwitchB-if-range]quit
[SwitchB] vlan 2
[SwitchB-vlan2] quit
[SwitchB] interface vlan-interface 2
[SwitchB-Vlan-interface2] ip address 10.1.1.2 255.255.255.128
[SwitchB-Vlan-interface2] vrrp vrid 1 virtual-ip 10.1.1.100
[SwitchB-Vlan-interface2] quit
[SwitchB] vlan 3
[SwitchB-vlan3] quit
[SwitchB] interface vlan-interface 3
[SwitchB-Vlan-interface3] ip address 10.1.1.131 255.255.255.128
[SwitchB-Vlan-interface3] vrrp vrid 2 virtual-ip 10.1.1.200
[SwitchB-Vlan-interface3] vrrp vrid 2 priority 110
[SwitchA-Vlan-interface3]quit
[SwitchA]inter g 1/0/2
[SwitchA-GigabitEthernet1/0/2]port link-m r
[SwitchA-GigabitEthernet1/0/2]ip add 10.1.4.1 24
[SwitchA-GigabitEthernet1/0/2]undo shut
[SwitchA-GigabitEthernet1/0/2]quit
[SwitchA]ip route-static 0.0.0.0 0 10.1.4.2
[H3C]hostname SwitchC
[H3C]vlan 2
[H3C-vlan2]port g 1/0/1 to g 1/0/10
[H3C-vlan2]quit
[H3C]vlan 3
[H3C-vlan3]port g 1/0/11 to g 1/0/20
[H3C-vlan3]quit
[SwitchC]inter range g 1/0/21 to g 1/0/24
[SwitchC-if-range]port link-type trunk
[SwitchC-if-range]port trunk per vlan all
[SwitchC-if-range]quit
[H3C]hostname SwitchD
[SwitchD]inter g 1/0/1
[SwitchD-GigabitEthernet1/0/1]port link-m r
[SwitchD-GigabitEthernet1/0/1]ip add 10.1.3.2 24
[SwitchD-GigabitEthernet1/0/1]undo shut
[SwitchD-GigabitEthernet1/0/1]quit
[SwitchD]inter g 1/0/2
[SwitchD-GigabitEthernet1/0/2]port link-m r
[SwitchD-GigabitEthernet1/0/2]ip add 10.1.4.2 24
[SwitchD-GigabitEthernet1/0/2]undo shut
[SwitchD-GigabitEthernet1/0/2]quit
[SwitchD]inter g 1/0/11
[SwitchD-GigabitEthernet1/0/11]port link-m r
[SwitchD-GigabitEthernet1/0/11]ip add 10.1.2.1 24
[SwitchD-GigabitEthernet1/0/11]undo shut
[SwitchD-GigabitEthernet1/0/11]quit
[SwitchD]ip route-s 10.1.1.0 24 10.1.3.1
[SwitchD]ip route-s 10.1.1.0 24 10.1.4.1
[H3C]hostname SwitchB
[SwitchB]inter range g 1/0/21 to g 1/0/24
[SwitchB-if-range]port link-type trunk
[SwitchB-if-range]port trunk per vlan all
[SwitchB-if-range]quit
[SwitchB] vlan 2
[SwitchB-vlan2] quit
[SwitchB] interface vlan-interface 2
[SwitchB-Vlan-interface2] ip address 10.1.1.2 255.255.255.128
[SwitchB-Vlan-interface2] vrrp vrid 1 virtual-ip 10.1.1.100
[SwitchB-Vlan-interface2] quit
[SwitchB] vlan 3
[SwitchB-vlan3] quit
[SwitchB] interface vlan-interface 3
[SwitchB-Vlan-interface3] ip address 10.1.1.131 255.255.255.128
[SwitchB-Vlan-interface3] vrrp vrid 2 virtual-ip 10.1.1.200
[SwitchB-Vlan-interface3] vrrp vrid 2 priority 110
[SwitchA-Vlan-interface3]quit
[SwitchA]inter g 1/0/2
[SwitchA-GigabitEthernet1/0/2]port link-m r
[SwitchA-GigabitEthernet1/0/2]ip add 10.1.4.1 24
[SwitchA-GigabitEthernet1/0/2]undo shut
[SwitchA-GigabitEthernet1/0/2]quit
[SwitchA]ip route-static 0.0.0.0 0 10.1.4.2
最后验证:
可以通过 display vrrp verbose 命令查看配置后的结果。
显示 Switch A 上备份组的详细信息。
[SwitchA] display vrrp verbose
显示 Switch B 上备份组的详细信息。
[SwitchB] display vrrp verbose
显示信息表示在备份组1中Switch A为Master,Switch B为Backup,缺省网关为10.1.1.100/25
的主机通过 Switch A 访问 Internet;备份组 2 中 Switch A 为 Backup,Switch B 为 Master,缺省网
关为 10.1.1.200/25 的主机通过 Switch B 访问 Internet。
原文地址:https://blog.51cto.com/14216984/2412802