ROS软路由论坛 ROSABC.com 网络方案网络工程交流

 找回密码
 会员注册

QQ登录

只需一步,快速开始

静态路由实验:pc0和pc1的数据按照预定线路到达对方

2014-8-1 23:11| 发布者: admin| 查看: 549| 评论: 0

摘要: 这次静态路由实验的拓扑图如下,三台router0、1、2和两台PC0、1组成一个金字塔形状的网络: 实验的要求:最终要求PC0发送的数据包经过1线路到达PC1 , PC1发送的数据包经过经过2线路到达pc0。 配置如下: router1 ...

这次静态路由实验的拓扑图如下,三台router0、1、2和两台PC0、1组成一个金字塔形状的网络:

实验的要求:最终要求PC0发送的数据包经过1线路到达PC1 , PC1发送的数据包经过经过2线路到达pc0。
配置如下:
router1配置接口ip:
Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#host r1
r1(config)#int f0/0
r1(config-if)#ip  add 192.168.10.1 255.255.255.0
r1(config-if)#no shut
r1(config-if)#int f0/1
r1(config-if)#ip add 192.168.20.1 255.255.255.0
r1(config-if)#no shutdown
r1(config-if)#int f1/0
r1(config-if)#ip add 192.168.40.1 255.255.255.0
r1(config-if)#no shutdown
Router2 配置接口ip:
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#int f0/0


Router(config-if)#ip add 192.168.30.2 255.255.255.0
Router(config-if)#no shut
Router(config-if)#int f1/0
Router(config-if)#ip add 192.168.40.2 255.255.255.0
Router(config-if)#no shut
Router(config-if)#int f0/1
Router(config-if)#ip add 192.168.50.1 255.255.255.0
Router(config-if)#no shut
Router0 配置接口ip:
Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#int f0/0
Router(config-if)#ip add 192.168.20.2 255.255.255.0
Router(config-if)#no shut
Router(config-if)#int f0/1
Router(config-if)#ip add 192.168.30.1 255.255.255.0
Router(config-if)#no shut
Router1 配置静态路由,如下:
r1(config)#ip route 192.168.50.0 255.255.255.0 f0/1
查看路由表,如下图:
r1#sh 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, 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.10.0/24 is directly connected, FastEthernet0/0
C    192.168.20.0/24 is directly connected, FastEthernet0/1
C    192.168.40.0/24 is directly connected, FastEthernet1/0
S    192.168.50.0/24 is directly connected, FastEthernet0/1
Router0有两条直连路由,所以需要添加一条到达 192.168.50.0 的路由,特权模式,如下命令:
r0(config)#ip route 192.168.50.0 255.255.255.0 f0/1

查看路由表,如下:
r0#sh 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, 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.20.0/24 is directly connected, FastEthernet0/0
C    192.168.30.0/24 is directly connected, FastEthernet0/1
S    192.168.50.0/24 is directly connected, FastEthernet0/1
Router2有三条直连路由,只需要添加一条到达192.168.10.0 的静态路由,出站口为f1/0命令如下:
r2(config)#ip route 192.168.10.0 255.255.255.0 f1/0
查看路由表:
r2#sh 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, 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
S    192.168.10.0/24 is directly connected, FastEthernet1/0
C    192.168.30.0/24 is directly connected, FastEthernet0/0
C    192.168.40.0/24 is directly connected, FastEthernet1/0
C    192.168.50.0/24 is directly connected, FastEthernet0/1
客户端测试:pc0可以ping通pc1,如下图:

使用抓包工具,观察经过的路径,首先在路由器中把停止cdp协议的运行,全局配置模式,使用命令: (config)#no cdp run
如下图显示所经过路径:

不良信息举报Q:2000617
新用户7天后可回帖!

软路由

不良信息举报Q:2000617|Archiver|ROS软路由论坛 ROSABC.com 网络方案网络工程交流

GMT+8, 2025-11-7 22:39 , Processed in 0.028816 second(s), 15 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部