扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
实验配置:
r1#sh run interface Ethernet0 ip address 10.0.0.1 255.255.255.0 ! interface Serial0 ip address 192.168.1.2 255.255.255.0 ! router rip network 10.0.0.0 network 192.168.1.0 ! |
r2#sh run interface Loopback0 ip address 192.168.3.2 255.255.255.0 secondary ip address 192.168.3.1 255.255.255.0 ! interface Serial0 ip address 192.168.1.1 255.255.255.0 clockrate 64000 ! interface Serial1 ip address 192.168.2.1 255.255.255.0 clockrate 64000 ! router rip network 192.168.1.0 network 192.168.2.0 network 192.168.3.0 ! |
r3#sh run interface Ethernet0 ip address 10.0.0.2 255.255.255.0 ! interface Serial1 ip address 192.168.2.2 255.255.255.0 ! router rip network 10.0.0.0 network 192.168.2.0 ! |
r2#sh ip route Codes: C - connected, S - static, I - IGRP, 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, E - EGP i - IS-IS, 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 10.0.0.0/8 [120/1] via 192.168.1.2, 00:00:23, Serial0 [120/1] via 192.168.2.2, 00:00:19, Serial1 C 192.168.1.0/24 is directly connected, Serial0 C 192.168.2.0/24 is directly connected, Serial1 C 192.168.3.0/24 is directly connected, Loopback0 |
r2(config)#int s0 r2(config)#no ip route-cache r2(config)#int s1 r2(config)#no ip route-cache r2#sh ip int s0 Serial0 is up, line protocol is up Internet address is 192.168.1.1/24 Broadcast address is 255.255.255.255 Address determined by setup command MTU is 1500 bytes Helper address is not set Directed broadcast forwarding is disabled Multicast reserved groups joined: 224.0.0.9 Outgoing access list is not set Inbound access list is not set Proxy ARP is enabled Security level is default Split horizon is enabled ICMP redirects are always sent ICMP unreachables are always sent ICMP mask replies are never sent IP fast switching is disabled //快速交换方式已经关闭,现在为进程交换方式 IP fast switching on the same interface is disabled IP Flow switching is disabled IP Null turbo vector IP multicast fast switching is disabled IP multicast distributed fast switching is disabled IP route-cache flags are None Router Discovery is disabled IP output packet accounting is disabled IP access violation accounting is disabled TCP/IP header compression is disabled RTP/IP header compression is disabled Probe proxy name replies are disabled Policy routing is disabled Network address translation is disabled WCCP Redirect outbound is disabled WCCP Redirect exclude is disabled BGP Policy Mapping is disabled |
检验负载均衡的效果
r2#debug ip packet r2#ping Protocol [ip]: Target IP address: 10.0.0.1 Repeat count [5]: Datagram size [100]: Timeout in seconds [2]: Extended commands [n]: y Source address or interface: 192.168.3.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]: Sweep range of sizes [n]: Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.0.0.1, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 28/31/32 ms 00:59:05: IP: s=192.168.3.1 (local), d=10.0.0.1 (Serial0), len 100, sending 00:59:05: IP: s=10.0.0.1 (Serial0), d=192.168.3.1, len 100, rcvd 4 00:59:05: IP: s=192.168.3.1 (local), d=10.0.0.1 (Serial1), len 100, sending 00:59:05: IP: s=10.0.0.1 (Serial0), d=192.168.3.1, len 100, rcvd 4 00:59:05: IP: s=192.168.3.1 (local), d=10.0.0.1 (Serial0), len 100, sending 00:59:05: IP: s=10.0.0.1 (Serial0), d=192.168.3.1, len 100, rcvd 4 00:59:05: IP: s=192.168.3.1 (local), d=10.0.0.1 (Serial1), len 100, sending 00:59:05: IP: s=10.0.0.1 (Serial0), d=192.168.3.1, len 100, rcvd 4 00:59:05: IP: s=192.168.3.1 (local), d=10.0.0.1 (Serial0), len 100, sending 00:59:05: IP: s=10.0.0.1 (Serial0), d=192.168.3.1, len 100, rcvd 4 |
经过仔细的查找,终于找到了ping请求和应答产生的debug信息。查找分组发送时所经过的接口,我们看到R2的S0和S2被交替使用,可见RIP已经实现负载均衡。
刚才我们注意到ping产生的debug信息和路由更新等产生的debug信息混杂在一起,非常不利于我们的查看,要让debug仅仅输出ping产生的信息,就要使用ACL匹配debug一起使用。
r2(config)#access-list 101 permit icmp any 10.0.0.0 0.255.255.255 r2#debug ip packet 101 /只显示匹配ACL101的debug信息 r2#ping 10.0.0.1 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.0.0.1, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 36/36/40 ms r2# 01:21:52: IP: s=192.168.2.1 (local), d=10.0.0.1 (Serial1), len 100, sending 01:21:52: IP: s=192.168.1.1 (local), d=10.0.0.1 (Serial0), len 100, sending 01:21:52: IP: s=192.168.2.1 (local), d=10.0.0.1 (Serial1), len 100, sending 01:21:52: IP: s=192.168.1.1 (local), d=10.0.0.1 (Serial0), len 100, sending 01:21:52: IP: s=192.168.2.1 (local), d=10.0.0.1 (Serial1), len 100, sending |
可以看到现在debug信息只会显示Ping所产生的信息,并且目的地为10.0.0.0的ping 命令。
以上验证了基于分组的负载均衡(在S0和S1上启用进程交换方式,强制路由器为每一个要进行的分组在路由表中查找目的网络)。下面的来验证基于目的地的负载均衡(在s0和s1上启用快速交换方式,路由器仅仅为第一个分组进行路由表查找,然后路由器把查找结果存于高速缓存中,之后的分组都按照缓存中的信息进行转发)。
r2(config)#int s0 r2(config-if)#ip route-cache r2(config-if)#int s1 r2(config-if)#ip route-cache |
由于本路由器的ios版本不支持快速交换方式,因此看不出这个实验效果,待以后对IOS升级后再进行验证。
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者