静态路由

独自空忆成欢 提交于 2019-11-27 13:13:02

实验目的:使用静态路由进行路由选择配置。

预配置

第一步 R1的配置

R1(config)#interface loopback 0

R1(config-if)#ip address 1.1.1.1 255.255.255.0

R1(config-if)#exit

R1(config)#interface serial1/2

R1(config-if)#no shutdown

R1(config-if)#ip address 192.168.0.1 255.255.255.0

R1(config-if)#exit

R1(config)#interface serial1/3

R1(config-if)#no shutdown

R1(config-if)#ip address 172.16.0.1 255.255.255.0

R1(config-if)#exit

第二步 R2的配置

R2(config)#interface loopback 0

R2(config-if)#ip address 2.2.2.2 255.255.255.0

R2(config-if)#exit

R2(config)#interface serial2/1

R2(config-if)#no shutdown

00:17:02: %LINK-3-UPDOWN: Interface Serial2/1, changed state to up

00:17:03: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial2/1, changed state to up

R2(config-if)#ip address 192.168.0.2 255.255.255.0

R2(config-if)#interface serial2/3

R2(config-if)#no shutdown

00:17:36: %LINK-3-UPDOWN: Interface Serial2/3, changed state to up

00:17:37: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial2/3, changed state to up

R2(config-if)#ip address 10.0.0.2 255.255.255.0

00:18:02: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial2/3, changed state to down

R2(config-if)#exit

第三步 R3的配置

R3(config)#interface loopback0

R3(config-if)#ip address 3.3.3.3 255.255.255.0

R3(config-if)#interface serial3/1

R3(config-if)#no shutdown

00:21:08: %LINK-3-UPDOWN: Interface Serial3/1, changed state to up

00:21:09: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial3/1, changed state to up

R3(config-if)#ip address 172.16.0.3 255.255.255.0

R3(config-if)#interface serial3/2

R3(config-if)#no shutdown

00:21:51: %LINK-3-UPDOWN: Interface Serial3/2, changed state to up

00:21:52: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial3/2, changed state to up

R3(config-if)#ip address 10.0.0.3 255.255.255.0

R3(config-if)#exit

配置过程

第一步  R1上加入R2-R3的网段的路由10.0.0.0

R1#show ip route

Codes: C - connected, S - static, I - IGRP, 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, E - EGP

       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default

       U - per-user static route, o - ODR

       T - traffic engineered route

 

Gateway of last resort is not set

 

     1.0.0.0/24 is subnetted, 1 subnets

C       1.1.1.0 is directly connected, Loopback0

     172.16.0.0/24 is subnetted, 1 subnets

C       172.16.0.0 is directly connected, Serial1/3

C    192.168.0.0/24 is directly connected, Serial1/2

现在R1上还没有R2-R3的路由

配置

R1(config)#ip route 10.0.0.0 255.255.255.0 192.168.0.2

R1(config)#^Z

R1#show ip route

Codes: C - connected, S - static, I - IGRP, 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, E - EGP

       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default

       U - per-user static route, o - ODR

       T - traffic engineered route

 

Gateway of last resort is not set

 

     1.0.0.0/24 is subnetted, 1 subnets

C       1.1.1.0 is directly connected, Loopback0

     172.16.0.0/24 is subnetted, 1 subnets

C       172.16.0.0 is directly connected, Serial1/3

     10.0.0.0/24 is subnetted, 1 subnets

S       10.0.0.0 [1/0] via 192.168.0.2

C    192.168.0.0/24 is directly connected, Serial1/2

现在看到一条路由 S  10.0.0.0 网段,下一跳地址192.168.0.2

第二步  加入路由后在R1ping 10.0.0.3

R1ping 10.0.0.3

R1#ping 10.0.0.3

 

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 10.0.0.3, timeout is 2 seconds:

.....

Success rate is 0 percent (0/5)

R1Ping不成功

为什么没ping成功??debug看一下

R1#debug ip icmp

ICMP packet debugging is on

打开debug ip icmp 可以查看router经过的所有icmp协议的包显示出来。

发现没有从R3上回来的包 所以ping不成功。

第三步 根据现在配置,去R3上进行调试

R3#debug ip icmp

ICMP packet debugging is on

再回到R1ping 10.0.0.3

R3上看到

R3#

00:45:25: ICMP: echo reply sent, src 10.0.0.3, dst 192.168.0.1

R3#

00:45:27: ICMP: echo reply sent, src 10.0.0.3, dst 192.168.0.1

R3#

00:45:29: ICMP: echo reply sent, src 10.0.0.3, dst 192.168.0.1

R3#

00:45:31: ICMP: echo reply sent, src 10.0.0.3, dst 192.168.0.1

R3#

00:45:33: ICMP: echo reply sent, src 10.0.0.3, dst 192.168.0.1

发现R3不仅收到R1icmp echo包,而且还向192.168.0.1发出了icmp echo reply

R3#show ip route

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!