实验拓扑
配置Vlanif2 track 上下行接口
[HX_01]int vlanif 2
[HX_01-Vlanif2]vrrp vrid 2 track interface GigabitEthernet 0/0/3
[HX_01-Vlanif2]vrrp vrid 2 track interface GigabitEthernet 0/0/1
[HX_01-Vlanif2]display this
#
interface Vlanif2
ip address 192.168.2.253 255.255.255.0
vrrp vrid 2 virtual-ip 192.168.2.1
vrrp vrid 2 priority 105
vrrp vrid 2 track interface GigabitEthernet0/0/3
vrrp vrid 2 track interface GigabitEthernet0/0/1
#
return
[HX_01-Vlanif2]
配置核心交换机+出口路由OSPF
[HX_01]ospf router-id 1.1.1.1
[HX_01-ospf-1]ar
[HX_01-ospf-1]area 0
[HX_01-ospf-1-area-0.0.0.0]netwo
[HX_01-ospf-1-area-0.0.0.0]network 192.168.2.0 0.0.0.255
[HX_01-ospf-1-area-0.0.0.0]network 192.168.3.0 0.0.0.255
[HX_01-ospf-1-area-0.0.0.0]network 192.168.4.0 0.0.0.255
[HX_01-ospf-1-area-0.0.0.0]network 192.168.5.0 0.0.0.255
[HX_01-ospf-1-area-0.0.0.0]network 192.168.6.0 0.0.0.255
[HX_01-ospf-1-area-0.0.0.0]network 192.168.7.0 0.0.0.255
[HX_01-ospf-1-area-0.0.0.0]network 12.1.1.0 0.0.0.255
---------
[HX_02]ospf router-id 2.2.2.2
[HX_02-ospf-1]ar
[HX_02-ospf-1]area 0
[HX_02-ospf-1-area-0.0.0.0]netw
[HX_02-ospf-1-area-0.0.0.0]network 192.168.2.0 0.0.0.255
[HX_02-ospf-1-area-0.0.0.0]network 192.168.3.0 0.0.0.255
[HX_02-ospf-1-area-0.0.0.0]network 192.168.4.0 0.0.0.255
[HX_02-ospf-1-area-0.0.0.0]network 192.168.5.0 0.0.0.255
[HX_02-ospf-1-area-0.0.0.0]network 192.168.6.0 0.0.0.255
[HX_02-ospf-1-area-0.0.0.0]network 192.168.7.0 0.0.0.255
[HX_02-ospf-1-area-0.0.0.0]netwo
[HX_02-ospf-1-area-0.0.0.0]network 23.1.1.0 0.0.0.255
--------
[R1]ospf router-id 3.3.3.3
[R1-ospf-1-area-0.0.0.0]network 12.1.1.0 0.0.0.255
[R1-ospf-1-area-0.0.0.0]network 23.1.1.0 0.0.0.255
[R1-ospf-1-area-0.0.0.0]network 13.1.1.0 0.0.0.255
配置出口缺省路由(冗余配置)
[HX_01]ip route-static 0.0.0.0 0 12.1.1.2
[HX_01]ip route-static 0.0.0.0 0 23.1.1.2 preference 65
----
[HX_02]ip route-static 0.0.0.0 0 12.1.1.2 preference 65
[HX_02]ip route-static 0.0.0.0 0 23.1.1.2
修改OSPF开销,保证来回地址一致
配置前出口路由
[R1]dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 25 Routes : 31
Destination/Mask Proto Pre Cost Flags NextHop Interface
12.1.1.0/24 Direct 0 0 D 12.1.1.2 GigabitEthernet
0/0/2
12.1.1.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/2
12.1.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/2
13.1.1.0/24 Direct 0 0 D 13.1.1.1 GigabitEthernet
0/0/0
13.1.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
13.1.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
23.1.1.0/24 Direct 0 0 D 23.1.1.2 GigabitEthernet
1/0/0
23.1.1.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
1/0/0
23.1.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
1/0/0
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
192.168.2.0/24 OSPF 10 2 D 12.1.1.1 GigabitEthernet
0/0/2
OSPF 10 2 D 23.1.1.1 GigabitEthernet
1/0/0
192.168.2.1/32 OSPF 10 2 D 12.1.1.1 GigabitEthernet
0/0/2
192.168.3.0/24 OSPF 10 2 D 12.1.1.1 GigabitEthernet
0/0/2
OSPF 10 2 D 23.1.1.1 GigabitEthernet
1/0/0
192.168.3.1/32 OSPF 10 2 D 12.1.1.1 GigabitEthernet
0/0/2
192.168.4.0/24 OSPF 10 2 D 12.1.1.1 GigabitEthernet
0/0/2
OSPF 10 2 D 23.1.1.1 GigabitEthernet
1/0/0
192.168.4.1/32 OSPF 10 2 D 23.1.1.1 GigabitEthernet
1/0/0
192.168.5.0/24 OSPF 10 2 D 12.1.1.1 GigabitEthernet
0/0/2
OSPF 10 2 D 23.1.1.1 GigabitEthernet
1/0/0
192.168.5.1/32 OSPF 10 2 D 23.1.1.1 GigabitEthernet
1/0/0
192.168.6.0/24 OSPF 10 2 D 12.1.1.1 GigabitEthernet
0/0/2
OSPF 10 2 D 23.1.1.1 GigabitEthernet
1/0/0
192.168.6.1/32 OSPF 10 2 D 12.1.1.1 GigabitEthernet
0/0/2
192.168.7.0/24 OSPF 10 2 D 12.1.1.1 GigabitEthernet
0/0/2
OSPF 10 2 D 23.1.1.1 GigabitEthernet
1/0/0
192.168.7.1/32 OSPF 10 2 D 23.1.1.1 GigabitEthernet
1/0/0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
[R1]
修改vlanif 2 开销
[HX_02]int vlanif 2
[HX_02-Vlanif2]ospf cost 4
配置后出口路由
[R1]dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 25 Routes : 30
Destination/Mask Proto Pre Cost Flags NextHop Interface
12.1.1.0/24 Direct 0 0 D 12.1.1.2 GigabitEthernet
0/0/2
12.1.1.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/2
12.1.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/2
13.1.1.0/24 Direct 0 0 D 13.1.1.1 GigabitEthernet
0/0/0
13.1.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
13.1.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
23.1.1.0/24 Direct 0 0 D 23.1.1.2 GigabitEthernet
1/0/0
23.1.1.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
1/0/0
23.1.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
1/0/0
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
192.168.2.0/24 OSPF 10 2 D 12.1.1.1 GigabitEthernet
0/0/2
192.168.2.1/32 OSPF 10 2 D 12.1.1.1 GigabitEthernet
0/0/2
192.168.3.0/24 OSPF 10 2 D 12.1.1.1 GigabitEthernet
0/0/2
OSPF 10 2 D 23.1.1.1 GigabitEthernet
1/0/0
192.168.3.1/32 OSPF 10 2 D 12.1.1.1 GigabitEthernet
0/0/2
192.168.4.0/24 OSPF 10 2 D 12.1.1.1 GigabitEthernet
0/0/2
OSPF 10 2 D 23.1.1.1 GigabitEthernet
1/0/0
192.168.4.1/32 OSPF 10 2 D 23.1.1.1 GigabitEthernet
1/0/0
192.168.5.0/24 OSPF 10 2 D 12.1.1.1 GigabitEthernet
0/0/2
OSPF 10 2 D 23.1.1.1 GigabitEthernet
1/0/0
192.168.5.1/32 OSPF 10 2 D 23.1.1.1 GigabitEthernet
1/0/0
192.168.6.0/24 OSPF 10 2 D 12.1.1.1 GigabitEthernet
0/0/2
OSPF 10 2 D 23.1.1.1 GigabitEthernet
1/0/0
192.168.6.1/32 OSPF 10 2 D 12.1.1.1 GigabitEthernet
0/0/2
192.168.7.0/24 OSPF 10 2 D 12.1.1.1 GigabitEthernet
0/0/2
OSPF 10 2 D 23.1.1.1 GigabitEthernet
1/0/0
192.168.7.1/32 OSPF 10 2 D 23.1.1.1 GigabitEthernet
1/0/0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0