实验目的:
验证
RIP
负载均衡
,
而
RIP
的负载均衡是由跳数决定
,
如果跳数相同则起到负载均衡
.
实验拓扑图:
实验内容:
路由器的基本配置
R
上的
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
照样粘贴上基本的命令
Router(config)#enable password cisco
Router(config)#no ip domain-lookup
Router(config)#line con 0
Router(config-line)# exec-timeout 0 0
Router(config-line)# logging synchronous
Router(config-line)#
Router(config-line)#line aux 0
Router(config-line)# exec-timeout 0 0
Router(config-line)# logging synchronous
Router(config-line)#line vty 0 4
Router(config-line)#
Router(config-line)#
Router(config-line)# exec-timeout 0 0
Router(config-line)# password cisco
Router(config-line)#
Router(config-line)# login
Router(config-line)#
Router(config-line)#
Router(config-line)#alias exec a sh ip int bri
Router(config)#alias exec b sh ip route
Router(config)#alias exec c sh ip route rip
Router(config)#alias exec d sh run
配置好名称
,
接口地址
Router(config)#hostname R1
R1(config)#interface loopback 1
R1(config-if)#ip address
1.1.1
.1 255.255.255.0
R1(config-if)#exit
R1(config)#interface e0/0
R1(config-if)#ip address 172.16.1.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#interface s1/0
R1(config-if)#ip address
*Mar 1 00:14:04.503: %LINK-3-UPDOWN: Interface Ethernet0/0, changed state to up
*Mar 1 00:14:05.503: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0, changed state to up
R1(config-if)#ip address 172.16.2.1 255.255.255.0
R1(config-if)#clock rate 64000
R1(config-if)#no shutdown
R2
上的
Router(config)#hostname R2
R2(config)#interface s1/0
R2(config-if)#ip address 172.16.2.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#exit
R2(config)#interface s1/1
R2(config-if)#ip address 172.16.
*Mar 1 00:14:57.579: %LINK-3-UPDOWN: Interface Serial1/0, changed state to up
R2(config-if)#ip address 172.16.3.1
*Mar 1 00:14:58.583: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/0, changed state to up
R2(config-if)#ip address 172.16.3.1 255.255.255.0
R2(config-if)#clock rate 64000
R2(config-if)#no shutdown
R2(config-if)#exit
R3
上的
Router(config)#hostname R3
R3(config)#interface loopback 0
R3(config-if)#ip address
3.3.3
.3 255.255.255.0
R3(config-if)#exit
R3(config)#interface e0/0
R3(config-if)#ip address 172.16.1.2 255.255.255.0
R3(config-if)#no shutdown
R3(config-if)#exit
R3(config)#interface s1/1
R3(config-if)#ip address 172.16.3.2 255.255.255.0
R3(config-if)#no shutdown
好了
,
现在开始配置
RIP
先在
R1
上
,
宣告接口网络
R1(config)#router rip
R1(config-router)#network
1.0.0
.0
R1(config-router)#network 172.16.2.0
R1(config-router)#network 172.16.1.0
R2
上的
,
两样的格式
R2(config)#router rip
R2(config-router)#network 172.16.2.0
R2(config-router)#network 172.16.3.0
R3
上的
R3(config)#router rip
R3(config-router)#network
3.0.0
.0
R3(config-router)#network 172.16.1.0
R3(config-router)#network 172.16.3.0
配置好后
,
查看一下路由表
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
C
1.1.1
.0 is directly connected, Loopback1
R
3.0.0
.0/8 [120/1] via 172.16.1.2, 00:00:03, Ethernet0/0
172.16.0.0/24 is subnetted, 3 subnets
C 172.16.1.0 is directly connected, Ethernet0/0
C 172.16.2.0 is directly connected, Serial1/0
R 172.16.3.0 [120/1] via 172.16.2.2, 00:00:10, Serial1/0
[120/1] via 172.16.1.2, 00:00:03, Ethernet0/0
注意最后的一条
RIP
路由
,
可以看到去
172.16.3.0
的路由已经产生了负载均衡的现象
,
因为它们的跳数是相同的
.
R2
上的路由表
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
R
1.0.0
.0/8 [120/1] via 172.16.2.1, 00:00:24, Serial1/0
R
3.0.0
.0/8 [120/1] via 172.16.3.2, 00:00:03, Serial1/1
172.16.0.0/24 is subnetted, 3 subnets
R 172.16.1.0 [120/1] via 172.16.2.1, 00:00:24, Serial1/0
[120/1] via 172.16.3.2, 00:00:03, Serial1/1
C 172.16.2.0 is directly connected, Serial1/0
C 172.16.3.0 is directly connected, Serial1/1
很清楚也显示了所有的链路
.
R3
的路由表
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
R
1.0.0
.0/8 [120/1] via 172.16.1.1, 00:00:03, Ethernet0/0
C
3.3.3
.0 is directly connected, Loopback0
172.16.0.0/24 is subnetted, 3 subnets
C 172.16.1.0 is directly connected, Ethernet0/0
R 172.16.2.0 [120/1] via 172.16.3.1, 00:00:17, Serial1/1
[120/1] via 172.16.1.1, 00:00:03, Ethernet0/0
C 172.16.3.0 is directly connected, Serial1/1
最后
,
用扩展的
ping
命令来测试负载均衡
先从
R1
的
loopback 0
接口上
pingR3
的
S1/1
口
R1#ping
Protocol [ip]:
Target IP address: 172.16.3.2
Repeat count [5]:
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]: y
Source address or interface:
1.1.1
.1
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 172.16.3.2, timeout is 2 seconds:
Packet sent with a source address of
1.1.1
.1
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 (136 ms). Received packet has options
Total option bytes= 40, padded length=40
Record route:
(172.16.2.1)
(172.16.3.1)
(172.16.3.2)
(172.16.1.2)
(
1.1.1
.1) <*>
(
0.0.0
.0)
(
0.0.0
.0)
(
0.0.0
.0)
(
0.0.0
.0)
End of list
Reply to request 1 (112 ms). Received packet has options
Total option bytes= 40, padded length=40
Record route:
(172.16.1.1)
(172.16.3.2)
(172.16.1.2)
(
1.1.1
.1) <*>
(
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 (160 ms). Received packet has options
Total option bytes= 40, padded length=40
Record route:
(172.16.2.1)
(172.16.3.1)
(172.16.3.2)
(172.16.1.2)
(
1.1.1
.1) <*>
(
0.0.0
.0)
(
0.0.0
.0)
(
0.0.0
.0)
(
0.0.0
.0)
End of list
Reply to request 3 (112 ms). Received packet has options
Total option bytes= 40, padded length=40
Record route:
(172.16.1.1)
(172.16.3.2)
(172.16.1.2)
(
1.1.1
.1) <*>
(
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 (160 ms). Received packet has options
Total option bytes= 40, padded length=40
Record route:
(172.16.2.1)
(172.16.3.1)
(172.16.3.2)
(172.16.1.2)
(
1.1.1
.1) <*>
(
0.0.0
.0)
(
0.0.0
.0)
(
0.0.0
.0)
(
0.0.0
.0)
End of list
可以注意到数据包的路径可以发现
,
来回的路径不同
,
也就是说数据包是走了负载均衡的
.
本文转自 独钩寒江雪 51CTO博客,原文链接:http://blog.51cto.com/bennie/101394,如需转载请自行联系原作者