广播多路访问链路上的OSPF

拓扑图

如图所示

配置路由器IP地址

router 1的配置

Router>en
Router#conf t
Router(config)#hostname Router1
Router1(config)#int g0/0
Router1(config-if)#ip addr 192.168.1.1 255.255.255.0
Router1(config-if)#no shu
Router1(config-if)#exit
Router1(config)#int l0
Router1(config-if)#ip addr 1.1.1.1 255.255.255.0
Router1(config-if)#no shu
Router1(config-if)#end

router 2的配置

Router>en
Router#conf t
Router(config)#hostname Router2
Router2(config)#int l0
Router2(config-if)#ip addr 2.2.2.2 255.255.255.0
Router2(config-if)#no shu
Router2(config-if)#exit
Router2(config)#int g0/0
Router2(config-if)#ip addr 192.168.1.2 255.255.255.0
Router2(config-if)#no shu
Router2(config-if)#end

router 3的配置

Router>en
Router#conf t
Router(config)#hostname Router3
Router3(config)#int l0
Router3(config-if)#ip addr 3.3.3.3 255.255.255.0
Router3(config-if)#no shu
Router3(config-if)#exit
Router3(config)#int g0/0
Router3(config-if)#ip addr 192.168.1.3 255.255.255.0
Router3(config-if)#no shu
Router3(config-if)#end

router 4的配置

Router>en
Router#conf t
Router(config)#hostname Router4
Router4(config)#int l0
Router4(config-if)#ip addr 4.4.4.4 255.255.255.0
Router4(config-if)#no shu
Router4(config-if)#exit
Router4(config)#int g0/0
Router4(config-if)#ip addr 192.168.1.4 255.255.255.0
Router4(config-if)#no shu
Router4(config-if)#end

配置ospf

router 1的配置

Router1(config)#router ospf 1
Router1(config-router)#router-id 1.1.1.1
Router1(config-router)#network 1.1.1.0 0.0.0.255 area 0
Router1(config-router)#network 192.168.1.0 0.0.0.255 area 0
Router1(config-router)#exit

router 2的配置

Router2(config)#router ospf 1
Router2(config-router)#router-id 2.2.2.2
Router2(config-router)#network 192.168.1.0 0.0.0.255 area 0
Router2(config-router)#network 2.2.2.0 0.0.0.255 area 0
Router2(config-router)#exit

router 3的配置

Router3(config)#router ospf 1
Router3(config-router)#router-id 3.3.3.3
Router3(config-router)#network 192.168.1.0 0.0.0.255 area 0
Router3(config-router)#network 3.3.3.0 0.0.0.255 area 0
Router3(config-router)#exit

router 4的配置

Router4(config)#router ospf 1
Router4(config-router)#router-id 4.4.4.4
Router4(config-router)#network 4.4.4.0 0.0.0.255 area 0
Router4(config-router)#network 192.168.1.0 0.0.0.255 area 0
Router4(config-router)#exit

在router 1上查看OSPF的邻居信息

Router1#show ip ospf  neighbor
Neighbor ID     Pri   State           Dead Time   Address         Interface
2.2.2.2           1   FULL/BDR        00:00:39    192.168.1.2     GigabitEthernet0/0
3.3.3.3           1   FULL/DROTHER    00:00:37    192.168.1.3     GigabitEthernet0/0
4.4.4.4           1   FULL/DROTHER    00:00:31    192.168.1.4     GigabitEthernet0/0
 
此时router 1 为DR,router 2 为BDR 
断开router 1的连接,再查看router2的OSPF邻居信息
 
Router2#show ip ospf neighbor
Neighbor ID     Pri   State           Dead Time   Address         Interface
3.3.3.3           1   FULL/DROTHER    00:00:38    192.168.1.3     GigabitEthernet0/0
4.4.4.4           1   FULL/BDR        00:00:32    192.168.1.4     GigabitEthernet0/0
 
router2 成为了DR
 
实验结束
posted @ 2018-06-26 16:14  knightysa  阅读(234)  评论(0编辑  收藏  举报