- 积分
- 487
- 鸿鹄币
- 个
- 好评度
- 点
- 精华
- 最后登录
- 1970-1-1
- 阅读权限
- 30
- 听众
- 收听
初级工程师
  
|
发表于 2014-9-15 10:44:29
|
显示全部楼层
本帖最后由 chazipan 于 2014-9-22 02:06 编辑
简单讲下吧,看对你有没有帮助:
先说一下负载的条件:
一条路由要负载的条件:1、到达一个目标网络有两条以上的路径;
2.这些路径的AD值和Metric相同(等价负载);
负载通常是等价的(等价就是描述路径好坏的),打个比喻,从你家到学校有两条路,且两条路的长度一样,这就可以理解为等价。支持等价负载还是非等价负载要看协议,EIGRP就支持不等价负载。
我们以两条路径为例做个实验
来个实验解释一下:
拓扑:
拓扑
如图,到达4.4.4.4有两条路径,一条是通过R2去,一条是通过R3去。
我们在四个路由器上配置IP地址并运行RIP
一、基本配置:
R1:
!
interface Serial1/0
ip address 13.1.1.1 255.255.255.0
serial restart-delay 0
!
interface Serial1/1
ip address 12.1.1.1 255.255.255.0
serial restart-delay 0
!
router rip
version 2
network 12.0.0.0
network 13.0.0.0
no auto-summary
R1#
R2:
!
interface Serial1/0
ip address 12.1.1.2 255.255.255.0
serial restart-delay 0
!
interface Serial1/1
ip address 24.1.1.2 255.255.255.0
serial restart-delay 0
!
router rip
version 2
network 12.0.0.0
network 24.0.0.0
no auto-summary
R3:
!
interface Serial1/0
ip address 34.1.1.3 255.255.255.0
serial restart-delay 0
!
interface Serial1/1
ip address 13.1.1.3 255.255.255.0
serial restart-delay 0
!
!
router rip
version 2
network 13.0.0.0
network 34.0.0.0
no auto-summary
!
R4:
!
interface Loopback0
ip address 4.4.4.4 255.255.255.0
!
!
interface Serial1/0
ip address 24.1.1.4 255.255.255.0
serial restart-delay 0
!
interface Serial1/1
ip address 34.1.1.4 255.255.255.0
serial restart-delay 0
!
!
router rip
version 2
network 4.0.0.0 /这一条是把环回接口宣告进RIP,模拟4.4.4.0网段
network 24.0.0.0
network 34.0.0.0
no auto-summary
!
二、查看R1的路由表:
好了,配置完成,看一下R1的路由表:
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
34.0.0.0/24 is subnetted, 1 subnets
R 34.1.1.0 [120/1] via 13.1.1.3, 00:00:24, Serial1/0
4.0.0.0/24 is subnetted, 1 subnets
R 4.4.4.0 [120/2] via 13.1.1.3, 00:00:24, Serial1/0
[120/2] via 12.1.1.2, 00:00:03, Serial1/1
24.0.0.0/24 is subnetted, 1 subnets
R 24.1.1.0 [120/1] via 12.1.1.2, 00:00:03, Serial1/1
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.1.0 is directly connected, Serial1/1
13.0.0.0/24 is subnetted, 1 subnets
C 13.1.1.0 is directly connected, Serial1/0
R1#
可以看到,R1学习到了4.4.4.0网段的路由,此时R1应该就能到达4.4.4.4
ping一下看
R1#ping 4.4.4.4
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 4.4.4.4, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 64/89/164 ms
R1#
通了。
我们来仔细看下R1关于4.4.4.0/24这条路由:
R 4.4.4.0 [120/2] via 13.1.1.3, 00:00:24, Serial1/0
[120/2] via 12.1.1.2, 00:00:03, Serial1/1
通过路由表,我们观察到,4.4.4.0/24这条路由与其它有不同之处,就是via后面有两个值,一个是13.1.1.3,一个是12.1.1.2,这就是下一跳,这说明到达4.4.4.0/24这个网段有两个路径,这就是负载
为什么会负载,解释一下,因为RIP的AD值(管理距离,就是上面的120/2那个120)默认为120,然后RIP的Metric(就是120/2后面的2)是以跳数来计,最大15跳。从上面可以看出到达4.4.4.0/24这个网的两条路径AD值一样,metric一样,就负载了
数据包在发送的时候,会交替着从R2和R3走。
验证一下:
跟踪:
R1#traceroute 4.4.4.4
Type escape sequence to abort.
Tracing the route to 4.4.4.4
1 13.1.1.3 128 msec
12.1.1.2 96 msec
13.1.1.3 64 msec
2 24.1.1.4 96 msec
34.1.1.4 140 msec
24.1.1.4 100 msec
R1#
达到了负载的效果。
我这里是以最简单的RIP为例做的,当然你也可以用EIGRP,OSPF等去做下负载。
|
沙发
2014-9-15 10:44:29
回复(0)
收起回复
|