说明:
1.将路由器R5的Fa0/0端口的ip设为:192.168.4.5/24;S1/1端口的ip设为:192.168.3.5/24
2.将路由器R1的S1/1端口的ip设为:192.168.3.1/24;S1/2端口的ip设为:192.168.2.1/24
3.将路由器R2的S1/2端口的ip设为:192.168.2.2/24;Fa0/0端口的ip设为:192.168.1.2/24
交换机SW1的配置:
分别将Fa1/11、Fa1/14端口设置为全双工模式:
SW1(config)#int fa1/11
SW1(config-if)#speed 100
SW1(config-if)#duplex full
SW1(config-if)#no shut
SW1(config-if)#exit
SW1(config)#int fa1/14
SW1(config-if)#speed 100
SW1(config-if)#duplex full
SW1(config-if)#no shut
SW1(config-if)#exit
路由器R2的配置清单:
1、分别为路由器R2的S1/2、Fa0/0端口设置iP:
R2(config)#int s1/2
R2(config-if)#ip add 192.168.2.2 255.255.255.0
R2(config-if)#no shut
R2(config)#int fa0/0
R2(config-if)#speed 100
R2(config-if)#duplex full
R2(config-if)#ip add 192.168.1.2 255.255.255.0
R2(config-if)#no shut
R2(config-if)#exit
2、在路由器R2上配置OSPF:
R2(config)#router ospf 100
R2(config-router)#router-id 2.2.2.2
R2(config-router)#network
R2(config-router)#network 192.168.2.2 0.0.0.0 a 0
R2(config-router)#network 192.168.1.2 0.0.0.0 a 0
R2(config-router)#exit
路由器R1的配置清单:
1、为路由器R1的S1/1端口设置ip并封装桢中继:
R1(config)#int s1/1
R1(config-if)#ip add 192.168.3.1 255.255.255.0
R1(config-if)#encapsulation frame-relay
R1(config-if)#frame-relay map ip 192.168.3.5 105 br
R1(config-if)#no frame-relay inverse-arp
R1(config-if)#no shut
2、为路由器R1的S1/2端口设置ip:
R1(config)#int s1/2
R1(config-if)#ip add 192.168.2.1 255.255.255.0
R1(config-if)#no shut
3、在路由器R1上配置OSPF:
R1(config)#router ospf 100
R1(config-router)#router-id 1.1.1.1
R1(config-router)#network 192.168.3.1 0.0.0.0 a 0
R1(config-router)#network 192.168.2.1 0.0.0.0 a 0
R1(config-router)#exit
路由器R5的配置清单:
1、为路由器R5的S1/1端口配置ip并封装桢中继:
R5(config)#int s1/1
R5(config-if)#ip add 192.168.3.5 255.255.255.0
R5(config-if)#encapsulation frame-relay
R5(config-if)#frame-relay map ip 192.168.3.1 501 br
R5(config-if)#no frame-relay inverse-arp
R5(config-if)#no shut
R5(config-if)#exit
2、为路由器R5的Fa0/0端口配置ip并设为全双工模式:
R5(config)#int fa0/0
R5(config-if)#speed 100
R5(config-if)#duplex full
R5(config-if)#ip add 192.168.4.5 255.255.255.0
R5(config-if)#no shut
R5(config-if)#exit
3、在路由器R5上配置OSPF:
R5(config)#router ospf 100
R5(config-router)#router-id 5.5.5.5
R5(config-router)#network 192.168.4.5 0.0.0.0 a 0
R5(config-router)#network 192.168.3.5 0.0.0.0 a 0
R5(config-router)#exit
A:改变网络类型实现OSPF在桢中继可以发现邻居:
1、改变R1的S1/1的网络类型为“点对多点”:
R1(config)#int s1/1
R1(config-if)#ip ospf network point-to-mu
R1(config-if)#no shut
2、改变R5的S1/1的网络类型为“点对多点”:
R5(config)#int s1/1
R5(config-if)#ip ospf network point-to-mu
R5(config-if)#no shut
这时,我们使用#show ip ospf nei命令来查看R1的邻居表:
R1#show ip ospf nei
Neighbor ID Pri State Dead Time Address Interface
5.5.5.5 0 FULL/ - 00:01:47 192.168.3.5 Serial1/1
2.2.2.2 0 FULL/ - 00:00:33 192.168.2.2 Serial1/2
看到了吧,路由器R1的邻居表里面已经有了R5和R2,这时,我们再用ping命令来验证一下,我们用R1来pingR5:
R1#ping 192.168.4.5
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.4.5, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 44/73/112 ms
成功了!同样的道理,R5就不再验证了?
B:手工为R1、R5指定邻居:(//后面为注释)
R1(config)#router ospf 100
R1(config)#nei 192.168.3.5 //指定R5是R1的邻居,这里写对方的ip
R5(config)#router ospf 100