------------------------------------------------------------------
ISP1、ISP2、NET配置OSPF进行模拟
[NET]int GigabitEthernet 0/0/0
[NET-GigabitEthernet0/0/0]ip add 100.1.1.2 24
[NET-GigabitEthernet0/0/0]quit
[NET]int GigabitEthernet 0/0/1
[NET-GigabitEthernet0/0/1]ip add 200.1.1.2 24
[NET-GigabitEthernet0/0/1]quit
[NET]int lo0
[NET-LoopBack0]ip add 8.8.8.8 24
[NET-LoopBack0]quit
[NET]ospf 1 router-id 3.3.3.3
[NET-ospf-1]area 0
[NET-ospf-1-area-0.0.0.0]network 100.1.1.0 0.0.0.255
[NET-ospf-1-area-0.0.0.0]network 200.1.1.0 0.0.0.255
[NET-ospf-1-area-0.0.0.0]quit
[NET-ospf-1]import-route direct type 1
[NET-ospf-1]quit
[ISP1]int GigabitEthernet 0/0/1
[ISP1-GigabitEthernet0/0/1]ip add 100.1.1.1 24
[ISP1-GigabitEthernet0/0/1]quit
[ISP1]int GigabitEthernet 0/0/0
[ISP1-GigabitEthernet0/0/0]ip add 10.1.1.1 24
[ISP1-GigabitEthernet0/0/0]quit
[ISP1]ospf 1 router-id 1.1.1.1
[ISP1-ospf-1]area 0
[ISP1-ospf-1-area-0.0.0.0]network 100.1.1.0 0.0.0.255
[ISP1-ospf-1-area-0.0.0.0]quit
[ISP1-ospf-1]import-route direct type 1
[ISP1-ospf-1]quit
[ISP2]int GigabitEthernet 0/0/1
[ISP2-GigabitEthernet0/0/1]ip add 200.1.1.1 24
[ISP2-GigabitEthernet0/0/1]quit
[ISP2]int GigabitEthernet 0/0/0
[ISP2-GigabitEthernet0/0/0]ip add 20.1.1.1 24
[ISP2-GigabitEthernet0/0/0]quit
[ISP2]ospf 1 router-id 2.2.2.2
[ISP2-ospf-1-area-0.0.0.0]network 200.1.1.0 0.0.0.255
[ISP2-ospf-1-area-0.0.0.0]quit
[ISP2-ospf-1]import-route direct type 1
[ISP2-ospf-1]quit
--------------------------------------------------------------------
配置交换机
[SW]vlan batch 10 20 100
[SW]int vlan 10
[SW-Vlanif10]ip add 192.168.1.254 24
[SW-Vlanif10]quit
[SW]int vlan 20
[SW-Vlanif20]ip add 192.168.2.254 24
[SW-Vlanif20]quit
[SW]int vlan 100
[SW-Vlanif100]ip add 1.1.1.3 24
[SW-Vlanif100]quit
[SW]port-group 1
[SW-port-group-1]group-member Ethernet 0/0/1 to Ethernet 0/0/2
[SW-Ethernet0/0/1]port link-type access
[SW-Ethernet0/0/2]port default vlan 100
[SW-port-group-1]quit
[SW]int Ethernet0/0/10
[SW-Ethernet0/0/10]port link-type access
[SW-Ethernet0/0/10]port default vlan 10
[SW-Ethernet0/0/10]quit
[SW]int Ethernet0/0/20
[SW-Ethernet0/0/20]port link-type access
[SW-Ethernet0/0/20]port default vlan 20
[SW-Ethernet0/0/20]quit
[SW]ip route-static 0.0.0.0 0.0.0.0 1.1.1.10 //交换机默认路由的下一跳地址为virtual-ip的地址
--------------------------------------------------
GW1和GW2配置接口地址、路由、NAT
[GW1]int GigabitEthernet 0/0/0
[GW1-GigabitEthernet0/0/0]ip add 10.1.1.2 24
[GW1-GigabitEthernet0/0/0]quit
[GW1]int GigabitEthernet 0/0/1
[GW1-GigabitEthernet0/0/1]ip add 1.1.1.1 24
[GW1-GigabitEthernet0/0/1]quit
[GW1]ip route-static 0.0.0.0 0.0.0.0 10.1.1.1
[GW1]ip route-static 192.168.0.0 255.255.0.0 1.1.1.3
[GW1]acl 2000
[GW1-acl-basic-2000]rule permit source any
[GW1-acl-basic-2000]quit
[GW1]int g0/0/0
[GW1-GigabitEthernet0/0/0]nat outbound 2000
[GW1-GigabitEthernet0/0/0]quit
--------
[GW2]int GigabitEthernet 0/0/0
[GW2-GigabitEthernet0/0/0]ip add 20.1.1.2 24
[GW2-GigabitEthernet0/0/0]quit
[GW2]int GigabitEthernet 0/0/1
[GW2-GigabitEthernet0/0/1]ip add 1.1.1.2 24
[GW2-GigabitEthernet0/0/1]quit
[GW2]ip route-static 0.0.0.0 0.0.0.0 20.1.1.1
[GW2]ip route-static 192.168.0.0 255.255.0.0 1.1.1.3
[GW2]acl 2000
[GW2-acl-basic-2000]rule permit source any
[GW2-acl-basic-2000]quit
[GW2]int g0/0/0
[GW2-GigabitEthernet0/0/0]nat outbound 2000
[GW2-GigabitEthernet0/0/0]quit
----------------------------------------------------------------------------
GW1和GW2配置VRRP
[GW1]int GigabitEthernet 0/0/1
[GW1-GigabitEthernet0/0/1]vrrp vrid 1 virtual-ip 1.1.1.10 //启用VRRP组和地址
[GW1-GigabitEthernet0/0/1]vrrp vrid 1 priority 120 //配置优先级,优先级大的选为Master
[GW1-GigabitEthernet0/0/1]vrrp vrid 1 track interface GigabitEthernet 0/0/0 reduced 50 //配置追踪接口
[GW1-GigabitEthernet0/0/1]quit
[GW2]int GigabitEthernet 0/0/1
[GW2-GigabitEthernet0/0/1]vrrp vrid 1 virtual-ip 1.1.1.10
[GW2-GigabitEthernet0/0/1]quit
注:华为VRRP的抢占默认是开启的
---------------------------------------------------------------------------------------
查看验证
[GW1]dis vrrp brief //查看VRRP状态
链路正常的情况下GW1为master
当GW1设备出现问题:G0/0/0 G0/0/1或者GW1整机down的时候,GW2为master