资源描述
CCNA扩展实验:路由链路负载均衡,浮动静态路由
发布时间:2008-05-23
实验内容:1.配置静态路由2.建立负载均衡链路,3.启用浮动静态路由,保证在一条链路shut down后启用另一条链路。
实验目的:学会应用静态路由,动态路由,了解管理距离。
实验环境:cisco7200路由器3台(模拟)
一、名词概念
静态路由
静态路由是指由网络管理员手工配置的路由信息。当网络的拓扑结构或链路的状态发生变化时,网络管理员需要手工去修改路由表中相关的静态路由信息。静态路由信息在缺省情况下是私有的,不会传递给其他的路由器。当然,网管员也可以通过对路由器进行设置使之成为共享的。静态路由一般适用于比较简单的网络环境,在这样的环境中,网络管理员易于清楚地了解网络的拓扑结构,便于设置正确的路由信息。
在一个支持DDR(dial-on-demand routing)的网络中,拨号链路只在需要时才拨通,因此不能为动态路由信息表提供路由信息的变更情况。在这种情况下,网络也适合使用静态路由。
使用静态路由的另一个好处是网络安全保密性高。动态路由因为需要路由器之间频繁地交换各自的路由表,而对路由表的分析可以揭示网络的拓扑结构和网络地址等信息。因此,网络出于安全方面的考虑也可以采用静态路由。
大型和复杂的网络环境通常不宜采用静态路由。一方面,网络管理员难以全面地了解整个网络的拓扑结构;另一方面,当网络的拓扑结构和链路状态发生变化时,路由器中的静态路由信息需要大范围地调整,这一工作的难度和复杂程度非常高。
管理距离
管理距离是指一种路由协议的路由可信度。每一种路由协议按可靠性从高到低,依次分配一个信任等级,这个信任等级就叫管理距离。对于两种不同的路由协议到一个目的地的路由信息,路由器首先根据管理距离决定相信哪一个协议。
一些常见路由协议的管理距离
Route Source --Default Distance Values
Connected interface --0
Static route* --1
Enhanced Interior Gateway Routing Protocol (EIGRP) summary route--5
External Border Gateway Protocol(BGP)--20
Internal EIGRP-- 90
IGRP --100
OSPF --110
Intermediate System-to-Intermediate System (IS-IS)--115
Routing Information Protocol (RIP) --120
Exterior Gateway Protocol (EGP) --140
On Demand Routing (ODR) --160
External EIGRP --170
Internal BGP --200
Unknown** --255
/管理距离是可以更改的。
链路负载均衡
解决电信与网通之间、不同链路之间互联互通的问题,除此之外,双线路可以互为备份,如一条链路出现故障时,可以自动切换到其它链路;并在一条链路流量大时自动分配其余流量到其他的链路上等等。
浮动静态路由
不同于其他的静态路由,浮动静态路由不能永久的保存于路由表中。它仅仅只会在主链路DOWN时,才回UP起来。它是被做为主链路的备份链路来使用的。
实验拓扑:如下
1. 分别登陆三台路由器,进行预配置
Router>en
Router#conf t
Router(config)#host R1 /其它路由器分别为R2、R3
R1(config)#enable password cisco
R1(config)#no ip domain-lookup 打错命令·禁止查找
2、配置普通用户登录密码
R1(config)#line con 0
R1(config-line)#password cisco
R1(config-line)#login - -- 激活密码
3、配置普通用户连接时间
R1(config-line)#logging synchronous
R1(config-line)#exec-timeout 0 0
4、配置管理员远程登录密码
R1(config-line)#line vty 0 4
R1(config-line)#password cisco
R1(config-line)#login
5、远程连接时间
R1(config-line)#logging synchronous
R1(config-line)#exec-timeout 0 0
2. 配置三台路由器的链路,接口及地址参见拓扑图一
3. 配置静态路由
R1上
R1(config)#ip route 20.20.20.20 255.255.255.255 192.168.1.2
R1(config)#ip route 192.168.2.2 255.255.255.255 192.168.1.2
R1(config)#ip route 20.20.20.20 255.255.255.255 199.99.1.2
R1(config)#ip route 192.168.2.2 255.255.255.255 199.99.1.2
R1(config)#ip route 0.0.0.0 0.0.0.0 192.168.1.2
R1(config)#ip route 0.0.0.0 0.0.0.0 199.99.1.2
在R1上show ip route,出现负载均衡链路,红色标记
20.0.0.0/32 is subnetted, 1 subnets
S 20.20.20.20 [1/0] via 192.168.1.2
[1/0] via 199.99.1.2
C 199.99.1.0/24 is directly connected, FastEthernet0/0
C 10.0.0.0/8 is directly connected, Loopback0
C 192.168.1.0/24 is directly connected, Serial1/0
192.168.2.0/32 is subnetted, 1 subnets
S 192.168.2.2 [1/0] via 192.168.1.2
[1/0] via 199.99.1.2
S* 0.0.0.0/0 [1/0] via 192.168.1.2
[1/0] via 199.99.1.2
R2上
R2(config)#ip route 20.20.20.20 255.255.255.255 192.168.2.2
R2(config)#ip route 10.10.10.10 255.255.255.255 192.168.1.1
R3上
R3(config)#ip route 10.10.10.10 255.255.255.255 192.168.2.1
R3(config)#ip route 192.168.1.1 255.255.255.255 192.168.2.1
R3(config)#ip route 192.168.1.1 255.255.255.255 199.99.1.1
R3(config)#ip route 10.10.10.10 255.255.255.255 199.99.1.1
R3(config)#ip route 0.0.0.0 0.0.0.0 192.168.2.1
R3(config)#ip route 0.0.0.0 0.0.0.0 199.99.1.1
在R3上show ip route,出现负载均衡链路,红色标记
C 20.0.0.0/8 is directly connected, Loopback0
C 199.99.1.0/24 is directly connected, FastEthernet0/0
10.0.0.0/32 is subnetted, 1 subnets
S 10.10.10.10 [1/0] via 192.168.2.1
[1/0] via 199.99.1.1
192.168.1.0/32 is subnetted, 1 subnets
S 192.168.1.1 [1/0] via 192.168.2.1
[1/0] via 199.99.1.1
C 192.168.2.0/24 is directly connected, Serial1/1
S* 0.0.0.0/0 [1/0] via 192.168.2.1
[1/0] via 199.99.1.1
从R1上使用扩展ping命令来查看
R1#ping
Protocol [ip]:
Target IP address: 20.20.20.20
Repeat count [5]:
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]: y
Source address or interface: 10.10.10.10
Type of service [0]:
Set DF bit in IP header? [no]:
Validate reply data? [no]:
Data pattern [0xABCD]:
Loose, Strict, Record, Timestamp, Verbose[none]: r
Number of hops [ 9 ]:
Loose, Strict, Record, Timestamp, Verbose[RV]:
Sweep range of sizes [n]:
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 20.20.20.20, timeout is 2 seconds:
Packet sent with a source address of 10.10.10.10
Packet has IP options: Total option bytes= 39, padded length=40
Record route: <*>
(0.0.0.0)
(0.0.0.0)
(0.0.0.0)
(0.0.0.0)
(0.0.0.0)
(0.0.0.0)
(0.0.0.0)
(0.0.0.0)
(0.0.0.0)
Reply to request 0 (724 ms). Received packet has options
Total option bytes= 40, padded length=40
/第一条链路
Record route:
(192.168.1.1) /出发
(192.168.2.1) /经过
(20.20.20.20) /到达
(192.168.2.2) /回来路过
(192.168.1.2) /回来路过
(10.10.10.10) <*> /回来
(0.0.0.0)
(0.0.0.0)
(0.0.0.0)
End of list
Reply to request 1 (280 ms). Received packet has options
Total option bytes= 40, padded length=40
/第二条链路
Record route:
(199.99.1.1) /出发
(20.20.20.20) /到达
(199.99.1.2) /返回路过
(10.10.10.10) <*> /回来
(0.0.0.0)
(0.0.0.0)
(0.0.0.0)
(0.0.0.0)
(0.0.0.0)
End of list
Reply to request 2 (712 ms). Received packet has options
Total option bytes= 40, padded length=40
Record route:
(192.168.1.1)
(192.168.2.1)
(20.20.20.20)
(192.168.2.2)
(192.168.1.2)
(10.10.10.10) <*>
(0.0.0.0)
(0.0.0.0)
(0.0.0.0)
End of list
Reply to request 3 (280 ms). Received packet has options
Total option bytes= 40, padded length=40
Record route:
(199.99.1.1)
(20.20.20.20)
(199.99.1.2)
(10.10.10.10) <*>
(0.0.0.0)
(0.0.0.0)
(0.0.0.0)
(0.0.0.0)
(0.0.0.0)
End of list
Reply to request 4 (568 ms). Received packet has options
Total option bytes= 40, padded length=40
Record route:
(192.168.1.1)
(192.168.2.1)
(20.20.20.20)
(192.168.2.2)
(192.168.1.2)
(10.10.10.10) <*>
(0.0.0.0)
(0.0.0.0)
(0.0.0.0)
End of list
Success rate is 100 percent (5/5), round-trip min/avg/max = 280/512/724 ms
三、浮动静态路由实验过程
1. 先no掉R1上的3条静态路由
R1(config)# no ip route 20.20.20.20 255.255.255.255 199.99.1.2
R1(config)# no ip route 192.168.2.2 255.255.255.255 199.99.1.2
R1(config)# no ip route 0.0.0.0 0.0.0.0 199.99.1.2
2. 利用路由协议的管理距离(distance)重新在R1上写3条静态路由,并将管理距离增大到120
R1(config)# ip route 20.20.20.20 255.255.255.255 199.99.1.2 120
R1(config)# ip route 192.168.2.2 255.255.255.255 199.99.1.2 120
R1(config)# ip route 0.0.0.0 0.0.0.0 199.99.1.2 120
/ R1(config)# ip route 20.20.20.20 255.255.255.255 199.99.1.2 ?
<1-255> Distance metric for this route
name Specify name of the next hop
permanent permanent route
tag Set tag for this route
<cr>
3. 用show ip route命令查看路由表,发现所写的上面3条静态路由在路由表里不可见
20.0.0.0/32 is subnetted, 1 subnets
S 20.20.20.20 [1/0] via 192.168.1.2
C 199.99.1.0/24 is directly connected, FastEthernet0/0
C 10.0.0.0/8 is directly connected, Loopback0
C 192.168.1.0/24 is directly connected, Serial1/0
192.168.2.0/32 is subnetted, 1 subnets
S 192.168.2.2 [1/0] via 192.168.1.2
S* 0.0.0.0/0 [1/0] via 192.168.1.2
4. 测试链路是否正常
进入R1的S1/0口 做shut down 操作,然后在R1上ping R3的回环地址20.20.20.20
发现是通的,用扩展ping发现路由的路线是
(199.99.1.1)
(20.20.20.20)
(199.99.1.2)
(10.10.10.10) <*>
说明上面输入的3条静态路由由于把管理距离改大,在s1/0接口没有shut down 时。在路由表中隐藏起来了,一但s1/0接口shut down 时,便生效了。以下是s1/0接口shut down 时的路由表,从表中可以看出3条静态路由开始生效了,管理距离是120.
20.0.0.0/32 is subnetted, 1 subnets
S 20.20.20.20 [120/0] via 199.99.1.2
C 199.99.1.0/24 is directly connected, FastEthernet0/0
C 10.0.0.0/8 is directly connected, Loopback0
192.168.2.0/32 is subnetted, 1 subnets
S 192.168.2.2 [120/0] via 199.99.1.2
S* 0.0.0.0/0 [120/0] via 199.99.1.2
四、结论
对于去往相同目的但是却是由不同路由协议学习来的的路由条目,路由器的选择顺序是
1、管理距离
2、度量值
3、最长掩码匹配
静态路由的管理距离为1,如果去往20.20.20.20网络的数据包发现有两条路可走,而且两条路都是静态的,那么它将会选择以负载均衡的方式发送该数据包。现在其中某条路的管理距离改大了,那么路由器将优先选择管理距离小的那条路来发送数据报文。只有当管理距离小的那条down后,它才会启用管理距离稍大的路由条目。
我们也可以采用动态及静态相结合的办法来做浮动。当然,前提是必须把用做备份链路的那条静态路由AD改大,要大于用做主链路的动态路由条目的AD,只有这样,当主链路失效后,备份链路就会UP替代主链路。
有百度 9i波波 提供(IT资料 低积分 欢迎光顾!!!!谢谢)
展开阅读全文