OSPF动态路由:开放式最短路径优先 属于内部网关协议 没有跳数的限制 适用于大型网络
拓扑图
实验环境:
Cisco Packet Tracer 6.0两台2811路由器两台PC
实验要求
两台路由器之间使用ospf协议实现相互通信并配置ospf端口认证(密码为明文a123)
实验命令
R1:R1>en//进入特权模式R1#conf t//进入全局配置模式Enter configuration commands, one per line. End with CNTL/Z.R1(config)#int se0/0/0//进入se0/0/0R1(config-if)#no shut//开启se0/0/0%LINK-5-CHANGED: Interface Serial0/0/0, changed state to downR1(config-if)#ip add 192.168.0.1 255.255.255.0//设置se0/0/0的ipR1(config-if)#int fa0/0//进入fa0/0R1(config-if)#no shut//开启fa0/0R1(config-if)#%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to upR1(config-if)#ip add 192.168.10.1 255.255.255.0//给fa0/0设置ipR1(config-if)#ex//退出fa0/0R1(config)#route ospf 1//创建ospf进程1R1(config-router)#net 192.168.10.0 0.0.0.255 area 0//发布路由R1(config-router)#net 192.168.0.0 0.0.0.255 area 0//发布路由R1(config-router)#int se0/0/0//进入se0/0/0R1(config-if)#ip ospf authentication //开启ospf端口认证R1(config-if)#ip ospf authentication-key a123//设置认证密码R1(config-if)#ex//退出se0/0/0R1(config)#
R2:R2>en//进入特权模式R2#conf t//进入全局配置模式Enter configuration commands, one per line. End with CNTL/Z.R2(config)#int se0/0/0//进入se0/0/0R2(config-if)#no shut//开启se0/0/0R2(config-if)#%LINK-5-CHANGED: Interface Serial0/0/0, changed state to upR2(config-if)#ip add 192.168.0.2 255.255.255.0//给se0/0/0设置ipR2(config-if)#clock rate 64000//设置se0/0/0的时钟频率R2(config-if)#int fa0/0//进入fa0/0R2(config-if)#no shut//开启fa0/0R2(config-if)#%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to upR2(config-if)#ip add 192.168.20.1 255.255.255.0//给fa0/0设置ipR2(config-if)#ex//退出fa0/0R2(config)#route ospf 1//创建ospf进程1R2(config-router)#net 192.168.20.0 0.0.0.255 area 0//发布路由R2(config-router)#net 192.168.0.0 0.0.0.255 area 0//发布路由R2(config-router)#int se0/0/0//进入se0/0/0R2(config-if)#ip ospf authentication //开启ospf端口认证R2(config-if)#ip ospf authentication-key a123//设置认证密码R2(config-if)#end//返回特权模式R2#
操作结果
PC0 ping PC1 Reply