单区域OSPF增强配置:
使用双链路,运行OSPF,在等价路由时修改接口cost来实现哪条链路优先:
[RTA]int e0/0
[RTA-Ethernet0/0]ip add 20.0.0.1 24
[RTA-Ethernet0/0]
[RTA-Ethernet0/0]undo shutdown
[RTA-Ethernet0/0]int e0/0/1
[RTA-Ethernet0/1]ip add 10.0.0.1 24
[RTA-Ethernet0/1]undo shutdown
[RTA-Ethernet0/1]int loop1
[RTA-LoopBack1]ip add 1.1.1.1 32
[RTB]int e0/0/0
[RTB-Ethernet0/0/0]ip ad 20.0.0.2 24
[RTB-Ethernet0/0]undo shutdown
[RTB-Ethernet0/0]int e0/0/1
[RTB-Ethernet0/1]ip add 10.0.0.2 24
[RTB-Ethernet0/1]undo shutdown
[RTB-Ethernet0/1]int loop1
[RTB-LoopBack1]ip add 2.2.2.2 32
[RTA]router id 1.1.1.1
[RTA]ospf 1
[RTA-ospf-1]area 0
[RTA-ospf-1-area-0.0.0.0]network 20.0.0.0 0.0.0.255
[RTA-ospf-1-area-0.0.0.0]network 10.0.0.0 0.0.0.255
[RTA-ospf-1-area-0.0.0.0]network 1.1.1.1 0.0.0.0
[RTB]router id 2.2.2.2
[RTB]ospf 1
[RTB-ospf-1]area 0
[RTB-ospf-1-area-0.0.0.0]network 20.0.0.0 0.0.0.255
[RTB-ospf-1-area-0.0.0.0]network 10.0.0.0 0.0.0.255
[RTB-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0
此时可以看到去往RTB 2.2.2.2网络的有两条等价路由:
[RTA]disp ip routing-table
Routing Tables: Public
Destinations : 8 Routes : 9
Destination/Mask Proto Pre Cost NextHop Interface
1.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
2.2.2.2/32 OSPF 10 10 20.0.0.2 Eth0/0
OSPF 10 10 10.0.0.2 Eth0/1
10.0.0.0/24 Direct 0 0 10.0.0.1 Eth0/1
10.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
20.0.0.0/24 Direct 0 0 20.0.0.1 Eth0/0
20.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
此时如果需要指定从E0/1口发送数据,可以讲E0/0口COST修改大于E0/1的默认10的值:
[RTA]int e0/0
[RTA-Ethernet0/0]ospf cost 20
此时可以看到RTA上去往RTB2.2.2.2网络的只有一条从E0/1口COST为10的路由了:
[RTA]disp ip routing-table
Routing Tables: Public
Destinations : 8 Routes : 8
Destination/Mask Proto Pre Cost NextHop Interface
1.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
2.2.2.2/32 OSPF 10 10 10.0.0.2 Eth0/1
10.0.0.0/24 Direct 0 0 10.0.0.1 Eth0/1
10.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
20.0.0.0/24 Direct 0 0 20.0.0.1 Eth0/0
20.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0