OSPF分流互备
实验要求:
-
R1为生产1和办公1服务器
-
R2为生产2和办公2服务器
-
R5为客户端
-
生产流量访问1服务器要求正常走R3,即R5-R3-R1;当R3-R5线路断开时,能够进行线路切换,通过R5-R4-R1,访问生产1服务器,不能通过R2访问生产1。
-
办公流量访问1服务器时,要求通过R4,即R5-R4-R2-R1;当R4-R5线路断开时,能够进行线路切换,通过R5-R3-R2-R1,访问办公1服务器,不能通过R3直接访问办公1。
-
从服务器至客户端的流量按原路径返回。
-
访问生产2和办公2服务器同理。(原则为生产走左边,办公走右边)
R1-R5的配置(只摘录有用部分)
R1:
interface Loopback0
ip address 10.1.1.1 255.255.255.255
!
interface Loopback1 -------(代表生产1服务器,以下同理)
ip address 10.88.1.1 255.255.255.255
!
interface Loopback2 -------(代表办公1服务器,以下同理)
ip address 10.99.1.1 255.255.255.255
!
interface Ethernet0/0
no ip address
!
interface Ethernet0/0.1
encapsulation dot1Q 2
ip address 10.1.12.1 255.255.255.0
!
interface Ethernet0/0.2
encapsulation dot1Q 3
ip address 10.2.12.1 255.255.255.0
!
interface Ethernet0/1
no ip address
!
interface Ethernet0/1.1
encapsulation dot1Q 2
ip address 10.1.14.1 255.255.255.0
ip ospf cost 20
!
interface Ethernet0/1.2
encapsulation dot1Q 3
ip address 10.2.14.1 255.255.255.0
!
interface Ethernet0/2
ip address 10.1.13.1 255.255.255.0
!
interface Ethernet0/3
no ip address
shutdown
!
router ospf 1
router-id 10.1.1.1
network 10.1.12.0 0.0.0.255 area 1
network 10.1.13.0 0.0.0.255 area 1
network 10.1.14.0 0.0.0.255 area 1
network 10.2.12.0 0.0.0.255 area 2
network 10.2.14.0 0.0.0.255 area 2
network 10.88.0.0 0.0.255.255 area 1
network 10.99.0.0 0.0.255.255 area 2
R1#show ip route (R1路由)
C 10.1.1.1/32 is directly connected, Loopback0
C 10.1.12.0/24 is directly connected, Ethernet0/0.1
L 10.1.12.1/32 is directly connected, Ethernet0/0.1
C 10.1.13.0/24 is directly connected, Ethernet0/2
L 10.1.13.1/32 is directly connected, Ethernet0/2
C 10.1.14.0/24 is directly connected, Ethernet0/1.1
L 10.1.14.1/32 is directly connected, Ethernet0/1.1
O 10.1.23.0/24 [110/20] via 10.1.13.3, 01:11:10, Ethernet0/2
[110/20] via 10.1.12.2, 01:17:22, Ethernet0/0.1
O 10.1.24.0/24 [110/20] via 10.2.14.4, 00:37:02, Ethernet0/1.2
[110/20] via 10.2.12.2, 01:16:18, Ethernet0/0.2
O IA 10.1.34.0/24 [110/20] via 10.2.14.4, 00:35:25, Ethernet0/1.2
[110/20] via 10.1.13.3, 01:10:35, Ethernet0/2
O IA 10.1.35.0/24 [110/74] via 10.1.13.3, 00:20:06, Ethernet0/2
O IA 10.1.45.0/24 [110/80] via 10.2.14.4, 00:08:35, Ethernet0/1.2
C 10.2.12.0/24 is directly connected, Ethernet0/0.2
L 10.2.12.1/32 is directly connected, Ethernet0/0.2
C 10.2.14.0/24 is directly connected, Ethernet0/1.2
L 10.2.14.1/32 is directly connected, Ethernet0/1.2
O 10.2.23.0/24 [110/30] via 10.2.12.2, 00:35:25, Ethernet0/0.2
O IA 10.2.35.0/24 [110/80] via 10.1.13.3, 00:20:06, Ethernet0/2
O IA 10.2.45.0/24 [110/74] via 10.2.14.4, 00:08:35, Ethernet0/1.2
O IA 10.3.3.3/32 [110/11] via 10.1.13.3, 01:11:20, Ethernet0/2
O IA 10.4.4.4/32 [110/11] via 10.2.14.4, 00:35:25, Ethernet0/1.2
C 10.88.1.1/32 is directly connected, Loopback1
O 10.88.2.2/32 [110/11] via 10.1.12.2, 01:18:05, Ethernet0/0.1
O IA 10.88.5.5/32 [110/75] via 10.1.13.3, 00:20:06, Ethernet0/2
生产1去往客户端走R3
C 10.99.1.1/32 is directly connected, Loopback2
O 10.99.2.2/32 [110/11] via 10.2.12.2, 01:16:38, Ethernet0/0.2
O IA 10.99.5.5/32 [110/75] via 10.2.14.4, 00:08:35, Ethernet0/1.2
办公1去往客户端走R2
R2:
interface Loopback0
ip address 10.2.2.2 255.255.255.255
!
interface Loopback1
ip address 10.99.2.2 255.255.255.255
!
interface Loopback2
ip address 10.88.2.2 255.255.255.255
!
interface Ethernet0/0
no ip address
!
interface Ethernet0/0.1
encapsulation dot1Q 2
ip address 10.1.12.2 255.255.255.0
!
interface Ethernet0/0.2
encapsulation dot1Q 3
ip address 10.2.12.2 255.255.255.0
!
interface Ethernet0/1
no ip address
!
interface Ethernet0/1.1
encapsulation dot1Q 2
ip address 10.1.23.2 255.255.255.0
!
interface Ethernet0/1.2
encapsulation dot1Q 3
ip address 10.2.23.2 255.255.255.0
ip ospf cost 20
!
interface Ethernet0/2
ip address 10.1.24.2 255.255.255.0
!
interface Ethernet0/3
no ip address
shutdown
!
router ospf 1
router-id 10.2.2.2
network 10.1.12.0 0.0.0.255 area 1
network 10.1.23.0 0.0.0.255 area 1
network 10.1.24.0 0.0.0.255 area 2
network 10.2.12.0 0.0.0.255 area 2
network 10.2.23.0 0.0.0.255 area 2
network 10.88.0.0 0.0.255.255 area 1
network 10.99.0.0 0.0.255.255 area 2
R2#show ip route (R2路由)
C 10.1.12.0/24 is directly connected, Ethernet0/0.1
L 10.1.12.2/32 is directly connected, Ethernet0/0.1
O 10.1.13.0/24 [110/20] via 10.1.23.3, 01:12:38, Ethernet0/1.1
[110/20] via 10.1.12.1, 01:19:29, Ethernet0/0.1
O 10.1.14.0/24 [110/30] via 10.1.12.1, 00:42:17, Ethernet0/0.1
C 10.1.23.0/24 is directly connected, Ethernet0/1.1
L 10.1.23.2/32 is directly connected, Ethernet0/1.1
C 10.1.24.0/24 is directly connected, Ethernet0/2
L 10.1.24.2/32 is directly connected, Ethernet0/2
O IA 10.1.34.0/24 [110/20] via 10.1.24.4, 00:36:53, Ethernet0/2
[110/20] via 10.1.23.3, 01:12:03, Ethernet0/1.1
O IA 10.1.35.0/24 [110/74] via 10.1.23.3, 00:21:34, Ethernet0/1.1
O IA 10.1.45.0/24 [110/80] via 10.1.24.4, 00:10:03, Ethernet0/2
C 10.2.2.2/32 is directly connected, Loopback0
C 10.2.12.0/24 is directly connected, Ethernet0/0.2
L 10.2.12.2/32 is directly connected, Ethernet0/0.2
O 10.2.14.0/24 [110/20] via 10.2.12.1, 00:38:30, Ethernet0/0.2
[110/20] via 10.1.24.4, 01:10:17, Ethernet0/2
C 10.2.23.0/24 is directly connected, Ethernet0/1.2
L 10.2.23.2/32 is directly connected, Ethernet0/1.2
O IA 10.2.35.0/24 [110/80] via 10.1.23.3, 00:21:34, Ethernet0/1.1
O IA 10.2.45.0/24 [110/74] via 10.1.24.4, 00:10:03, Ethernet0/2
O IA 10.3.3.3/32 [110/11] via 10.1.23.3, 01:12:38, Ethernet0/1.1
O IA 10.4.4.4/32 [110/11] via 10.1.24.4, 00:36:53, Ethernet0/2
O 10.88.1.1/32 [110/11] via 10.1.12.1, 01:19:29, Ethernet0/0.1
C 10.88.2.2/32 is directly connected, Loopback2
O IA 10.88.5.5/32 [110/75] via 10.1.23.3, 00:21:34, Ethernet0/1.1
生产2去往客户端走R1
O 10.99.1.1/32 [110/11] via 10.2.12.1, 01:18:09, Ethernet0/0.2
C 10.99.2.2/32 is directly connected, Loopback1
O IA 10.99.5.5/32 [110/75] via 10.1.24.4, 00:10:03, Ethernet0/2
办公2去往客户端走R4
R3:
interface Loopback0
ip address 10.3.3.3 255.255.255.255
!
interface Ethernet0/0
ip address 10.1.34.3 255.255.255.0
!
interface Ethernet0/1
no ip address
!
interface Ethernet0/1.1
encapsulation dot1Q 2
ip address 10.1.23.3 255.255.255.0
!
interface Ethernet0/1.2
encapsulation dot1Q 3
ip address 10.2.23.3 255.255.255.0
ip ospf cost 20
!
interface Ethernet0/2
ip address 10.1.13.3 255.255.255.0
!
interface Ethernet0/3
no ip address
shutdown
!
interface Serial1/0
no ip address
encapsulation frame-relay
no keepalive
serial restart-delay 0
!
interface Serial1/0.1 point-to-point
ip address 10.1.35.3 255.255.255.0
no keepalive
frame-relay interface-dlci 100
!
interface Serial1/0.2 point-to-point
ip address 10.2.35.3 255.255.255.0
ip ospf cost 70
no keepalive
frame-relay interface-dlci 200
!
interface Serial1/1
no ip address
shutdown
serial restart-delay 0
!
interface Serial1/2
no ip address
shutdown
serial restart-delay 0
!
interface Serial1/3
no ip address
shutdown
serial restart-delay 0
!
router ospf 1
router-id 10.3.3.3
network 10.1.13.0 0.0.0.255 area 1
network 10.1.23.0 0.0.0.255 area 1
network 10.1.34.0 0.0.0.255 area 0
network 10.1.35.0 0.0.0.255 area 3
network 10.2.23.0 0.0.0.255 area 2
network 10.2.35.0 0.0.0.255 area 4
network 10.3.3.3 0.0.0.0 area 0
R3#show ip route (R3路由)
O 10.1.12.0/24 [110/20] via 10.1.23.2, 01:13:52, Ethernet0/1.1
[110/20] via 10.1.13.1, 01:14:14, Ethernet0/2
C 10.1.13.0/24 is directly connected, Ethernet0/2
L 10.1.13.3/32 is directly connected, Ethernet0/2
O 10.1.14.0/24 [110/30] via 10.1.13.1, 00:43:31, Ethernet0/2
C 10.1.23.0/24 is directly connected, Ethernet0/1.1
L 10.1.23.3/32 is directly connected, Ethernet0/1.1
O 10.1.24.0/24 [110/30] via 10.2.23.2, 00:46:52, Ethernet0/1.2
C 10.1.34.0/24 is directly connected, Ethernet0/0
L 10.1.34.3/32 is directly connected, Ethernet0/0
C 10.1.35.0/24 is directly connected, Serial1/0.1
L 10.1.35.3/32 is directly connected, Serial1/0.1
O 10.1.45.0/24 [110/141] via 10.1.35.5, 00:22:48, Serial1/0.1
O 10.2.12.0/24 [110/30] via 10.2.23.2, 00:46:52, Ethernet0/1.2
O 10.2.14.0/24 [110/40] via 10.2.23.2, 00:46:52, Ethernet0/1.2
C 10.2.23.0/24 is directly connected, Ethernet0/1.2
L 10.2.23.3/32 is directly connected, Ethernet0/1.2
C 10.2.35.0/24 is directly connected, Serial1/0.2
L 10.2.35.3/32 is directly connected, Serial1/0.2
O 10.2.45.0/24 [110/134] via 10.2.35.5, 00:22:48, Serial1/0.2
C 10.3.3.3/32 is directly connected, Loopback0
O 10.4.4.4/32 [110/11] via 10.1.34.4, 01:12:15, Ethernet0/0
O 10.88.1.1/32 [110/11] via 10.1.13.1, 01:14:14, Ethernet0/2
O 10.88.2.2/32 [110/11] via 10.1.23.2, 01:13:52, Ethernet0/1.1
O 10.88.5.5/32 [110/65] via 10.1.35.5, 00:22:48, Serial1/0.1
O 10.99.1.1/32 [110/31] via 10.2.23.2, 00:46:52, Ethernet0/1.2
O 10.99.2.2/32 [110/21] via 10.2.23.2, 00:46:52, Ethernet0/1.2
O 10.99.5.5/32 [110/71] via 10.2.35.5, 00:22:48, Serial1/0.2
R4:
interface Loopback0
ip address 10.4.4.4 255.255.255.255
!
interface Ethernet0/0
ip address 10.1.34.4 255.255.255.0
!
interface Ethernet0/1
no ip address
!
interface Ethernet0/1.1
encapsulation dot1Q 2
ip address 10.1.14.4 255.255.255.0
ip ospf cost 20
!
interface Ethernet0/1.2
encapsulation dot1Q 3
ip address 10.2.14.4 255.255.255.0
!
interface Ethernet0/2
ip address 10.1.24.4 255.255.255.0
!
interface Ethernet0/3
no ip address
shutdown
!
interface Serial1/0
no ip address
encapsulation frame-relay
no keepalive
serial restart-delay 0
!
interface Serial1/0.1 point-to-point
ip address 10.1.45.4 255.255.255.0
ip ospf cost 70
no keepalive
frame-relay interface-dlci 100
!
interface Serial1/0.2 point-to-point
ip address 10.2.45.4 255.255.255.0
no keepalive
frame-relay interface-dlci 200
!
interface Serial1/1
no ip address
shutdown
serial restart-delay 0
!
interface Serial1/2
no ip address
shutdown
serial restart-delay 0
!
interface Serial1/3
no ip address
shutdown
serial restart-delay 0
!
router ospf 1
router-id 10.4.4.4
network 10.1.14.0 0.0.0.255 area 1
network 10.1.24.0 0.0.0.255 area 2
network 10.1.34.0 0.0.0.255 area 0
network 10.1.45.0 0.0.0.255 area 3
network 10.2.14.0 0.0.0.255 area 2
network 10.2.45.0 0.0.0.255 area 4
network 10.4.4.4 0.0.0.0 area 0
R4#show ip route (R4路由)
O 10.1.12.0/24 [110/30] via 10.1.14.1, 00:49:23, Ethernet0/1.1
O 10.1.13.0/24 [110/30] via 10.1.14.1, 00:49:23, Ethernet0/1.1
C 10.1.14.0/24 is directly connected, Ethernet0/1.1
L 10.1.14.4/32 is directly connected, Ethernet0/1.1
O 10.1.23.0/24 [110/40] via 10.1.14.1, 00:49:23, Ethernet0/1.1
C 10.1.24.0/24 is directly connected, Ethernet0/2
L 10.1.24.4/32 is directly connected, Ethernet0/2
C 10.1.34.0/24 is directly connected, Ethernet0/0
L 10.1.34.4/32 is directly connected, Ethernet0/0
O 10.1.35.0/24 [110/134] via 10.1.45.5, 00:12:40, Serial1/0.1
C 10.1.45.0/24 is directly connected, Serial1/0.1
L 10.1.45.4/32 is directly connected, Serial1/0.1
O 10.2.12.0/24 [110/20] via 10.2.14.1, 01:12:55, Ethernet0/1.2
[110/20] via 10.1.24.2, 01:13:25, Ethernet0/2
C 10.2.14.0/24 is directly connected, Ethernet0/1.2
L 10.2.14.4/32 is directly connected, Ethernet0/1.2
O 10.2.23.0/24 [110/30] via 10.1.24.2, 00:39:30, Ethernet0/2
O 10.2.35.0/24 [110/141] via 10.2.45.5, 00:12:40, Serial1/0.2
C 10.2.45.0/24 is directly connected, Serial1/0.2
L 10.2.45.4/32 is directly connected, Serial1/0.2
O 10.3.3.3/32 [110/11] via 10.1.34.3, 01:13:35, Ethernet0/0
C 10.4.4.4/32 is directly connected, Loopback0
O 10.88.1.1/32 [110/21] via 10.1.14.1, 00:49:23, Ethernet0/1.1
O 10.88.2.2/32 [110/31] via 10.1.14.1, 00:49:23, Ethernet0/1.1
O 10.88.5.5/32 [110/71] via 10.1.45.5, 00:12:40, Serial1/0.1
O 10.99.1.1/32 [110/11] via 10.2.14.1, 01:12:55, Ethernet0/1.2
O 10.99.2.2/32 [110/11] via 10.1.24.2, 01:13:25, Ethernet0/2
O 10.99.5.5/32 [110/65] via 10.2.45.5, 00:12:40, Serial1/0.2
R5:
interface Loopback0
ip address 10.5.5.5 255.255.255.255
!
interface Loopback1
ip address 10.88.5.5 255.255.255.255
!
interface Loopback2
ip address 10.99.5.5 255.255.255.255
!
interface Serial0/0
no ip address
encapsulation frame-relay
no keepalive
serial restart-delay 0
!
interface Serial0/0.1 point-to-point
ip address 10.1.35.5 255.255.255.0
no keepalive
frame-relay interface-dlci 100
!
interface Serial0/0.2 point-to-point
ip address 10.2.35.5 255.255.255.0
ip ospf cost 77
no keepalive
frame-relay interface-dlci 200
!
interface Serial0/1
no ip address
encapsulation frame-relay
no keepalive
serial restart-delay 0
!
interface Serial0/1.1 point-to-point
ip address 10.1.45.5 255.255.255.0
ip ospf cost 77
no keepalive
frame-relay interface-dlci 100
!
interface Serial0/1.2 point-to-point
ip address 10.2.45.5 255.255.255.0
no keepalive
frame-relay interface-dlci 200
!
interface Serial0/2
no ip address
shutdown
serial restart-delay 0
!
interface Serial0/3
no ip address
shutdown
serial restart-delay 0
!
router ospf 1
router-id 10.5.5.5
network 10.1.0.0 0.0.255.255 area 3
network 10.2.0.0 0.0.255.255 area 4
network 10.88.0.0 0.0.255.255 area 3
network 10.99.0.0 0.0.255.255 area 4
R5#show ip route (R5路由)
O IA 10.1.12.0/24 [110/84] via 10.1.35.3, 00:25:14, Serial0/0.1
O IA 10.1.13.0/24 [110/74] via 10.1.35.3, 00:25:14, Serial0/0.1
O IA 10.1.14.0/24 [110/84] via 10.2.45.4, 00:13:43, Serial0/1.2
O IA 10.1.23.0/24 [110/74] via 10.1.35.3, 00:25:14, Serial0/0.1
O IA 10.1.24.0/24 [110/74] via 10.2.45.4, 00:13:43, Serial0/1.2
O IA 10.1.34.0/24 [110/74] via 10.2.45.4, 00:13:43, Serial0/1.2
[110/74] via 10.1.35.3, 00:25:14, Serial0/0.1
C 10.1.35.0/24 is directly connected, Serial0/0.1
L 10.1.35.5/32 is directly connected, Serial0/0.1
C 10.1.45.0/24 is directly connected, Serial0/1.1
L 10.1.45.5/32 is directly connected, Serial0/1.1
O IA 10.2.12.0/24 [110/84] via 10.2.45.4, 00:13:43, Serial0/1.2
O IA 10.2.14.0/24 [110/74] via 10.2.45.4, 00:13:43, Serial0/1.2
O IA 10.2.23.0/24 [110/84] via 10.1.35.3, 00:25:14, Serial0/0.1
C 10.2.35.0/24 is directly connected, Serial0/0.2
L 10.2.35.5/32 is directly connected, Serial0/0.2
C 10.2.45.0/24 is directly connected, Serial0/1.2
L 10.2.45.5/32 is directly connected, Serial0/1.2
O IA 10.3.3.3/32 [110/65] via 10.1.35.3, 00:25:14, Serial0/0.1
O IA 10.4.4.4/32 [110/65] via 10.2.45.4, 00:13:43, Serial0/1.2
C 10.5.5.5/32 is directly connected, Loopback0
O IA 10.88.1.1/32 [110/75] via 10.1.35.3, 00:25:14, Serial0/0.1
O IA 10.88.2.2/32 [110/75] via 10.1.35.3, 00:25:14, Serial0/0.1
客户端去往生产1和2均走R3
C 10.88.5.5/32 is directly connected, Loopback1
O IA 10.99.1.1/32 [110/75] via 10.2.45.4, 00:13:43, Serial0/1.2
O IA 10.99.2.2/32 [110/75] via 10.2.45.4, 00:13:43, Serial0/1.2
客户端去往办公1和2均走R4
C 10.99.5.5/32 is directly connected, Loopback2
断开R3-R5之间线路,路由可以正常切换(通过修改COST值干涉选路)