如上的拓扑所示,(IP地址是我自己确定的,并且用ps写上的,这样看得比较清楚),现在需要完成的就是让HostA能和HostB互相ping通,我在配置过程中遇到了一些问题,我都把容易出错的地方注释在下面的配置语句后面了,希望那些跟我一样在网络配置方面还处于初步的朋友一些帮助,还希望高手们不要见笑,并且给我多加指教,先谢谢了,好了,看我的具体配置如下:
router1的配置:
Press Enter to Start
Router>
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname router1
router1(config)#interface e0
router1(config-if)#ip address 192.168.1.2 255.255.255.0
router1(config-if)#no shut
%LINK-3-UPDOWN: Interface Ethernet0, changed state to up
router1(config-if)#interface s0
router1(config-if)#ip address 192.168.2.1 255.255.255.0
router1(config-if)#clock rate 6400 //clock rate是dce设备给dte设备提供时钟频率的,需要在dce里面设置,而另外的一个路由器里面则不用设置
router1(config-if)#no shut
%LINK-3-UPDOWN: Interface Serial0, changed state to up
router1(config-if)#end
%LINK-3-UPDOWN: Interface Serial0, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0, changed state to down
router1#config t
Enter configuration commands, one per line. End with CNTL/Z.
router1(config)#ip route 192.168.3.0 255.255.255.0 192.168.2.1 //设定静态路由
router1(config)#ip route 192.168.2.0 255.255.255.0 192.168.2.1
router1(config)#end
router1#copy running startup
Destination filename [startup-config]?
Building configuration...
[OK]
%LINK-3-UPDOWN: Interface Serial0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0, changed state to up
router2的配置:
Press Enter to Start
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#interface e0
Router(config-if)#end
Router#config t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname router2
router2(config)#interface s0
router2(config-if)#ip address 192.168.2.2 255.255.255.0
router2(config-if)#no shut
%LINK-3-UPDOWN: Interface Serial0, changed state to up
router2(config-if)#interface s0
router2(config-if)#interface e0
router2(config-if)#ip address 192.168.3.1 255.255.255.0
router2(config-if)#no shut
%LINK-3-UPDOWN: Interface Ethernet0, changed state to up
router2(config-if)#end
router2#config t
Enter configuration commands, one per line. End with CNTL/Z.
router2(config)#ip route 192.168.1.0 255.255.255.0 192.168.2.2
router2(config)#ip route 192.168.2.0 255.255.255.0 192.168.2.2
router2(config)#end
router2#copy running startup
Destination filename [startup-config]?
Building configuration...
[OK]
router2#ping 192.168.1.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms
router2#ping 192.168.2.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms
router2#ping 192.168.2.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms //路由器之间试ping了一下,可以ping通,接下来配pc
pc1的配置如下:
Boson BOSS 5.0
Copyright 1998-2003 Boson Software, Inc.
Use the command help to get started
Press Enter to begin
C:>ipconfig /ip 192.168.1.1 255.255.255.0 //此时尚未指定网关
C:>ping 192.168.2.1
Pinging 192.168.2.1 with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Ping statistics for 192.168.2.1:
Packets: Sent = 5, Received = 0, Lost = 5 (100% loss), //未指定网关时不能ping通router1的s0,我理解为找不到出口,不知准确否
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
C:>ipconfig /dg 192.168.1.2 //指定网关为与本机直连的router1的e0口
C:>ping 192.168.1.2
Pinging 192.168.1.2 with 32 bytes of data:
Reply from 192.168.1.2: bytes=32 time=60ms TTL=241
Reply from 192.168.1.2: bytes=32 time=60ms TTL=241
Reply from 192.168.1.2: bytes=32 time=60ms TTL=241
Reply from 192.168.1.2: bytes=32 time=60ms TTL=241
Reply from 192.168.1.2: bytes=32 time=60ms TTL=241
Ping statistics for 192.168.1.2: Packets: Sent = 5, Received = 5, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 50ms, Maximum = 60ms, Average = 55ms
C:>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=241
Reply from 192.168.2.1: bytes=32 time=60ms TTL=241
Reply from 192.168.2.1: bytes=32 time=60ms TTL=241
Reply from 192.168.2.1: bytes=32 time=60ms TTL=241
Reply from 192.168.2.1: bytes=32 time=60ms TTL=241
Ping statistics for 192.168.2.1: Packets: Sent = 5, Received = 5, Lost = 0 (0% loss), //指定网关后可以ping通s0口了
Approximate round trip times in milli-seconds:
Minimum = 50ms, Maximum = 60ms, Average = 55ms
C:>ping 192.168.2.2
Pinging 192.168.2.2 with 32 bytes of data:
Reply from 192.168.2.2: bytes=32 time=60ms TTL=241
Reply from 192.168.2.2: bytes=32 time=60ms TTL=241
Reply from 192.168.2.2: bytes=32 time=60ms TTL=241
Reply from 192.168.2.2: bytes=32 time=60ms TTL=241
Reply from 192.168.2.2: bytes=32 time=60ms TTL=241
Ping statistics for 192.168.2.2: Packets: Sent = 5, Received = 5, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 50ms, Maximum = 60ms, Average = 55ms
C:>ping 192.168.3.1
Pinging 192.168.3.1 with 32 bytes of data:
Reply from 192.168.3.1: bytes=32 time=60ms TTL=241
Reply from 192.168.3.1: bytes=32 time=60ms TTL=241
Reply from 192.168.3.1: bytes=32 time=60ms TTL=241
Reply from 192.168.3.1: bytes=32 time=60ms TTL=241
Reply from 192.168.3.1: bytes=32 time=60ms TTL=241
Ping statistics for 192.168.3.1: Packets: Sent = 5, Received = 5, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 50ms, Maximum = 60ms, Average = 55ms
C:>ping 192.168.3.2
Pinging 192.168.3.2 with 32 bytes of data:
Reply from 192.168.3.2: bytes=32 time=60ms TTL=241
Reply from 192.168.3.2: bytes=32 time=60ms TTL=241
Reply from 192.168.3.2: bytes=32 time=60ms TTL=241
Reply from 192.168.3.2: bytes=32 time=60ms TTL=241
Reply from 192.168.3.2: bytes=32 time=60ms TTL=241
Ping statistics for 192.168.3.2: Packets: Sent = 5, Received = 5, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 50ms, Maximum = 60ms, Average = 55ms //可以ping通任意一台设备的IP地址,实验成功
C:>
pc2 的配置如下:
Boson BOSS 5.0
Copyright 1998-2003 Boson Software, Inc.
Use the command help to get started
Press Enter to begin
C:>
C:>ipconfig /ip 192.168.3.2 255.255.255.0
C:>ipconfig /dg 192.168.3.1 //把IP和网关设好
C:>ping 192.168.1.1
Pinging 192.168.1.1 with 32 bytes of data:
Reply from 192.168.1.1: bytes=32 time=60ms TTL=241
Reply from 192.168.1.1: bytes=32 time=60ms TTL=241
Reply from 192.168.1.1: bytes=32 time=60ms TTL=241
Reply from 192.168.1.1: bytes=32 time=60ms TTL=241
Reply from 192.168.1.1: bytes=32 time=60ms TTL=241
Ping statistics for 192.168.1.1: Packets: Sent = 5, Received = 5, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 50ms, Maximum = 60ms, Average = 55ms
C:>ping 192.168.1.2
Pinging 192.168.1.2 with 32 bytes of data:
Reply from 192.168.1.2: bytes=32 time=60ms TTL=241
Reply from 192.168.1.2: bytes=32 time=60ms TTL=241
Reply from 192.168.1.2: bytes=32 time=60ms TTL=241
Reply from 192.168.1.2: bytes=32 time=60ms TTL=241
Reply from 192.168.1.2: bytes=32 time=60ms TTL=241
Ping statistics for 192.168.1.2: Packets: Sent = 5, Received = 5, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 50ms, Maximum = 60ms, Average = 55ms
C:>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=241
Reply from 192.168.2.1: bytes=32 time=60ms TTL=241
Reply from 192.168.2.1: bytes=32 time=60ms TTL=241
Reply from 192.168.2.1: bytes=32 time=60ms TTL=241
Reply from 192.168.2.1: bytes=32 time=60ms TTL=241
Ping statistics for 192.168.2.1: Packets: Sent = 5, Received = 5, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 50ms, Maximum = 60ms, Average = 55ms
C:>ping 192.168.2.2
Pinging 192.168.2.2 with 32 bytes of data:
Reply from 192.168.2.2: bytes=32 time=60ms TTL=241
Reply from 192.168.2.2: bytes=32 time=60ms TTL=241
Reply from 192.168.2.2: bytes=32 time=60ms TTL=241
Reply from 192.168.2.2: bytes=32 time=60ms TTL=241
Reply from 192.168.2.2: bytes=32 time=60ms TTL=241
Ping statistics for 192.168.2.2: Packets: Sent = 5, Received = 5, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 50ms, Maximum = 60ms, Average = 55ms
C:>ping 192.168.3.1
Pinging 192.168.3.1 with 32 bytes of data:
Reply from 192.168.3.1: bytes=32 time=60ms TTL=241
Reply from 192.168.3.1: bytes=32 time=60ms TTL=241
Reply from 192.168.3.1: bytes=32 time=60ms TTL=241
Reply from 192.168.3.1: bytes=32 time=60ms TTL=241
Reply from 192.168.3.1: bytes=32 time=60ms TTL=241
Ping statistics for 192.168.3.1: Packets: Sent = 5, Received = 5, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 50ms, Maximum = 60ms, Average = 55ms //可以ping通任意一台设备的IP地址,实验成功