实验调试 (1) 在R1、R2、R3 上查看路由表 R1#show ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route Gateway of last resort is not set C 192.168.12.0/24 is directly connected, Serial0/0/0 1.0.0.0/24 is subnetted, 1 subnets C 1.1.1.0 is directly connected, Loopback0 2.0.0.0/24 is subnetted, 1 subnets S 2.2.2.0 is directly connected, Serial0/0/0 3.0.0.0/24 is subnetted, 1 subnets S 3.3.3.0 [1/0] via 192.168.12.2 R2#show ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route Gateway of last resort is not set C 192.168.12.0/24 is directly connected, Serial0/0/0 1.0.0.0/24 is subnetted, 1 subnets S 1.1.1.0 is directly connected, Serial0/0/0 2.0.0.0/24 is subnetted, 1 subnets C 2.2.2.0 is directly connected, Loopback0 3.0.0.0/24 is subnetted, 1 subnets S 3.3.3.0 is directly connected, Serial0/0/1 C 192.168.23.0/24 is directly connected, Serial0/0/1 R3#show ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route Gateway of last resort is not set 1.0.0.0/24 is subnetted, 1 subnets S 1.1.1.0 is directly connected, Serial0/0/1 2.0.0.0/24 is subnetted, 1 subnets S 2.2.2.0 is directly connected, Serial0/0/1 3.0.0.0/24 is subnetted, 1 subnets C 3.3.3.0 is directly connected, Loopback0 C 192.168.23.0/24 is directly connected, Serial0/0/1 (2) 从各路由器的环回口ping 其他路由器的环回口: R1#ping //不带任何参数的ping 命令,允许我们输入更多的参数 Protocol [ip]: Target IP address: 2.2.2.2 //目标IP 地址 Repeat count [5]: //发送的ping 次数 Datagram size [100]: //ping 包的大小 Timeout in seconds [2]: //超时时间 Extended commands [n]: y //是否进一步扩展命令 Source address or interface: 1.1.1.1 //源IP 地址 Type of service [0]: Set DF bit in IP header? [no]: Validate reply data? [no]: Data pattern [0xABCD]: Loose, Strict, Record, Timestamp, Verbose[none]: Sweep range of sizes [n]: Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds: Packet sent with a source address of 1.1.1.1 !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 12/14/16 ms //以上说明从R1 的loopback0 可以ping 通R2 上的loopback0。也可以直接使用命令: R1#ping 2.2.2.2 source loopback 0 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds: Packet sent with a source address of 1.1.1.1 !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 12/14/16 ms R2#ping 1.1.1.1 source loopback 0 R2#ping 3.3.3.3 source loopback 0 //从R2 的loopback0 应该可以ping 通R1 和R3 的lopback0 接口。 R3#ping 1.1.1.1 source loopback 0 R3#ping 2.2.2.2 source loopback 0 //从R3 的loopback0 也应该可以ping 通R1 和R2 的lopback0 接口。 【提示】虽然从R1 的loopback0 可以ping 通R3 的loopback0,数据需要经过 192.168.23.0/24 网络,但是在R1 上我们并没有添加192.168.23.0/24 的路由。路由器转 发数据包完成是根据路由表的,并且数据是一跳一跳地被转发的,就像接力赛似的。从R1 的loopback0 口ping R3 的loopback0 口时,IP 数据包的源IP 为1.1.1.1,目的IP 为3.3.3.3。 R1 路由器首先查路由表,数据包被发到了R2;R2 路由器也查路由表(3.3.3.0/24 路由), 数据包被发到了R3;R3 知道这是直连路由。R3 响应R1 的数据包进行类似的过程。 (3) 从R1 上ping 2.2.2.2、从R1 上ping 3.3.3.3 R1#ping 2.2.2.2 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 12/14/16 ms //可以ping 通。 R1#ping 3.3.3.3 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds: ..... Success rate is 0 percent (0/5) //以上无法ping 通,原因在于使用ping 命令时,如果不指明源接口,则R1 路由器使用s0/0/0 接口的IP 地址(192.168.12.1)作为IP 数据包的源IP 地址了。R3 上响应R1 的数据包时, 数据包是发向192.168.12.1 的,然而由于R3 没有192.168.12.0/24 的路由,数据包无法发 送。即:数据包从R1 到了R3 后,无法返回R1。