试验环境介绍:
R1
的
ip
地址为
192.168.6.2 (E1/0) 192.168.7.1 (S0/0)
网络掩码为
255.255.255.0
R2
的
ip
地址为
192.168.7.2 (S0/0) 192.168.8.1
(
S0/1
)
网络掩码为
255.255.255.0
R3
的
ip
地址为
192.168.8.2 (S0/1) 192.168.9.1(E1/0)
网络掩码为
255.255.255.0
R1
的
S0/0 R2
的
S0/1
为
DCE
端
PC1
的
ip
地址为
192.168.6.1
网络掩码为
255.255.255.0
PC2
的
ip
地址为
192.168.9.2
网络掩码为
255.255.255.0
process-id
为100
area
号为0
试验要求:
通过在路由器间配置单区域的
OSPF
协议,使
PC1
和
PC2
之间相互
ping
通。即实现全网全通。
开始工作了(红的字体为配置内容)
R1
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#host r1
r1(config)#int e1/0
r1(config-if)#ip addr 192.168.6.2 255.255.255.0
r1(config-if)#no shut
r1(config-if)#exit
r1(config)#int s0/0
r1(config-if)#ip addr 192.168.7.1 255.255.255.0
r1(config-if)#clock rate 64000
r1(config-if)#no shut
r1(config-if)#exit
r1(config)#router ospf 100
r1(config-router)#network 192.168.6.2 0.0.0 .0 area 0
r1(config-router)#network 192.168.7.1 0.0.0 .0 area 0
R2
Router>en
Router#conf
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#host r2
r2(config)#int s0/0
r2(config-if)#ip addr 192.168.7.2 255.255.255.0
r2(config-if)#no shut
r2(config-if)#exit
r2(config)#int s0/1
r2(config-if)#ip addr 192.168.8.1 255.255.255.0
r2(config-if)#clock rate 64000
r2(config-if)#no shut
r2(config-if)#exit
r2(config)#router ospf 100
r2(config-router)#network 192.168.7.2 0.0.0 .0 area 0
r2(config-router)#network 192.168.8.1 0.0.0 .0 area 0
R3
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#host r3
r3(config)#int s0/1
r3(config-if)#ip addr 192.168.8.2 255.255.255.0
r3(config-if)#no shut
r3(config-if)#exit
r3(config)#int e1/0
r3(config-if)#ip addr 192.168.9.1 255.255.255.0
r3(config-if)#no shut
r3(config-if)#exit
r3(config)#router ospf 100
r3(config-router)#network 192.168.8.2 0.0.0 .0 area 0
r3(config-router)#network 192.168.9.1 0.0.0 .0 area 0
PC
机的配置
VPCS 1 >ip 192.168.6.1 192.168.6.2
PC1 : 192.168.6.1 255.255.255.0 gateway 192.168.6.2
VPCS 1 >2
VPCS 2 >ip 192.168.9.2 192.168.9.1
PC2 : 192.168.9.2 255.255.255.0 gateway 192.168.9.1
如下是
PC1
和
PC2
相互
ping
的结果,结果表明,全网全通
VPCS 2 >ping 192.168.6.1
192.168.6.1 icmp_seq=1 timeout
192.168.6.1 icmp_seq=2 time=157.000 ms
192.168.6.1 icmp_seq=3 time=297.000 ms
192.168.6.1 icmp_seq=4 time=172.000 ms
192.168.6.1 icmp_seq=5 time=172.000 ms
VPCS 2 >ping 192.168.9.2
192.168.9.2 icmp_seq=1 time =157.000 ms
192.168.9.2 icmp_seq=2 time=157.000 ms
192.168.9.2 icmp_seq=3 time=297.000 ms
192.168.9.2 icmp_seq=4 time=172.000 ms
192.168.9.2 icmp_seq=5 time=172.000 ms
下面是分别在
R1 R2 R3
上
show ip route
查看的路由协议,结果表明路由器间是通过
OSPF
协议实现全网全通的。
R1
r1#show ip protocols
Routing Protocol is "ospf 100"
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Router ID 192.168.7.1
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
Maximum path: 4
Routing for Networks:
192.168.6.2 0.0.0 .0 area 0
192.168.7.1 0.0.0 .0 area 0
Reference bandwidth unit is 100 mbps
Routing Information Sources:
Gateway Distance Last Update
192.168.9.1 110 00:04:49
192.168.8.1 110 00:04:49
Distance: (default is 110)
R2
r2>show ip protocols
Routing Protocol is "ospf 100"
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Router ID 192.168.8.1
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
Maximum path: 4
Routing for Networks:
192.168.7.2 0.0.0 .0 area 0
192.168.8.1 0.0.0 .0 area 0
Reference bandwidth unit is 100 mbps
Routing Information Sources:
Gateway Distance Last Update
192.168.9.1 110 00:05:23
192.168.7.1 110 00:05:23
Distance: (default is 110)
R3
r3#show ip protocols
Routing Protocol is "ospf 100"
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Router ID 192.168.9.1
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
Maximum path: 4
Routing for Networks:
192.168.8.2 0.0.0 .0 area 0
192.168.9.1 0.0.0 .0 area 0
Reference bandwidth unit is 100 mbps
Routing Information Sources:
Gateway Distance Last Update
192.168.8.1 110 00:06:20
192.168.7.1 110 00:06:20
Distance: (default is 110)
OK 试验成功告终!!!
下面内容查看
OSPF
配置
Router#show ip protocols
查看启用的路由协议
Router#show ip route
查看路由表
Router#show ip ospf interface
查看区域号和与此相关的信息
Router#show ip ospf neighbor
查看在每一个接口上的邻居信息