本文共 4249 字,大约阅读时间需要 14 分钟。
二:设置SW2(vlan),设置虚拟IP并设置优先级
[sw2]vlan batch 10 20 30 40 100 200[sw2]int g0/0/12[sw2-GigabitEthernet0/0/12]port link-type trunk [sw2-GigabitEthernet0/0/12]port trunk allow-pass vlan all[sw2]int Vlanif 10[sw2-Vlanif10]ip address 192.168.10.252 24[sw2-Vlanif10]int Vlanif 20[sw2-Vlanif20]ip address 192.168.20.252 24[sw2-Vlanif20]int Vlanif 30[sw2-Vlanif30]ip address 192.168.30.252 24[sw2-Vlanif30]int Vlanif 40[sw2-Vlanif40]ip address 192.168.40.252 24[sw2]int g0/0/1[sw2-GigabitEthernet0/0/1]port link-type access [sw2-GigabitEthernet0/0/1]port default vlan 100[sw2]int Vlanif 100[sw2-Vlanif100]ip address 192.168.100.1 24三:设置SW2路由表条目[sw2]ip route-static 192.168.50.0 24 192.168.100.2三:设置SW2虚拟IP并设置优先级(默认100选大于100的)[sw2]int Vlanif 10[sw2-Vlanif10]vrrp vrid 10 virtual-ip 192.168.10.254[sw2-Vlanif10]int Vlanif 20[sw2-Vlanif20]vrrp vrid 20 virtual-ip 192.168.20.254[sw2]int Vlanif 30[sw2-Vlanif30]vrrp vrid 30 virtual-ip 192.168.30.254[sw2-Vlanif30]int Vlanif 40[sw2-Vlanif40]vrrp vrid 40 virtual-ip 192.168.40.254[sw2]int Vlanif 10[sw2-Vlanif10]vrrp vrid 10 priority 200[sw2-Vlanif10]int Vlanif 30[sw2-Vlanif30]vrrp vrid 30 priority 200[sw2]int Vlanif 10
[sw2-Vlanif10]vrrp vrid 10track interface g0/0/1 reduced 150[sw2]int Vlanif 30[sw2-Vlanif30]vrrp vrid 30 track interface g0/0/1 reduced 150四:设置SW3(vlan),设置虚拟IP并设置优先级[sw3]vlan batch 10 20 30 40 100 200[sw3]int g0/0/13[sw3-GigabitEthernet0/0/13]port link-type trunk [sw3-GigabitEthernet0/0/13]port trunk allow-pass vlan all[sw3]int Vlanif 10[sw3-Vlanif10]ip address 192.168.10.253 24[sw3-Vlanif10]int Vlanif 20[sw3-Vlanif20]ip address 192.168.20.253 24[sw3-Vlanif20]int Vlanif 30[sw3-Vlanif30]ip address 192.168.30.253 24[sw3-Vlanif30]int Vlanif 40[sw3-Vlanif40]ip address 192.168.40.253 24[sw3]int g0/0/1[sw3-GigabitEthernet0/0/1]port link-type access [sw3-GigabitEthernet0/0/1]port default vlan 200[sw3]int Vlanif 200[sw3-Vlanif200]ip address 192.168.200.1 24五.SW3上设置路由表[sw3]ip route-static 192.168.50.0 24 192.168.200.2[sw3]int Vlanif 10
[sw3-Vlanif10]vrrp vrid 10 virtual-ip 192.168.10.254[sw3-Vlanif10]int Vlanif 20[sw3-Vlanif20]vrrp vrid 20 virtual-ip 192.168.20.254[sw3]int Vlanif 30[sw3-Vlanif30]vrrp vrid 30 virtual-ip 192.168.30.254[sw3-Vlanif30]int Vlanif 40[sw3-Vlanif40]vrrp vrid 40 virtual-ip 192.168.40.254[sw3]int Vlanif 20[sw3-Vlanif20]vrrp vrid 20 priority 200[sw3-Vlanif20]int Vlanif 40[sw3-Vlanif40]vrrp vrid 40 priority 200[sw3]int Vlanif 20[sw3-Vlanif20]vrrp vrid 20 track interface g0/0/1 reduced 150[sw3]int Vlanif 40[sw3-Vlanif40]vrrp vrid 40 track interface g0/0/1 reduced 150设置路由器
[r1]int g0/0/0[r1-GigabitEthernet0/0/0]ip address 192.168.100.2 24[r1-GigabitEthernet0/0/0]int g0/0/1[r1-GigabitEthernet0/0/1]ip address 192.168.200.2 24[r1-GigabitEthernet0/0/1]int g2/0/0[r1-GigabitEthernet2/0/0]ip address 192.168.50.1 24[r1]ip route-static 192.168.10.0 24 192.168.100.1[r1]ip route-static 192.168.30.0 24 192.168.100.1[r1]ip route-static 192.168.20.0 24 192.168.200.1[r1]ip route-static 192.168.40.0 24 192.168.200.1[r1]ip route-static 192.168.10.0 24 192.168.200.1 preference 80[r1]ip route-static 192.168.30.0 24 192.168.200.1 preference 80[r1]ip route-static 192.168.20.0 24 192.168.100.1 preference 80[r1]ip route-static 192.168.40.0 24 192.168.100.1 preference 80验证转载于:https://blog.51cto.com/14159400/2344786