办公网段在10.100.0.0/24
业务网段在10.200.0.0/24
配置ip
办公与业务连接的接口配置子接口通信,同种类之间配置ip即可
R3和R4之间不同配置子接口(没必要)
[R1]interface e0/0/0.1
[R1-Ethernet0/0/0.1]dot1q termination vid 1
[R1-Ethernet0/0/0.1]ip address 10.1.12.1 24
[R1-Ethernet0/0/0.1]arp broadcast enable [R1]interface e0/0/0.2
[R1-Ethernet0/0/0.2]arp broadcast enable
[R1-Ethernet0/0/0.2]dot1q termination vid 2
[R1-Ethernet0/0/0.2]ip address 10.2.12.1 24[R1]interface e0/0/1
[R1-Ethernet0/0/1]ip add 10.1.13.1 24
启ospf协议
办公区域为Area 1 业务区域为Area 2 R3-R4为Area 0
下方办公区域为Area 3 下方办公区域为Area 4
[R1]ospf 1 router-id 1.1.1.1
[R1-ospf-1]area 1
[R1-ospf-1-area-0.0.0.1]network 10.100.1.1 0.0.0.255
[R1-ospf-1-area-0.0.0.1]network 10.1.13.0 0.0.0.255
[R1-ospf-1-area-0.0.0.1]network 10.1.14.0 0.0.0.255
[R1-ospf-1-area-0.0.0.1]network 10.1.12.0 0.0.0.255
[R1-ospf-1-area-0.0.0.1]q
[R1-ospf-1]area 2
[R1-ospf-1-area-0.0.0.2]
[R1-ospf-1-area-0.0.0.2]network 10.200.1.0 0.0.0.255
[R1-ospf-1-area-0.0.0.2]network 10.2.12.0 0.0.0.255
[R1-ospf-1-area-0.0.0.2]network 10.2.14.0 0.0.0.255[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]network 10.1.34.0 0.0.0.255
[R3-ospf-1-area-0.0.0.0]q
[R3-ospf-1]area 1
[R3-ospf-1-area-0.0.0.1]
[R3-ospf-1-area-0.0.0.1]network 10.1.13.0 0.0.0.255
[R3-ospf-1-area-0.0.0.1]network 10.1.23.0 0.0.0.255
[R3-ospf-1-area-0.0.0.1]q
[R3-ospf-1]area 2
[R3-ospf-1-area-0.0.0.2]
[R3-ospf-1-area-0.0.0.2]network 10.2.23.0 0.0.0.255
[R3-ospf-1-area-0.0.0.2]q
[R3-ospf-1]area 3
[R3-ospf-1-area-0.0.0.3]
[R3-ospf-1-area-0.0.0.3]network 10.1.35.0 0.0.0.255
[R3-ospf-1-area-0.0.0.3]q
[R3-ospf-1]area 4
[R3-ospf-1-area-0.0.0.4]network 10.2.35.0 0.0.0.255[R5]ospf 1 router-id 5.5.5.5
[R5-ospf-1]area 3
[R5-ospf-1-area-0.0.0.3]network 10.1.35.0 0.0.0.255
[R5-ospf-1-area-0.0.0.3]network 10.1.45.0 0.0.0.255
[R5-ospf-1-area-0.0.0.3]network 10.100.3.0 0.0.0.255
[R5-ospf-1-area-0.0.0.3]q
[R5-ospf-1]area 4
[R5-ospf-1-area-0.0.0.4]network 10.200.3.0 0.0.0.255
[R5-ospf-1-area-0.0.0.4]network 10.2.35.0 0.0.0.255
[R5-ospf-1-area-0.0.0.4]network 10.2.45.0 0.0.0.255
叠加cost值选路
修改cost值主备办公和业务线
主备业务线
[R4]interface g0/0/0.2
[R4-GigabitEthernet0/0/0.2]ospf cost 1
[R4-GigabitEthernet0/0/0.2]q
[R4]interface g0/0/0.1
[R4-GigabitEthernet0/0/0.1]ospf cost 2
[R4]interface g0/0/1.1
[R4-GigabitEthernet0/0/1.1]ospf cost 2
[R4-GigabitEthernet0/0/1.1]q
[R4]interface g0/0/1.2
[R4-GigabitEthernet0/0/1.2]ospf cost 1[R5]interface e0/0/0.2
[R5-Ethernet0/0/0.2]ospf cost 2
[R5]interface e0/0/0.1
[R5-Ethernet0/0/0.1]ospf cost 1
[R5]interface e0/0/1.2
[R5-Ethernet0/0/1.2]ospf cost 1
[R5-Ethernet0/0/1.2]q
[R5]interface e0/0/1.1
[R5-Ethernet0/0/1.1]ospf cost 2[R3]interface g0/0/0.2
[R3-GigabitEthernet0/0/0.2]ospf cost 2
[R3]interface g0/0/0.1
[R3-GigabitEthernet0/0/0.1]ospf cost 1
[R3]interface g0/0/1.1
[R3-GigabitEthernet0/0/1.1]ospf cost 1
[R3-GigabitEthernet0/0/1.1]int g0/0/1.2
[R3-GigabitEthernet0/0/1.2]ospf cost 2[R1]interface g0/0/2.1
[R1-GigabitEthernet0/0/2.1]ospf cost 2
[R1-GigabitEthernet0/0/2.1]int g0/0/2.2
[R1-GigabitEthernet0/0/2.2]ospf cost 2
[R1]interface e0/0/0.1
[R1-Ethernet0/0/0.1]ospf cost 1
[R1-Ethernet0/0/0.1]q
[R1]interface e0/0/0.2
[R1-Ethernet0/0/0.2]ospf cost 2
[R1-Ethernet0/0/0.2]q
[R1]interface e0/0/0.2
[R1-Ethernet0/0/0.2]ospf cost 1[R2]interface g0/0/2.1
[R2-GigabitEthernet0/0/2.1]ospf cost 1
[R2-GigabitEthernet0/0/2.1]int g0/0/2.2
[R2-GigabitEthernet0/0/2.2]ospf cost 2
[R2]interface e0/0/0.1
[R2-Ethernet0/0/0.1]ospf cost 1
[R2-Ethernet0/0/0.1]q
[R2]interface e0/0/0.2
[R2-Ethernet0/0/0.2]ospf cost 1
选路优
考虑断线后选路问题
[R1]interface g0/0/2.1
[R1-GigabitEthernet0/0/2.1]ospf cost 3[R2]interface g0/0/2.2
[R2-GigabitEthernet0/0/2.2]ospf cost 3[R3]interface g0/0/1.2
[R3-GigabitEthernet0/0/1.2]ospf cost 3
[R3]interface g0/0/0.2
[R3-GigabitEthernet0/0/0.2]ospf cost 3[R4]interface g0/0/1.1
[R4-GigabitEthernet0/0/1.1]ospf cost 3
[R4]interface g0/0/0.1
[R4-GigabitEthernet0/0/0.1]ospf cost 3[R5]interface e0/0/0.2
[R5-Ethernet0/0/0.2]ospf cost 3
[R5]interface e0/0/0.1
[R5-Ethernet0/0/0.2]ospf cost 3
部分线路断开不能优化可使用前缀列表
[R4]ip ip-prefix 100 deny 10.100.0.0 16 greater-equal 17
[R4]ospf 1
[R4-ospf-1]area 2
[R4-ospf-1-area-0.0.0.2]filter ip-prefix 100 import
[R4-ospf-1]area 4
[R4-ospf-1-area-0.0.0.4]filter ip-prefix 100 import [R2]interface e0/0/0
[R2-GigabitEthernet0/0/2.2]ospf cost 10[R3]interface e0/0/0
[R3-GigabitEthernet0/0/1.2]ospf cost 10
去方向路由
回方向路由