实验目的:
1. 实现全网的互通。
2. 通过更改优先级,实现不同路由之间的转换。
实验拓扑图:
参数配置表:
路由信息
主机名
类型
IP地址
子网掩码
时钟频率
Router 0
2811
Se1/0:20.0.0.1
255.255.255.0
64000
Router 1
2811
Fa0/0:30.0.0.1
Se1/0:20.0.0.1
Se1/1:40.0.0.1
255.255.255.0
255.255.255.0
255.255.255.0
64000
Router 2
2811
Fa0/0:50.0.0.2
Se1/1:40.0.0.2
255.255.255.0
255.255.255.0
64000
PC信息
IP地址
子网掩码
时钟频率
PC0
10.0.1.1
255.255.255.0
64000
PC1
10.0.2.1
255.255.255.0
64000
PC2
50.0.0.1
255.255.255.0
64000
实验步骤:
1.开启端口
Router0:
Router>enable
Router#config terminal
Router(config)#hostname R0
R0(config)#interface f0/1
R0(config-if)#ip address 10.0.2.254 255.255.255.0
R0(config-if)#no shutdown
R0(config-if)#exit
R0(config)#interface f0/1
R0(confif-if)#ip address 10.0.1.254 255.255.255.0
R0(config-if)#no shutdown
R0(config-if)#exit
R0(config)#interface S0/1
R0(confif-if)#ip address 20.0.0.254 255.255.255.0
R0(confif-if)#no shutdown
Router1:
Router>enable
Router#config terminal
Router(config)#hostname R1
R1(config)#interface f0/0
R1(config-if)#ip address 30.0.0.254 255.255.255.0
R1(config-if)#exit
R1(config)#interface s1/0
R2(config-if)#ip address 20.0.0.2 255.255.255.0
R1(config-if)#no shutdown
R2(config-if)#exit
R2(config)#interface s1/1
R2(config-if)#ip address 40.0.0.1 255.255.255.0
R2(config-if)#no shutdown
Router2:
Router>enable
Router#config terminal
Router(config)#hostname R2
R2(config)#interface f0/0
R2(config-if)#ip address 50.0.0.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#exit
R2(config)#interface s1/1
R2(config-if)#ip address 40.0.0.2 255.255.255.0
R2(config-if)#no shutdown
2. 配置时钟频率及OSPF路由配置:
R0:
R0(config)#interface s1/0
R0(config-if)#clock rate 64000
R0(config-if)#extit
R0(config)#router ospf 100
R0(config-router)#network 10.0.1.0 0.0.0.255 area 1
R0(config-router)#network 10.0.2.0 0.0.0.255 area 1
R0(config-router)#network 20.0.0.0 0.0.0.255 area 1
R1:
R1(config)#interface s1/0
R1(config-if)#clock rate 64000
R1(config-if)#extit
R1(config)#interface s1/1
R1(config-if)#clock rate 64000
R1(config-if)#exit
R1(config)#router ospf 200
R1(config-router)#network 30.0.0.0 0.0.0.255 area 2
R1(config-router)#network 40.0.0.0 0.0.0.255 area 3
R1(config-router)#network 20.0.0.0 0.0.0.255 area 1
R1(config-router)#network 50.0.0.0 0.0.0.255 area 3
R2:
R2(config)#interface s0/0
R2(config-if)#clock rate 64000
R2(config-if)#extit
R2(config)#interface s1/1
R2(config-if)#clock rate 64000
R2(config-if)#exit
R2(config)#router ospf 300
R2(config-router)#network 40.0.0.0 0.0.0.255 area 3
R2(config-router)#network 50.0.0.0 0.0.0.255 area 3
R2(config-router)#end
R2#show ip route
3. 实验结果:
PC>ping 30.0.0.1
Pinging 30.0.0.1 with 32 bytes of data:
Request timed out.
Reply from 30.0.0.1: bytes=32 time=22ms TTL=125
Reply from 30.0.0.1: bytes=32 time=2ms TTL=125
Reply from 30.0.0.1: bytes=32 time=3ms TTL=125
Ping statistics for 50.0.0.1:
Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
Approximate round trip times in milli-seconds:
Minimum = 2ms, Maximum = 22ms, Average = 9ms
4.个人总结:
1. 首先ospf进程号两边要相同;
2. 两边接口的地址要在同一网段;
3. 宣告网段时要注意带反掩码进行匹配,后面跟上区域号;
4. 其次ospf区域要注意划对