word
双ISP接入负载均衡加备份实验
一. 拓朴图
二. 二. 实现目标:内网172.16.10.0/24中的奇数地址〔172.16.10.3/5/7/9〕走ISP1,如果NAT与R1间的链路down掉,如此走ISP2内网172.16.10.0/24中的偶数地址〔172.16.10.2/4/6/8〕走ISP2,如果NAT与R2间的链路down掉,如此走ISP1三. 配置与注释:1.NAT的配置:NAT#show runBuilding configuration...Current configuration : 1696 bytes!version 12.3service timestamps debug datetime msecservice timestamps log datetime mseo service password-encryption!hostname NAT!boot-start-markerboot-end-marker!!no aaa new-modelip subnet-zero!!no ip domain lookup!ip cef!!! !!!!!!!!!!! !!!!interface FastEthernet0/0no ip addressshutdownduplex half!interface Serial1/0ip address 192.168.1.1 255.255.255.0ip nat outsideserial restart-delay 0!interface Serial1/1ip address 192.168.2.1 255.255.255.0ip nat outsideserial restart-delay 0!interface Serial1/2ip address 172.16.10.1 255.255.255.0ip nat insideip policy route-map load //应用\的策略路由serial restart-delay 0!interface Serial1/3no ip addressshutdownserial restart-delay 0!ip nat pool R1 192.168.1.10 192.168.1.20 prefix-lengt
1 / 6
word h 24 //配置R1的NAT地址池ip nat pool R2 192.168.2.10 192.168.2.20 prefix-length 24 //配置R2的NAT地址池ip nat inside source route-map ISP1 pool R1 overload //符合策略路由\的使用R1定义的地址池ip nat inside source route-map ISP2 pool R2 overload //符合策略路由\的使用R2定义的地址池ip classlessno ip serverno ip secure-server!!!ip access-list standard even //定义标准访问列表\permit 172.16.10.0 0.0.0.254 //允许172.16.10.0中偶数的地址access-list 1 permit 172.16.10.0 0.0.0.255 //允许NAT转换的地址X围!route-map load permit 10 //定义策略路由,用于实现负载分担和备份match ip address even //匹配访问列表\的,也就是偶数的地址set ip next-hop 192.168.2.2 //设置下一跳为192.168.2.2,也就是R2的接口地址 set ip default next-hop 192.168.1.2 //如果NAT和R2之间的链路down掉了,就使用默认的下一跳,也就是R1!route-map load permit 20 //不满足\d\系列号10的,就匹配20set ip next-hop 192.168.1.2 //不匹配偶数的,也就是奇数的地址如此下一跳为R1set ip default next-hop 192.168.2.2 //如果NAT和R1之间的链路down掉了,就使用默认的下一跳,也就是R2!route-map ISP2 permit 10 //用于ISP2的策略路由 match ip address 1 //匹配访问列表1match interface Serial1/1 //同时匹配出口为s1/1,也就是和R2相连的接口! route-map ISP1 permit 10 //用于ISP1的策略路由 match ip address 1 //匹配访问列表1match interface Serial1/0 //同时匹配出口为s1/1,也就是和R2相连的接口//一个访问列表只能匹配一个地址池,因此,我们必须用不同的出接口来区分。如果是h3c设备就无此问题!!!!!!!gatekeepershutdown!!line con 0exec-timeout 0 0logging synchronousstopbits 1line aux 0stopbits 1line vty 0 4password ciscologin !!End//基于不同的源地址网段做负载均衡比拟简单,有不清楚的可以问我2.R2、R3的配置:R2上只需配置一条静态路由ip route 192.168.2.0 255.255.255.0 10.10.10.2R3 上只需配置一条静态路由ip route 192.168.1.0 255.255.255.0 10.10.10.13.PC上的配置:在路由器的接口上配置一个奇数和偶数的地址来模拟四.负载均衡测试:1.在NAT上打开debug ip nat 来观察NAT转换所使用的地址池,在PC上直接ping 10.10.10.1〔PC上的主地址为172.16.10.2,为偶数〕,接着用扩展ping,使用172.16.10.3〔奇数地址〕作为源地址ping 10.10.10.1。PC的输出信息如下:PC#ping 10.10.10.1Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 10.10.10.1, timeout is 2 seconds:!!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 108/155/228 msPC# PC#PC#PC#ping Protocol [ip]: Target IP address: 10.10.10.1Repeat count [5]: Datagram size [100]: Timeout in seconds [2]: Extended mands [n]: ySource address or interface: 172.16.10.3Type of service [0]: Set
2 / 6
word 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.10.10.1, timeout is 2 seconds:Packet sent with a source address of 172.16.10.3 !!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 64/104/196 msNAT的输出信息如下:NAT#debug ip natIP NAT debugging is onNAT#*Jun 23 10:58:34.675: NAT: s=172.16.10.2->192.168.2.10, d=10.10.10.1 [177] //第一次ping(偶数地址)的输出,使用的*Jun 23 10:58:34.827: NAT*: s=10.10.10.1, d=192.168.2.10->172.16.10.2 [177] 是ISP2地址池*Jun 23 10:58:34.911: NAT*: s=172.16.10.2->192.168.2.10, d=10.10.10.1 [178]*Jun 23 10:58:34.987: NAT*: s=10.10.10.1, d=192.168.2.10->172.16.10.2 [178]*Jun 23 10:58:35.083: NAT*: s=172.16.10.2->192.168.2.10, d=10.10.10.1 [179]*Jun 23 10:58:35.159: NAT*: s=10.10.10.1, d=192.168.2.10->172.16.10.2 [179]*Jun 23 10:58:35.175: NAT*: s=172.16.10.2->192.168.2.10, d=10.10.10.1 [180]*Jun 23 10:58:35.271: NAT*: s=10.10.10.1, d=192.168.2.10->172.16.10.2 [180]*Jun 23 10:58:35.299: NAT*: s=172.16.10.2->192.168.2.10, d=10.10.10.1 [181]NAT#*Jun 23 10:58:35.395: NAT*: s=10.10.10.1, d=192.168.2.10->172.16.10.2 [181]NAT#*Jun 23 10:58:52.571: NAT: s=172.16.10.3->192.168.1.11, d=10.10.10.1 [182] //第一次ping(偶数地址)的输出,使用的*Jun 23 10:58:52.623: NAT*: s=10.10.10.1, d=192.168.1.11->172.16.10.3 [182] 是ISP1地址池*Jun 23 10:58:52.743: NAT*: s=172.16.10.3->192.168.1.11, d=10.10.10.1 [183]*Jun 23 10:58:52.787: NAT*: s=10.10.10.1, d=192.168.1.11->172.16.10.3 [183]*Jun 23 10:58:52.851: NAT*: s=172.16.10.3->192.168.1.11, d=10.10.10.1 [184]*Jun 23 10:58:52.895: NAT*: s=10.10.10.1, d=192.168.1.11->172.16.10.3 [184]*Jun 23 10:58:52.931: NAT*: s=172.16.10.3->192.168.1.11, d=10.10.10.1 [185]*Jun 23 10:58:52.991: NAT*: s=10.10.10.1, d=192.168.1.11->172.16.10.3 [185]*Jun 23 10:58:53.023: NAT*: s=172.16.10.3->192.168.1.11, d=10.10.10.1 [186]2.打开NAT的debug ip policy来观察下一跳,然后在PC上再次ping和扩展ping目的地址10.10.10.1,以下是NAT上的输出信息:NAT#debug ip policyPolicy routing debugging is on*Jun 23 11:12:31.227: IP: s=172.16.10.2 (Serial1/2), d=10.10.10.1, len 100, FIB policy match*Jun 23 11:12:31.227: IP: s=172.16.10.2 (Serial1/2), d=10.10.10.1, g=192.168.2.2, len 100, FIB policy routed*Jun 23 11:12:31.231: IP: s=172.16.10.2 (Serial1/2), d=10.10.10.1, len 100, policy match*Jun 23 11:12:31.235: IP: route map load, item 10, permit*Jun 23 11:12:31.235: IP: s=172.
3 / 6
双ISP之接入负载均衡加备份实验的



