CCNP(BSCI)实验:路由器之间的负载均衡实验

实验(一)R2与R3之间的负载均衡
CCNP(BSCI)实验:路由器之间的负载均衡实验
预配置
R2上的配置
R2(config)#int lo0
R2(config-if)#ip add 2.2.2.2 255.255.255.0
R2(config-if)#int s2/2
R2(config-if)#ip add 23.0.0.2 255.255.255.0
R2(config-if)#no sh
R2(config-if)#int f0/0
R2(config-if)#ip add 123.0.0.2 255.255.255.0
R2(config-if)#no sh
R3上的配置
R3(config)#int lo0
R3(config-if)#ip add 3.3.3.3 255.255.255.0
R3(config-if)#int s2/1
R3(config-if)#ip add 23.0.0.3 255.255.255.0
R3(config-if)#no sh
R3(config-if)#int f0/0
R3(config-if)#ip add 123.0.0.3 255.255.255.0
R3(config-if)#no sh负载均衡

实验过程:
第一步:在R2上加两条去3.3.3.0网段的路由
R2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#ip route 3.3.3.0 255.255.255.0 23.0.0.3
R2(config)#ip route 3.3.3.0 255.255.255.0 123.0.0.3
R2(config)#exit
R2#sh ip rou
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 routeide

Gateway of last resort is not setoop

2.0.0.0/24 is subnetted, 1 subnets
C 2.2.2.0 is directly connected, Loopback0
3.0.0.0/24 is subnetted, 1 subnets
S 3.3.3.0 [1/0] via 23.0.0.3
[1/0] via 123.0.0.3
//咱们在这里看到去3.3.3.0的两个
23.0.0.0/24 is subnetted, 1 subnets
C 23.0.0.0 is directly connected, Serial2/2
123.0.0.0/24 is subnetted, 1 subnets
C 123.0.0.0 is directly connected, FastEthernet0/0
R2#
第二步:ping3.3.3.3
R2#ping 3.3.3.3debug

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
!.!.!
//为何会出现这种状况,罕见的 !.!.!
Success rate is 60 percent (3/5), round-trip min/avg/max = 20/60/84 ms
R2#
在R2上debug ip packet后看到只有23.0.0.3接口经过的成功了
Nov 16 21:49:44.103: IP: tableid=0, s=123.0.0.2 (local), d=3.3.3.3 (FastEthernet0/0), routed via RIB
Nov 16 21:49:44.103: IP: s=123.0.0.2 (local), d=3.3.3.3 (FastEthernet0/0), len 100, sending
Nov 16 21:49:44.107: IP: s=123.0.0.2 (local), d=3.3.3.3 (FastEthernet0/0), len 100, encapsulation failed
Nov 16 21:49:46.099: IP: tableid=0, s=23.0.0.2 (local), d=3.3.3.3 (Serial2/2), routed via RIB
Nov 16 21:49:46.099: IP: s=23.0.0.2 (local), d=3.3.3.3 (Serial2/2), len 100, sending
Nov 16 21:49:46.143: IP: tableid=0, s=3.3.3.3 (Serial2/2), d=23.0.0.2 (Serial2/2), routed via RIB
Nov 16 21:49:46.147: IP: s=3.3.3.3 (Serial2/2), d=23.0.0.2 (Serial2/2), len 100, rcvd 3
Nov 16 21:49:46.151: IP: tableid=0, s=123.0.0.2 (local), d=3.3.3.3 (FastEthernet0/0), routed via RIB
Nov 16 21:49:46.151: IP: s=123.0.0.2 (local), d=3.3.3.3 (FastEthernet0/0), len 100, sending
Nov 16 21:49:46.155: IP: s=123.0.0.2 (local), d=3.3.3.3 (FastEthernet0/0), len 100, encapsulation failed.!
Nov 16 21:49:48.147: IP: tableid=0, s=23.0.0.2 (local), d=3.3.3.3 (Serial2/2), routed via RIB
Nov 16 21:49:48.147: IP: s=23.0.0.2 (local), d=3.3.3.3 (Serial2/2), len 100, sending
Nov 16 21:49:48.191: IP: tableid=0, s=3.3.3.3 (Serial2/2), d=23.0.0.2 (Serial2/2), routed via RIB
Nov 16 21:49:48.195: IP: s=3.3.3.3 (Serial2/2), d=23.0.0.2 (Serial2/2), len 100, rcvd 3
Nov 16 21:49:48.199: IP: tableid=0, s=123.0.0.2 (local), d=3.3.3.3 (FastEthernet0/0), routed via RIB
Nov 16 21:49:48.203: IP: s=123.0.0.2 (local), d=3.3.3.3 (FastEthernet0/0), len 100, sending
*Nov 16 21:49:48.207: IP: s=123.0.0.2 (local), d=3.3.3.3 (FastEthernet0/0), len 100, encapsulation failed
Success rate is 40 percent (2/5), round-trip min/avg/max = 48/48/48 ms
R2#
第三步:关闭R2上的两个接口的cef表
R2(config)#int s2/2
R2(config-if)#no ip cef
R2(config)#int f0/0
R2(config-if)#no ip cef
R2(config)#
第四步:再Ping 3.3.3.3 (连续ping 2 次)
R2#ping 3.3.3.3blog

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/30/52 ms
R2#sh ip route 3.3.3.3
Routing entry for 3.3.3.0/24
Known via "static", distance 1, metric 0
Routing Descriptor Blocks:
23.0.0.3
Route metric is 0, traffic share count is 1接口

  • 123.0.0.3 (走下面一条)
    Route metric is 0, traffic share count is 1

R2#ping 3.3.3.3ip

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/30/60 ms
R2#sh ip route 3.3.3.3
Routing entry for 3.3.3.0/24
Known via "static", distance 1, metric 0
Routing Descriptor Blocks:ci

  • 23.0.0.3 (走上面一条)
    Route metric is 0, traffic share count is 1
    123.0.0.3
    Route metric is 0, traffic share count is 1

R2#
实验(二)当R2为穿越流量时的实验
实验过程:
第一步:在R1上ping3.3.3.3
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:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/46/96 ms
R1#
R1#
R1#
第二步:查看是否在R2上负载均衡
R1#traceroute 3.3.3.3it

Type escape sequence to abort.
Tracing the route to 3.3.3.3

1 12.0.0.2 28 msec 48 msec 24 msec
2 23.0.0.3 8 msec * 24 msec
R1#traceroute 3.3.3.3

Type escape sequence to abort.
Tracing the route to 3.3.3.3

1 12.0.0.2 60 msec 28 msec 12 msec
2 123.0.0.3 32 msec * 28 msec
//只有一条??
R1#
第三步:关闭R2上与R3相连的两个接口的route-cache表
R2(config)#int s2/2
R2(config-if)#no ip route
R2(config-if)#no ip route-c
R2(config-if)#int f0/0
R2(config-if)#no ip route-c
R2(config-if)#

第四步:跟踪R1 ping 3.3.3.3 的过程
R1#traceroute 3.3.3.3

Type escape sequence to abort.
Tracing the route to 3.3.3.3

1 12.0.0.2 64 msec 12 msec 96 msec
2 123.0.0.3 36 msec
23.0.0.3 24 msec * (over--success)
R1#
第五步:取消第三步并查看结果
R1#traceroute 3.3.3.3

Type escape sequence to abort.
Tracing the route to 3.3.3.3

1 12.0.0.2 52 msec 56 msec 12 msec
2 123.0.0.3 40 msec * 32 msec
R1#

CCNP(BSCI)实验:路由器之间的负载均衡实验