静态路由

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

实验拓扑:

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值