您的位置首页百科知识

静态路由设置实例

静态路由设置实例

的有关信息介绍如下:

静态路由设置实例

本实例通过静态路由设置的实验帮助读者深入地体会路由的概念,并切实掌握静态路由的设置、查看路由表等常用的命令。

通过本实验,读者可以掌握以下技能:

1、设置静态路由;2、设置启用路由器的路由功能;3、查看路由表

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

根据拓扑结构图的要求,正确配置各路由器的以太网接口。

路由器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>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

测试自身连通性

R1#ping 10.1.1.1

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

R1#ping 172.16.1.1

Type 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 ms

R2#ping 10.1.1.2

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

R3#ping 172.16.1.3

Type 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

设置路由前测试网络连通性

R2#ping 172.16.1.3

Type 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.2

Type 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)

检查路由表

R1#show ip routeGateway of last resort is not setroutC 10.1.1.0/24 is directly connected, 10.1.1.1C 172.16.1.0/24 is directly connected, 172.16.1.1

R2#show ip routeGateway of last resort is not setC 10.1.1.0/24 is directly connected, 10.1.1.2

R3#show ip routeGateway of last resort is not setC 172.16.1.0/24 is directly connected, 172.16.1.3

加入静态路由并测试连通性

R2#config terminal

R2(config)#ip route 172.16.1.0 255.255.255.0 10.1.1.1

R2(config)#end

R2#show ip route     C10.1.1.0/24 is directly connected, 10.1.1.2S  172.16.1.0/24 [1/0] via 10.1.1.1

R2#ping 172.16.1.1

Type 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 ms

R2#ping 172.16.1.3

Type 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 terminal

R3(config)#ip route 10.1.1.0 255.255.255.0 172.16.1.1

R3(config)#end

R3#show ip route     C172.16.1.0/24 is directly connected, 172.16.1.3S  10.1.1.0/24 [1/0] via 172.16.1.1

R3#ping 10.1.1.1

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

R3#ping 10.1.1.2

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

R1#show ip route

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

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