如下是在路由器R1 R2 R3 R4 里做出的配置 红色字体为配置内容
R1
Router>en
Router#conf t
Enter configuration commands, .e per line. End with CNTL/Z.
Router(config)#host r1
r1(config)#enable password cisco
r1(config)#line vty 0 4
r1(config-line)#pass cisco
r1(config-line)#login
r1(config-line)#exit
r1(config)#int s0/0
r1(config-if)#ip addr 192.168.1.1 255.255.255.0
r1(config-if)#clock rate 64000
r1(config-if)#no shut
r1(config-if)#exit
*Mar 1 00:05:14.311: %LINK-3-UPDOWN: Interface Serial0/0, changed state to up
*Mar 1 00:05:15.311: %LINEPROTO-5-UPDOWN: Line protocol . Interface Serial0/0,
changed state to up
r1(config)#ip route 192.168.2.0 255.255.255.0 192.168.1.2
r1(config)#
*Mar 1 00:05:43.055: %LINEPROTO-5-UPDOWN: Line protocol . Interface Serial0/0,
changed state to down
r1(config)#ip route 192.168.3.0 255.255.255.0 192.168.1.2
R2
Router>en
Router#conf t
Enter configuration commands, .e per line. End with CNTL/Z.
Router(config)#host r2
r2(config)#enable password cisco
r2(config)#line vty 0 4
r2(config-line)#pass cisco
r2(config-line)#login
r2(config-line)#exit
r2(config)#int s0/0
r2(config-if)#ip addr 192.168.1.2 255.255.255.0
r2(config-if)#no shut
r2(config-if)#
*Mar 1 00:05:21.035: %LINK-3-UPDOWN: Interface Serial0/0, changed state to up
*Mar 1 00:05:22.035: %LINEPROTO-5-UPDOWN: Line protocol . Interface Serial0/0,
changed state to upexit
r2(config)#int s0/1
r2(config-if)#ip addr 192.168.2.1 255.255.255.0
r2(config-if)#clock rate 64000
r2(config-if)#no shut
r2(config-if)#exit
r2(config)#
*Mar 1 00:25:35.283: %LINEPROTO-5-UPDOWN: Line protocol . Interface Serial0/1,
changed state to down%LINEPROTO-5-UPDOWN: Line protocol . Interface Serial0/1,
*Mar 1 00:25:45.267: %LINEPROTO-5-UPDOWN: Line protocol . Interface Serial0/1,
changed state to up: %LINEPROTO-5-UPDOWN: Line protocol . Interface Serial0/1,
changed state to down
r2(config)#ip route 192.168.3.0 255.255.255.0 192.168.2.2
R3
Router>en
Router#conf t
Enter configuration commands, .e per line. End with CNTL/Z.
Router(config)#host r3
r3(config)#enable password cisco
r3(config)#line vty 0 4
r3(config-line)#password cisco
r3(config-line)#login
r3(config-line)#exit
r3(config)#int s0/1
r3(config-if)#ip addr 192.168.2.2 255.255.255.0
r3(config-if)#no shut
r3(config-if)#exit
r3(config)#
*Mar 1 00:03:39.899: %LINK-3-UPDOWN: Interface Serial0/1, changed state to upi
*Mar 1 00:03:40.903: %LINEPROTO-5-UPDOWN: Line protocol . Interface Serial0/1,
changed state to u
r3(config)#int s0/2
r3(config-if)#ip addr 192.168.3.1 255.255.255.0
r3(config-if)#clock rate 64000
r3(config-if)#no shut
r3(config-if)#
*Mar 1 00:04:24.839: %LINK-3-UPDOWN: Interface Serial0/2, changed state to up
*Mar 1 00:04:25.839: %LINEPROTO-5-UPDOWN: Line protocol . Interface Serial0/2,
changed state to up
*Mar 1 00:04:53.839: %LINEPROTO-5-UPDOWN: Line protocol . Interface Serial0/2,
changed state to down
r3(config-if)#exit
r3(config)#ip route 192.168.1.0 255.255.255.0 192.168.2.1
.
R4
Router>en
Router#conf t
Enter configuration commands, .e per line. End with CNTL/Z.
Router(config)#host r4
r4(config)#enable pass cisco
r4(config)#line vty 0 4
r4(config-line)#pass cisco
r4(config-line)#login
r4(config-line)#exit
r4(config)#int s0/2
r4(config-if)#ip addr 192.168.3.2 255.255.255.0
r4(config-if)#no shut
r4(config-if)#
*Mar 1 00:03:04.871: %LINK-3-UPDOWN: Interface Serial0/2, changed state to up
*Mar 1 00:03:05.871: %LINEPROTO-5-UPDOWN: Line protocol . Interface Serial0/2,
changed state to up
r4(config-if)#exit
r4(config)#ip route 192.168.1.0 255.255.255.0 192.168.3.1
r4(config)#ip route 192.168.2.0 255.255.255.0 192.168.3.1
下面是在R1上分别ping R2 R3 R4 的结果,
r1>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 = 52/298/540 ms
r1>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 = 140/218/376 ms
r1>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 = 304/447/644 ms
r1>ping 192.168.3.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.3.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 140/460/804 ms
r1>ping 192.168.3.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.3.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 664/739/936 ms
哈哈 全网全通了!试验宣告成功!!!!!
附:静态路由的删除:
(config)#no ip route 目标网段 目标网段的网络掩码 直连邻居的接口IP地址