设置静态路由命令
注意:在设置缺省路由的时候需要考虑,路由回环的问题。路由间链接要设置时钟频率为64000
静态路由里的下一跳是出去路由后的第一个IP地址。
静态配置命令
全局模式
Ip route目标网络目标网络子网掩码下一跳IP地址
R4配置
r4(config)#int s0/0
r4(config-if)#no shutdown
%LINK-5-CHANGED: Interface Serial0/0, changed state to down
r4(config-if)#ip address 10.65.1.2 255.255.255.0
r4(config)#int s0/1
r4(config-if)#ip address 10.65.2.2 255.255.255.0
配置静态路由
r4(config)#ip route 192.168.1.0 255.255.255.0 10.65.2.1
r4(config)#ip route 192.168.2.0 255.255.255.0 10.65.1.1
设置时钟频率(有时钟端)
r4(config)#int s0/1
r4(config-if)#clock rate 64000
R5设置
r5(config)#int s0/0
r5(config-if)#no shutdown
%LINK-5-CHANGED: Interface Serial0/0, changed state to down
r5(config-if)#ip address 10.65.1.2 255.255.255.0
r5(config)#int f0/1
r5(config-if)#ip address 10.65.2.2 255.255.255.0
配置静态路由
r5(config)#ip route 192.168.1.0 255.255.255.0 10.65.1.2
r5(config)#ip route 10.65.2.0 255.255.255.0 10.65.1.2
设置时钟频率(有时钟端)
r5(config)#int s0/1
r5(config-if)#clock rate 64000
R6设置
r6(config)#int s0/0
r6(config-if)#no shutdown
%LINK-5-CHANGED: Interface Serial0/0, changed state to down
r6(config-if)#ip address 10.65.1.2 255.255.255.0
r6(config)#int f0/1
r6(config-if)#ip address 10.65.2.2 255.255.255.0
配置静态路由
r6(config)#ip route 192.168.2.0 255.255.255.0 10.65.2.2
r6(config)#ip route 10.65.1.0 255.255.255.0 10.65.2.2
设置时钟频率(有时钟端)
r6(config)#int s0/1
r6(config-if)#clock rate 64000
R4
查看路由表命令
特权模式下show ip route
路由表
Gateway of last resort is not set
10.0.0.0/24 is subnetted, 2 subnets
C 10.65.1.0 is directly connected, Serial0/0
C 10.65.2.0 is directly connected, Serial0/1
S 192.168.1.0/24 [1/0] via 10.65.2.1
S 192.168.2.0/24 [1/0] via 10.65.1.1
R5路由表
C 10.65.1.0 is directly connected, Serial0/0
S 10.65.2.0 [1/0] via 10.65.1.2
S 192.168.1.0/24 [1/0] via 10.65.1.2
C 192.168.2.0/24 is directly connected, FastEthernet0/0
R6路由表
S 10.65.1.0 [1/0] via 10.65.2.2
C 10.65.2.0 is directly connected, Serial0/1
C 192.168.1.0/24 is directly connected, FastEthernet0/0
S 192.168.2.0/24 [1/0] via 10.65.2.2
测试
PC1>>PC0
PC>ping 192.168.2.1
Pinging 192.168.2.1 with 32 bytes of data:
Reply from 192.168.2.1: bytes=32 time=60ms TTL=253
Reply from 192.168.2.1: bytes=32 time=93ms TTL=253
Reply from 192.168.2.1: bytes=32 time=50ms TTL=253
Reply from 192.168.2.1: bytes=32 time=60ms TTL=253
Ping statistics for 192.168.2.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 50ms, Maximum = 93ms, Average = 65ms
PC0>>PC1
PC>ping 192.168.1.2
Pinging 192.168.1.2 with 32 bytes of data:
Request timed out.
Reply from 192.168.1.2: bytes=32 time=80ms TTL=125
Reply from 192.168.1.2: bytes=32 time=80ms TTL=125
Reply from 192.168.1.2: bytes=32 time=80ms TTL=125
Ping statistics for 192.168.1.2:
Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
Approximate round trip times in milli-seconds:
Minimum = 80ms, Maximum = 80ms, Average = 80ms
BY 小福仔