本实验主要验证修改OSPF优先级。默认情况下,R4路由器为DR;R3路由器为BDR(根据路由器Route-ID大小来确定)。通过修改路由器优先级,将R1设置为DR,R2设置为BDR。
一个广播性、多接入网络中的指定路由器DR(Designated Router)
为减小多路访问网络中OSPF流量,OSPF会选择一个指定路由器(DR)和一个备份指定路由器(BDR)。当多路访问网络发生变化时,DR负责更新其他所有OSPF路由器。
BDR会监控DR 的状态,并在当前DR发生故障时接替其角色。
拓扑图如下:
一、根据拓扑图配置路由器IP地址
R1
R1#conf t
R1(config)#interface fastEthernet 1/0
R1(config-if)#no switchport
R1(config-if)#ip address 192.168.0.1 255.255.255.0
R1(config-if)#no sh
R1(config-if)#exit
R1(config)#interface fastEthernet 0/0
R1(config-if)#ip address 172.16.0.1 255.255.255.0
R1(config-if)#no sh
R2
R2#conf t
R2(config)#interface fastEthernet 1/0
R2(config-if)#no switchport
R2(config-if)#ip address 192.168.1.1 255.255.255.0
R2(config-if)#no sh
R2(config-if)#exit
R2(config)#interface fastEthernet 0/0
R2(config-if)#ip address 172.16.0.2 255.255.255.0
R2(config-if)#no sh
R2(config-if)#exit
R3
R3#conf t
R3(config)#interface fastEthernet 1/0
R3(config-if)#no switchport
R3(config-if)#ip address 192.168.2.1 255.255.255.0
R3(config-if)#no sh
R3(config-if)#exit
R3(config)#interface fastEthernet 0/0
R3(config-if)#ip address 172.16.0.3 255.255.255.0
R3(config-if)#no sh
R4
R4#conf t
R4(config)#interface fastEthernet 1/0
R4(config-if)#no switchport
R4(config-if)#ip address 192.168.3.1 255.255.255.0
R4(config-if)#no sh
R4(config-if)#exit
R4(config)#interface fastEthernet 0/0
R4(config-if)#ip address 172.16.0.4 255.255.255.0
R4(config-if)#no sh
二、配置OSPF
R1
R1#conf t
R1(config)#router ospf 1
R1(config-router)#network 0.0.0.0 255.255.255.255 area 0
R2
R2#conf t
R2(config)#router ospf 1
R2(config-router)#network 0.0.0.0 255.255.255.255 area 0
R3
R2#conf t
R3(config)#router ospf 1
R3(config-router)#network 0.0.0.0 255.255.255.255 area 0
R4
R2#conf t
R4(config)#router ospf 1
R4(config-router)#network 0.0.0.0 255.255.255.255 area 0
三、查看DR和BDR
R1,通过show ip ospf neighbor 可以看到R4为DR(192.168.3.1),R3为BDR(192.168.2.1)
R1#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
192.168.1.1 1 2WAY/DROTHER 00:00:32 172.16.0.2 FastEthernet0/0
192.168.2.1 1 FULL/BDR 00:00:38 172.16.0.3 FastEthernet0/0
192.168.3.1 1 FULL/DR 00:00:33 172.16.0.4 FastEthernet0/0
R1,通过命令show ip ospf interface fastEthernet 0/0,查看ospf接口信息。
R1#show ip ospf interface fastEthernet 0/0
FastEthernet0/0 is up, line protocol is up
Internet Address 172.16.0.1/24, Area 0
Process ID 1, Router ID 192.168.0.1, Network Type BROADCAST, Cost: 1
Transmit Delay is 1 sec, State DROTHER, Priority 1
Designated Router (ID) 192.168.3.1, Interface address 172.16.0.4
Backup Designated router (ID) 192.168.2.1, Interface address 172.16.0.3
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
oob-resync timeout 40
Hello due in 00:00:03
Supports Link-local Signaling (LLS)
Index 1/1, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 0, maximum is 1
Last flood scan time is 0 msec, maximum is 4 msec
Neighbor Count is 3, Adjacent neighbor count is 2
Adjacent with neighbor 192.168.2.1 (Backup Designated Router)
Adjacent with neighbor 192.168.3.1 (Designated Router)
Suppress hello for 0 neighbor(s)
四、修改ospf优先级
路由器接口优先级默认我1。
优先级最高就会成为DR,次高成为BDR。
修改R1优先级为100
R1#conf t
R1(config)#interface fastEthernet 0/0
R1(config-if)#ip ospf priority 100
修改R2优先级为90
R2#conf t
R2(config)#interface fastEthernet 0/0
R2(config-if)#ip ospf priority 90
R1/R2/R3/R4清理ospf缓存,执行clear ip ospf process
R1#clear ip ospf process
Reset ALL OSPF processes? [no]: yes
重新查看DR和BDR,R1(192.168.0.1)为DR,R2(192.168.1.1)为BDR
R3#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
192.168.0.1 100 FULL/DR 00:00:34 172.16.0.1 FastEthernet0/0
192.168.1.1 90 FULL/BDR 00:00:32 172.16.0.2 FastEthernet0/0
192.168.3.1 1 2WAY/DROTHER 00:00:34 172.16.0.4 FastEthernet0/0