实验七 开放式最短路径优先路由协议OSPF
配置
1、实验目的
(1)练习OSPF 动态路由协议的基本配置; (2)掌握了解OSPF 路由协议原理
2、实验内容
(1)OSPF 动态路由协议配置 (2)查看路由表
3、网络结构图
拓扑结构图如下所示:
4、实验步骤:
(1)配置Router 1:
Router>enable //进入特权模式
Router#configure terminal //进入配置模式
Enter configuration commands, one per line. End with CNTL/Z. Router(config)#interface FastEthernet0/0 //配置端口 Router(config-if)#ip address 172.16.0.1 255.255.255.0
Router(config-if)#no shutdown
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
Router(config-if)# Router(config-if)#exit
Router(config)#interface Serial1/0 //配置端口
Router(config-if)#ip address 192.168.0.1 255.255.255.0 Router(config-if)#clock rate 64000 Router(config-if)#no shutdown Router(config-if)#
%LINK-5-CHANGED: Interface Serial1/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/0, changed state to up Router(config-if)#route ospf 1 //启用OSPF 协议,ID 号为1
Router(config-router)#network 192.168.0.0 0.0.0.255 area 0 //发布网络 Router(config-router)#network 172.16.0.0 0.0.0.255 area 0 Router(config-router)#exit Router(config-config)#exit
Router#copy running-config startup-config //写入启动文件 Destination filename [startup-config]? Building configuration... [OK]
(2)配置Router2: Router>enable
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z. Router(config)#interface FastEthernet0/0
Router(config-if)#ip address 172.17.0.1 255.255.255.0 Router(config-if)#no shutdown
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
Router(config-if)#exit
Router(config)#interface Serial0/3/0
Router(config-if)#ip address 192.168.0.2 255.255.255.0 Router(config-if)#
%LINK-5-CHANGED: Interface Serial1/0, changed state to upno shutdown
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/0, changed state to up Router(config-if)#exit
Router(config)#interface Serial0/3/1
Router(config-if)#ip address 192.168.1.1 255.255.255.0 Router(config-if)#clock rate 64000 Router(config-if)#no shutdown Router(config-if)#
%LINK-5-CHANGED: Interface Serial1/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/1, changed state to up Router(config-if)#router ospf 1
Router(config-router)#network 192.168.0.0 0.0.0.255 area 0 Router(config-router)#network 192.168.1.0 0.0.0.255 area 0 Router(config-router)#network 172.17.0.0 0.0.0.255 area 0 Router(config-router)#exit Router(config-config)#exit
Router#copy running-config startup-config Destination filename [startup-config]? Building configuration... [OK] Router#
00:13:29: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.2.1 on Serial1/1 from LOADING to FULL, Loading Done
(3)配置Router 3: Router>enable
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z. Router(config)#interface FastEthernet0/0
Router(config-if)#ip address 172.18.0.1 255.255.255.0 Router(config-if)#no shutdown
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
Router(config-if)#exit
Router(config)#interface Serial0/3/0
Router(config-if)#ip address 192.168.1.2 255.255.255.0 Router(config-if)#
%LINK-5-CHANGED: Interface Serial1/0, changed state to upno shutdown Router(config-if)#exit
Router(config)#interface Serial0/3/1
Router(config-if)#ip address 192.168.2.1 255.255.255.0 Router(config-if)#clock rate 64000 Router(config-if)#no shutdown Router(config-if)#
%LINK-5-CHANGED: Interface Serial1/1, changed state to up Router(config-if)#exit
Router(config)#route ospf 1Router(config-router)#network 192.168.1.0 0.0.0.255 area 0
Router(config-router)#network 192.168.1.
00:13:29: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.1.1 on Serial1/0 from LOADING to FULL, Loading Done0 0.0.0.255 area 0
Router(config-router)#network 192.168.2.0 0.0.0.255 area 0 Router(config-router)#network 172.18.0.0 0.0.0.255 area 0 Router(config-router)#exit Router(config-config)#exit
Router#copy running-config startup-config Destination filename [startup-config]? Building configuration... [OK]
(4)配置Router 4:
Router>enable
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z. Router(config)#interface FastEthernet0/0
Router(config-if)#ip address 10.1.1.1 255.255.255.0 Router(config-if)#no shutdown
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
Router(config-if)#exit
Router(config)#interface Serial1/0
Router(config-if)#ip address 192.168.2.2 255.255.255.0 Router(config-if)#exit
Router(config)#router ospf 1
Router(config-router)#network 192.168.2.0 0.0.0.255 area 0 Router(config-router)#network 10.1.1.0 0.0.0.255 area 0 Router(config-router)#exit Router(config)#exit
%SYS-5-CONFIG_I: Configured from console by console Router#copy running-config startup-config Destination filename [startup-config]? Building configuration... [OK]
(5)配置校验、诊断(鉴于篇幅,以下命令均在router 6 上调试)
show ip protocol 查看路由器中所启用的路由计算协议:
show ip ospf:
show ip ospf neighbor
show ip ospf database