多语言展示
当前在线:1231今日阅读:168今日分享:49

静态路由设置实例

本实例通过静态路由设置的实验帮助读者深入地体会路由的概念,并切实掌握静态路由的设置、查看路由表等常用的命令。通过本实验,读者可以掌握以下技能:1、设置静态路由;2、设置启用路由器的路由功能;3、查看路由表
拓扑结构
1

本实验的拓扑结构如下图所示。

2

3

3台路由器分别命名为R1、R2和R3,所使用的接口和相应的IP地址分配如上图中的标注。图中的"/24"表示子网掩码为24位,即255.255.255.0。   实验中,应使用静态路由的设置。实现R2到R3在IP层的连通性,即要求从R2可以ping通R3,反之亦然。END

工具/原料
1

3台Cisco 808路由器,具有2个以太网接口

2

2台Hub,4条双绞线 (也可以用2条交叉网线直接把3台路由器连接起来)

3

1台带有超级终端程序的PC机,以及Console电缆及转接器。

步骤/方法
1

根据拓扑结构图的要求,正确配置各路由器的以太网接口。路由器R1的接口配置如下:  R1>enable  R1#config terminal  R1(config)#interface ethernet 0/0  R1(config-if)#ip address 10.1.1.1 255.255.255.0  R1(config-if)#no shutdown  R1(config-if)#exit  R1(config)#interface ethernet 0/1  R1(config-if)#ip address 172.16.1.1 255.255.255.0  R1(config-if)#no shutdown  R1(config-if)#end路由器R2的接口配置如下:  R2>enable  R2#config terminal  R2(config)#interface ethernet 0/0  R2(config-if)#ip address 10.1.1.2 255.255.255.0  R2(config-if)#no shutdown  R2(config-if)#end路由器R3的接口配置如下:   R3>enable  R3#config terminal  R3(config)#interface ethernet 0/0  R3(config-if)#ip address 172.16.1.3 255.255.255.0  R3(config-if)#no shutdown  R3(config-if)#end

2

测试自身连通性R1#ping 10.1.1.1Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.1.1.1, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 msR1#ping 172.16.1.1Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 172.16.1.1, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 msR2#ping 10.1.1.2Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.1.1.2, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 msR3#ping 172.16.1.3Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 172.16.1.3, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms

3

设置路由前测试网络连通性R2#ping 172.16.1.3Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 172.16.1.3, timeout is 2 seconds: !!!!! Success rate is 0 percent (0/5)R3#ping 10.1.1.2Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.1.1.2, timeout is 2 seconds: !!!!! Success rate is 0 percent (0/5)

4

检查路由表R1#show ip route Gateway of last resort is not setrout C 10.1.1.0/24 is directly connected, 10.1.1.1 C 172.16.1.0/24 is directly connected, 172.16.1.1R2#show ip route Gateway of last resort is not set C 10.1.1.0/24 is directly connected, 10.1.1.2R3#show ip route Gateway of last resort is not set C 172.16.1.0/24 is directly connected, 172.16.1.3

5

加入静态路由并测试连通性R2#config terminalR2(config)#ip route 172.16.1.0 255.255.255.0 10.1.1.1R2(config)#endR2#show ip route       C10.1.1.0/24 is directly connected, 10.1.1.2 S  172.16.1.0/24 [1/0] via 10.1.1.1R2#ping 172.16.1.1Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 172.16.1.1, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 msR2#ping 172.16.1.3Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 172.16.1.3, timeout is 2 seconds: !!!!! Success rate is 0 percent (0/5)R3#config terminalR3(config)#ip route 10.1.1.0 255.255.255.0 172.16.1.1R3(config)#endR3#show ip route       C172.16.1.0/24 is directly connected, 172.16.1.3 S  10.1.1.0/24 [1/0] via 172.16.1.1R3#ping 10.1.1.1

6

Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.1.1.1, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms

7

R3#ping 10.1.1.2

8

Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.1.1.2, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms

9

R1#show ip route

10

C 10.1.1.0/24 is directly connected, 10.1.1.1 C 172.16.1.0/24 is directly connected, 172.16.1.1

注意事项

不具备实训条件可以使用RouterSim软件模拟

推荐信息