静态路由

简介:

实验目的:练习静态路由的递归查找。

实验拓扑:

clip_image002

配置步骤:

R1:

ip route 3.3.3.0 255.255.255.0 10.1.2.2 //如果R1上有数据包到达3.3.3.3的话,在路由表中会把下一跳送到10.1.2.2,但是由于地址为10.1.2.2 不是自己直连的,所以在一次通过查表得到下一跳是10.1.1.2,于是把他送到R2。这就是所谓的递归查找。也是路由表查询的一条规则。

ip route 10.1.2.0 255.255.255.0 10.1.1.2

R1#show ip route static

3.0.0.0/24 is subnetted, 1 subnets

S 3.3.3.0 [1/0] via 10.1.2.2

10.0.0.0/24 is subnetted, 2 subnets

S 10.1.2.0 [1/0] via 10.1.1.2

R3:

R3#show ip route static

1.0.0.0/24 is subnetted, 1 subnets

S 1.1.1.0 [1/0] via 10.1.1.1

10.0.0.0/24 is subnetted, 2 subnets

S 10.1.1.0 [1/0] via 10.1.2.1

ip route 1.1.1.0 255.255.255.0 10.1.1.1

ip route 10.1.1.0 255.255.255.0 10.1.2.1

实验结果:递归查询不是一种很好的实现方法,因为他比较耗费路由器的资源。

实验目的:理解路由表查询的原则之一最长匹配。

实验拓扑:

clip_image002[1]

配置步骤:

R1:

ip route 3.0.0.0 255.0.0.0 10.1.1.2

ip route 3.3.3.0 255.255.255.0 Null0 //为了验证路由表查询的最长匹配,在这里写了一条最长的掩码。等会在R1上ping 3.3.3.3时,如果匹配ip route 3.0.0.0 255.0.0.0 10.1.1.2的话,在R3上debug时会有相应的调试信息出来,如果没有的话,说明匹配下一条路由。

ip route 10.1.2.0 255.255.255.0 10.1.1.2

R1# show ip route st

3.0.0.0/8 is variably subnetted, 2 subnets, 2 masks

S 3.3.3.0/24 is directly connected, Null0

S 3.0.0.0/8 [1/0] via 10.1.1.2

10.0.0.0/24 is subnetted, 2 subnets

S 10.1.2.0 [1/0] via 10.1.1.2

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:

.....//不能ping通

Success rate is 0 percent (0/5)

R1#debug ip packet

IP packet debugging is on

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:

00:32:43: IP: tableid=0, s=1.1.1.1 (local), d=3.3.3.3 (Null0), routed via RIB//说明匹配了NULL0 的路由。

00:32:43: IP: s=1.1.1.1 (local), d=3.3.3.3 (Null0), len 100, sending.

00:32:45: IP: tableid=0, s=1.1.1.1 (local), d=3.3.3.3 (Null0), routed via RIB

00:32:45: IP: s=1.1.1.1 (local), d=3.3.3.3 (Null0), len 100, sending.

00:32:47: IP: tableid=0, s=1.1.1.1 (local), d=3.3.3.3 (Null0), routed via RIB

00:32:47: IP: s=1.1.1.1 (local), d=3.3.3.3 (Null0), len 100, sending.

00:32:49: IP: tableid=0, s=1.1.1.1 (local), d=3.3.3.3 (Null0), routed via RIB

00:32:49: IP: s=1.1.1.1 (local), d=3.3.3.3 (Null0), len 100, sending.

00:32:51: IP: tableid=0, s=1.1.1.1 (local), d=3.3.3.3 (Null0), routed via RIB

00:32:51: IP: s=1.1.1.1 (local), d=3.3.3.3 (Null0), len 100, sending.

Success rate is 0 percent (0/5)

R3:

R3#debug ip packet

IP packet debugging is on

R3#

实验结果:

通过实验得出:在路由表同时存在到达同一目的地的路由时,路由会根据最长匹配的原则对其进行查找。

实验目的:

1.通过写静态路由实现负载均衡

2.同时存在两条路由时,要求直走一个路径(浮动静态路由)

实验拓扑:

clip_image004

配置步骤:

R1:

ip route 2.2.2.0 255.255.255.0 Serial1/1

ip route 2.2.2.0 255.255.255.0 FastEthernet0/0

ip route 3.3.3.0 255.255.255.0 Serial1/1

ip route 3.3.3.0 255.255.255.0 FastEthernet0/0

ip route 10.1.2.0 255.255.255.0 Serial1/1

R1# show ip route static

2.0.0.0/24 is subnetted, 1 subnets

S 2.2.2.0 is directly connected, Serial1/1

is directly connected, FastEthernet0/0

3.0.0.0/24 is subnetted, 1 subnets

S 3.3.3.0 is directly connected, Serial1/1

is directly connected, FastEthernet0/0

10.0.0.0/24 is subnetted, 2 subnets

S 10.1.2.0 is directly connected, Serial1/1

R2:

ip route 1.1.1.0 255.255.255.0 Serial1/0

ip route 1.1.1.0 255.255.255.0 FastEthernet0/0

ip route 3.3.3.0 255.255.255.0 Serial1/1

ip route 3.3.3.0 255.255.255.0 FastEthernet0/0

R2# show ip route static

1.0.0.0/24 is subnetted, 1 subnets

S 1.1.1.0 is directly connected, Serial1/0

is directly connected, FastEthernet0/0

3.0.0.0/24 is subnetted, 1 subnets

S 3.3.3.0 is directly connected, Serial1/1

is directly connected, FastEthernet0/0

R3:

ip route 1.1.1.0 255.255.255.0 Serial1/0

ip route 1.1.1.0 255.255.255.0 FastEthernet0/0

ip route 2.2.2.0 255.255.255.0 Serial1/0

ip route 2.2.2.0 255.255.255.0 FastEthernet0/0

ip route 10.1.1.0 255.255.255.0 Serial1/0

R3#show ip route static

1.0.0.0/24 is subnetted, 1 subnets

S 1.1.1.0 is directly connected, Serial1/0

is directly connected, FastEthernet0/0

2.0.0.0/24 is subnetted, 1 subnets

S 2.2.2.0 is directly connected, Serial1/0

is directly connected, FastEthernet0/0

10.0.0.0/24 is subnetted, 2 subnets

S 10.1.1.0 is directly connected, Serial1/0



本文转自 gehailong 51CTO博客,原文链接:http://blog.51cto.com/gehailong/297350,如需转载请自行联系原作者

相关文章
|
1月前
|
网络架构
|
7月前
|
网络架构
路由器和静态路由的配置
路由器和静态路由的配置
133 0
|
11月前
|
网络架构
静态路由汇总的方法
静态路由汇总的方法
115 0
|
运维 Shell 网络架构
静态路由详细讲解
静态路由详细讲解
194 0
静态路由详细讲解
|
网络协议 网络架构
二、IP、路由协议
二、IP、路由协议
二、IP、路由协议
|
网络协议 网络虚拟化 网络架构
单臂路由
臂路由技术实现了不同vlan之间进行通信用户与服务器处于不同vlan,如何才能让用户能够访问服务器呢?方案一:使用一根网线,两端分别插在两个vlan下的接口方案二:借助路由器的路由功能实现vlan通信单臂路由:单臂路由技术能让路由器的一根物理接口对应不同vlan数据的实质是把物理接口分成若干个子接口,这些子接口通过封装802.1q标识,以识别不同vlan的TAG标识配置:1) 对交换机运行vlan和trunk配置2) 创建路由子接口: int g0/0/0.103) 给子接口配置IP地址4) 把子接口封装对应vlan的dot 1q标记:dot 1q termination 为了方便管理网络,根
|
网络协议 网络虚拟化 网络架构
单臂路由与VLAN
单臂路由与VLAN
4715 0
|
网络协议 网络架构

热门文章

最新文章