实验拓扑

实验步骤

我们要使得 1.1.1.0/24、2.2.2.0/24、3.3.3.0/24 网络之间能够互相通信。

(1)  步骤 1:在各路由器上配置 IP 地址、保证直连链路的连通性

R1(config)#int loopback0

R1(config-if)#ip address 1.1.1.1 255.255.255.0

R1(config)#int s0/0/0

R1(config-if)#ip address 192.168.12.1 255.255.255.0

R1(config-if)#no shutdown

R2(config)#int loopback0

R2(config-if)#ip address 2.2.2.2 255.255.255.0

R2(config)#int s0/0/0

R2(config-if)#clock rate 128000

R2(config-if)#ip address 192.168.12.2 255.255.255.0

R2(config-if)#no shutdown

R2(config)#int s0/0/1

R2(config-if)#clock rate 128000

R2(config-if)#ip address 192.168.23.2 255.255.255.0

R2(config-if)#no shutdown

R3(config)#int loopback0

R3(config-if)#ip address 3.3.3.3 255.255.255.0

R3(config)#int s0/0/1

R3(config-if)#ip address 192.168.23.3 255.255.255.0

R3(config-if)#no shutdown

(2)  步骤 2:R1上配置静态路由

R1(config)#ip route 2.2.2.0 255.255.255.0 s0/0/0

//下一跳为接口形式,s0/0/0 是点对点的链路,注意应该是 R1 上的s0/0/0 接口

R1(config)#ip route 3.3.3.0 255.255.255.0 192.168.12.2

//下一跳为IP 地址形式,192.168.12.2 是R2 上的IP 地址

(3)  步骤 3:R2上配置静态路由

R2(config)#ip route 1.1.1.0 255.255.255.0 s0/0/0

R2(config)#ip route 3.3.3.0 255.255.255.0 s0/0/1

(4)  步骤 4:R3上配置静态路由

R3(config)#ip route 1.1.1.0 255.255.255.0 s0/0/1

R3(config)#ip route 2.2.2.0 255.255.255.0 s0/0/1

实验调试
(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。

Cisco(思科)路由器静态路由的配置的更多相关文章

  1. cisco交换机路由器静态路由配置

    一.切换模式 router>en                           //用户模式enable router#conf t                      //特权模式 ...

  2. 路由器静态IP的配置及其备份静态路由缺省路由

    静态路由时管理员手动配置并维护的路由.静态路由配置简单,被广泛应用于网络中.静态路由还可以实现负载均衡和路由备份.学习掌握好静态路由的配置是很重要的. 如下图, 首先进入路由器的命令视图,(sys) ...

  3. Network基础(五):配置静态路由、配置浮动路由、配置多路由的静态路由、配置默认路由

    一.配置静态路由 目标: 配置路由接口IP地址并通过静态路由的配置实现全网的互通. 方案: 按如下网络拓扑配置接口IP地址并通过静态路由的配置实现全网的互通如下图所示: 步骤: 步骤一:配置静态路由 ...

  4. ubuntu配置网络和静态路由(界面配置形式)

    目录 网卡配置 静态ip配置 静态路由 外网ip配置(动态获取DHCP) 内网ip和静态路由配置 本文主要针对ubuntu18.0系统进行界面形式配置网络.并配置静态路由. 网卡配置 静态ip配置 打 ...

  5. 路由与交换,cisco路由器配置,浮动静态路由

    设置浮动静态路由的目的就是为了防止因为一条线路故障而引起网络故障.言外之意就是说浮动静态路由实际上是主干路由的备份.例如下图: 假如我们设路由器之间的串口(seria)为浮动静态路由(管理距离为100 ...

  6. 路由与交换,cisco路由器配置,静态路由

    网络是一个大型的拓扑结构,在路由表中,最重要的是管理距离和度量值 管理距离 管理距离用来确定路由的优先级.管理距离的范围是0-255之间的整数值.值越低代表优先级越高.0代表最高优先级.并且只有直连路 ...

  7. 路由器基本配置实验,静态路由和动态RIP路由

    实验涉及命令以及知识补充 连线 PC和交换机FastEtherNet接口 交换机和路由器FastEtherNet接口 路由器和路由器Serial接口 serial是串行口,一般用于连接设备,不能连接电 ...

  8. CCNA网络工程师学习进程(7)路由器的路由配置

        前面一节已经介绍了路由器的端口配置,接着我们介绍路由器的路由配置:静态路由.默认路由和浮动路由的配置:动态路由协议的配置,包括RIP.IGRP.EIGRP和OSPF.     (1)路由器的基 ...

  9. ubuntu 配置静态路由

    原文:http://blog.sina.com.cn/s/blog_6fd8d5d90101f1xy.html -------------------------------------------- ...

随机推荐

  1. iOS 怎么样给自己的app打分呢?

    NSString *str =  [NSString stringWithFormat:@"itms-apps://itunes.apple.com/app/id%@",@&quo ...

  2. HDU-4742 Pinball Game 3D 三维LIS

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4742 题意:求3维的LIS.. 用分治算法搞得,参考了cxlove的题解.. 首先按照x排序,然后每个 ...

  3. Nginx 工作原理和优化、漏洞

    1.  Nginx的模块与工作原理 Nginx由内核和模块组成,其中,内核的设计非常微小和简洁,完成的工作也非常简单,仅仅通过查找配置文件将客户端请求映射到一个location block(locat ...

  4. 第二百九十七天 how can I 坚持

    算是在家宅了一天吧,下午睡了会觉,晚上一起做了个饭,中午一起吃的炒菜和徐斌他同学. 还是那么冷啊. 整天都是东扯西扯的. 睡觉. 忘了件重要的事,就是今天第一次喝鸡尾酒,还有,常人之所以是常人,不是因 ...

  5. html5 标签

    按字母顺序排列的标签列表 4: 指示在 HTML 4.01 中定义了该元素 5: 指示在 HTML 5 中定义了该元素 标签 描述 4 5 <!--...--> 定义注释. 4 5 < ...

  6. App Extension编程指南(iOS8/OS X v10.10)中文版

    http://www.cocoachina.com/ios/20141023/10027.html 当iOS 8.0和OS X v10.10发布后,一个全新的概念出现在我们眼前,那就是应用扩展.顾名思 ...

  7. STL学习系列五:Queue容器

    Queue简介 queue是队列容器,是一种“先进先出”的容器. queue是简单地装饰deque容器而成为另外的一种容器. #include <queue> 1.queue对象的默认构造 ...

  8. BestCoder Round #68 (div.2) tree(hdu 5606)

    tree Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submis ...

  9. EF入门 IQueryable和IEnumberable的区别

    IEnumerable接口 公开枚举器,该枚举器支持在指定类型的集合上进行简单迭代.也就是说:实现了此接口的object,就可以直接使用foreach遍历此object: IQueryable 接口 ...

  10. Spring Data JPA教程, 第六部分: Sorting(未翻译)

    The fifth part of my Spring Data JPA tutorialdescribed how you can create advanced queries with Spri ...