赞
踩
要求:
配置静态路由,实现全网互通。
基础配置:
1. 设置路由器R1和R2的IP地址;
2. 为PC1—PC3设置IP地址,并将网关指为R1的F0/0的地址1.251,将PC4的网关设为3.1。
静态路由的配置:
1. 在配置静态前,查看R1的路由表,显示如下:
r1#sh ip route
C 192.168.1.0/24 is directly connected, FastEthernet0/0
C 192.168.2.0/24 is directly connected, Serial1/0
第一次在PC1上测试,结果如下:
PC>ping 192.168.3.2
Reply from 192.168.1.251: Destination host unreachable.
Reply from 192.168.1.251: Destination host unreachable.
......
说明R1不知道前往3.0的路由,将数据包丢弃。
2. 为R1配置如下静态路由:
r1(config)#ip route 192.168.3.0 255.255.255.0 192.168.2.2
配置后,再次查看路由表,显示如下:
r1#sh ip route
C 192.168.1.0/24 is directly connected, FastEthernet0/0
C 192.168.2.0/24 is directly connected, Serial1/0
S 192.168.3.0/24 [1/0] via 192.168.2.2
再次在PC1上测试,则显示结果为:
PC>ping 192.168.3.2
Request timed out.
Request timed out.
......
说明R1知道去3.0的路由,将数据包发去出了,但没有收到回应的包。
3. 在R2上配置如下静态路由:
r2(config)#ip route 192.168.1.0 255.255.255.0 192.168.2.1
再次在PC1上测试,显示结果如下:
PC>ping 192.168.3.2
Reply from 192.168.3.2: bytes=32 time=125ms TTL=126
Reply from 192.168.3.2: bytes=32 time=109ms TTL=126
终于,PC1可以通过R1和R2,来访问PC2了。
总结:
1. 当路由器路由表中没有路由条目时,对前往该目的地的数据包的是丢弃的。
2. 数据通信是双向的,R1要知道目标3.0怎么走,同样,R2也要知道该如何把数据包回送给R1。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。