配置要求: 用OSPF使PC1与PC2互通 确定R2和R4状态是不是ABR 确保区域456中仅有一个DR,没有BDR 确保区域456DR地址为56.6 确保区域12中没有DR,切发送hello报文的时间为5s
配置步骤: 1、 基本配置:配置PC地址、网关,路由接口地址 2、 PC1与PC2互通 1) 配置思路 区域0为主干区域,非主干区域必须连接主干区域 邻居建立路由router-id不能一致,同网络的区域、子网必须一致 路由器开启OSPF,12.0在区域12,23.0、34.0在区域0、45.0、56.0在区域456 每个路由命名router-id 1.0,2.0网络为直连PC,无需发送OSPF报文,所有用import-route direct添加 AR2\AR4为ABR区域边缘路由器,配置时注意区域切换 2)配置步骤 AR1配置 ospf 1 router-id 1.1.1.1 //进入OSPF进程1,命名routerid import-route direct//由于192.168.1.0连接PC无需接收OSPF报文,用import-route direct将直连路由加入 area 12 //进入区域12 network 192.168.12.0 0.0.0.255//将192.168.12.0加入OSPF AR2配置 ospf 1 router-id 2.2.2.2 //进入OSPF进程1,命名routerid area 12 //进入区域12 network 192.168.12.0 0.0.0.255//将192.168.12.0加入OSPF area 0 //进入区域0 network 192.168.23.0 0.0.0.255//将192.168.23.0加入OSPF AR3配置 ospf 1 router-id 3.3.3.3 //进入OSPF进程1,命名routerid area 0 //进入区域0 network 192.168.23.0 0.0.0.255 network 192.168.34.0 0.0.0.255 AR4配置 ospf 1 router-id 4.4.4.4 area 0 network 192.168.34.0 0.0.0.255 area 456 network 192.168.45.0 0.0.0.255 AR5配置 ospf 1 router-id 5.5.5.5 area 456 network 192.168.45.0 0.0.0.255 network 192.168.56.0 0.0.0.255 AR6配置 ospf 1 router-id 6.6.6.6 import-route direct area 456 network 192.168.56.0 0.0.0.255
3、 确保区域12中没有DR,切发送hello报文的时间为5s 1) 配置思路 DR、BDR是否存在取决于不同的网络类型 邻居建立Hello报文与dead时间必须相同 12.0网段直连的两个接口网络类型、hello报文长度一致 2)配置步骤 AR1配置: int g 0/0/0 ospf timer hello 5 ospf network-type p2p AR2配置 int g 0/0/1 ospf timer hello 5 ospf network-type p2p 4、确保区域456中仅有一个DR,没有BDR,确保区域456DR地址为56.6 1)配置思路 456区域有45.0与56.0两个网段 修改45.0网段直连接口网络类型,确保45.0网络不需要DR\BDR OSPF权限为0,不参与DR、BDR选举,修改56.5 OSPF权限为0 AR6配置步骤 ospf dr-priority 0
效果: 0、PC1与PC2可通信 1、AR1信息 OSPF Process 1 with Router ID 1.1.1.1 RouterID: 1.1.1.1
Area: 0.0.0.12
Interface: 192.168.12.1 (GigabitEthernet0/0/0) --> 192.168.12.2
Cost: 1 State: P-2-P Type: P2P MTU: 1500
Timers: Hello 5 , Dead 20 , Poll 120 , Retransmit 5 , Transmit Delay 1
192.168.2.0/24 O_ASE 150 1 D 192.168.12.2 GigabitEthernet
2、AR2信息 OSPF Process 1 with Router ID 2.2.2.2 RouterID: 2.2.2.2 Border Router: AREA
Area: 0.0.0.0
Interface: 192.168.23.2 (GigabitEthernet0/0/0)
Cost: 1 State: DR Type: Broadcast MTU: 1500
Priority: 1
Designated Router: 192.168.23.2
Backup Designated Router: 192.168.23.3
Timers: Hello 10 , Dead 40 , Poll 120 , Retransmit 5 , Transmit Delay 1
Area: 0.0.0.12
Interface: 192.168.12.2 (GigabitEthernet0/0/1) --> 192.168.12.1
Cost: 1 State: P-2-P Type: P2P MTU: 1500
Timers: Hello 5 , Dead 20 , Poll 120 , Retransmit 5 , Transmit Delay 1
3、AR3信息 OSPF Process 1 with Router ID 3.3.3.3 RouterID: 3.3.3.3
Area: 0.0.0.0 (MPLS TE not enabled)
Interface: 192.168.23.3 (GigabitEthernet0/0/1)
Cost: 1 State: BDR Type: Broadcast MTU: 1500
Priority: 1
Designated Router: 192.168.23.2
Backup Designated Router: 192.168.23.3
Timers: Hello 10 , Dead 40 , Poll 120 , Retransmit 5 , Transmit Delay 1
Interface: 192.168.34.3 (GigabitEthernet0/0/0)
Cost: 1 State: DR Type: Broadcast MTU: 1500
Priority: 1
Designated Router: 192.168.34.3
Backup Designated Router: 192.168.34.4
Timers: Hello 10 , Dead 40 , Poll 120 , Retransmit 5 , Transmit Delay 1
4、AR4信息 OSPF Process 1 with Router ID 4.4.4.4 RouterID: 4.4.4.4 Border Router: AREA
Area: 0.0.0.0 (MPLS TE not enabled)
Interface: 192.168.34.4 (GigabitEthernet0/0/1)
Cost: 1 State: BDR Type: Broadcast MTU: 1500
Priority: 1
Designated Router: 192.168.34.3
Backup Designated Router: 192.168.34.4
Timers: Hello 10 , Dead 40 , Poll 120 , Retransmit 5 , Transmit Delay 1
Area: 0.0.1.200
Interface: 192.168.45.4 (GigabitEthernet0/0/0) --> 192.168.45.5
Cost: 1 State: P-2-P Type: P2P MTU: 1500
Timers: Hello 10 , Dead 40 , Poll 120 , Retransmit 5 , Transmit Delay 1
5、AR5信息 OSPF Process 1 with Router ID 5.5.5.5 RouterID: 5.5.5.5 Border Router:
Area: 0.0.1.200
Interface: 192.168.45.5 (GigabitEthernet0/0/1) --> 192.168.45.4
Cost: 1 State: P-2-P Type: P2P MTU: 1500
Timers: Hello 10 , Dead 40 , Poll 120 , Retransmit 5 , Transmit Delay 1
Interface: 192.168.56.5 (GigabitEthernet0/0/0)
Cost: 1 State: DROther Type: Broadcast MTU: 1500
Priority: 0
Designated Router: 192.168.56.6
Backup Designated Router: 0.0.0.0
Timers: Hello 10 , Dead 40 , Poll 120 , Retransmit 5 , Transmit Delay 1
6、AR6信息
OSPF Process 1 with Router ID 6.6.6.6
RouterID: 6.6.6.6
Area: 0.0.1.200 (MPLS TE not enabled)
Interface: 192.168.56.6 (GigabitEthernet0/0/1)
Cost: 1 State: DR Type: Broadcast MTU: 1500
Priority: 1
Designated Router: 192.168.56.6
Backup Designated Router: 0.0.0.0
Timers: Hello 10 , Dead 40 , Poll 120 , Retransmit 5 , Transmit Delay 1