博威---云架构决胜云计算

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1780|回复: 1

Cisco双ISP线路之单路由器解决方案

[复制链接]
发表于 2008-12-6 07:11:31 | 显示全部楼层 |阅读模式
通过双ISP(如:一条电信、一条网通)链路可实现网络路径优化、负载均衡及备份冗余,以前本人一直认为Cisco不能实现单路由器双ISP链路的冗余备份,后经过多次测试,发现通过SLA(服务水平)+route-map完全可以实现,在这里愿意和大家一起分享。   网络拓朴:

  实验任务:
  ●  PC1/PC2到1.1.1.1流经ISP1,PC1/PC2到2..2.2.2流经ISP2
  ● 通过SLA+Route-map实现网络路径优化、负载分担、备份冗余
  环境描述:
  ●  3台Cisco3640 + NE-4E模块,该配置拥有4个Ethernet、2台PC
  ●  ISP1、ISP2分别模拟两个不同ISP(internet服务提供商)
  ●  ISP1 loopback1:1.1.1.1/24、ISP2 loopback1:2.2.2.2/24用来测试
  ●  R1作为企业边界路由器e0/0、e0/1、分别连接ISP1、ISP2
  地址分配:

设备名称接口IP地址描述
  R1
E0/0192.168.0.1/24TO ISP1
E0/1192.168.1.1/24TO ISP2
E0/2192.168.20.1/24TO PC1
E0/3192.168.30.1/24TO PC2
  ISP1
E0/2192.168.2.1/24TO ISP2
E0/0192.168.0.2/24TO R1
  ISP1
E0/2192.168.2.2/24TO ISP1
E0/1192.168.1.2/24TO R1
PC1NIC192.168.20.20/24TO R1-E0/2
PC2NIC192.168.30.30/24TO R1-E0/3

  详细配置:
  1、IP地址设置
  ISP1 (config) #int e0/2
  ISP1 (config-if) #ip add 192.168.2.1 255.255.255.0
  ISP1config-if) #no shutdown
  ISP1(config)# int e0/0
  ISP1 (config-if) #ip add 192.168.0.2 255.255.255.0
  ISP1config-if) #no shutdown
  ISP1(config)# int lo1
  ISP1 (config-if) #ip add 1.1.1.1 255.255.255.0
  ISP1(onfig-if) #no shutdown
  ………………………………………………………………………….
  ISP2 (config) #int e0/2
  ISP2 (config-if) #ip add 192.168.2.2 255.255.255.0
  ISP2 (onfig-if) #no shutdown
  ISP2(config)# int e0/1
  ISP2 (config-if) #ip add 192.168.1.2 255.255.255.0
  ISP2config-if) #no shutdown
  ISP2(config)# int lo1
  ISP2 (config-if) #ip add 2.2.2.2 255.255.255.0
  ISP2 (config-if) #no shutdown
  ……………………………………………………………………………
  R1 (config) #int e0/0
  R1 (config-if) #ip add 192.168.0.1 255.255.255.0
  R1 (config-if) #no shutdown
  R1 (config)# int e0/1
  R1 (config-if) #ip add 192.168.1.1 255.255.255.0
  R1 (config-if) #no shutdown
  R1 (config)# int e0/2
  R1 (config-if) #ip add 192.168.20.1 255.255.255.0
  R1 (config-if) #no shutdown   2、定义相关ACL
  R1(config)#ip access-list extended all-net ……………………匹配所有
  R1(config-ext-nacl)#permit ip any any
  R1(config)#access-list permit 1 192.168.0.2…………匹配ISP1 next-hop
  R1(config)#access-list permit 2 192.168.1.2…………匹配ISP2 next-hop
  3、Route-map、Nat
  R1(config)#route-map isp1-line permit 10
  R1(config-route-map)#match ip address all-net
  R1(config-route-map)#match ip next-hop 1……………….匹配ACL 1(关键)
  R1(config)#route-map isp2-line permit 10
  R1(config-route-map)#match ip address all-net
  R1(config-route-map)#match ip next-hop 2……………….匹配ACL 2(关键)
  R1(config)# ip nat inside source route-map isp1-line int e0/0 overload
  R1(config)# ip nat inside source route-map isp2-line int e0/1 overload
  4、IP SlA、rtr/track
  本地路由设备到ISP中间往往连接一个光电转换器(Layer2),当对端shutdown状态,本地设备仍处于UP,这时将导致所谓的“黑洞”现象,我们可以通过SLA来做网络端到端的可用性监测,从而解决这个问题。
  R1(config)#rtr 1
  R1(config-sla-monitor)#type echo protocol ipIcmpEcho 192.168.0.2
  R1(config-sla-monitor-echo)#timeout 1200 ……..echo 超时1200 million second
  R1(config-sla-monitor-echo)#frequency 3……….发送icmp echo包频率3seonds
  R1(config)#ip sla monitor schedule 1 life forever start-time now
  R1(config)#rtr 2
  R1(config-sla-monitor)#type echo protocol ipIcmpEcho 192.168.1.2
  ---采用icmp协议来监视,即发出icmp echo包来探测对端的可达性,192.168.1.2为对端IP地址
  R1(config-sla-monitor-echo)#timeout 1200
  R1(config-sla-monitor-echo)#frequency 3
  R1(config)#ip sla monitor schedule 2 life forever start-time now
  定义SLA监视组
  R1(config)#track 111 rtr 1 reachability…………………….定义跟踪组
  R1(config)#track 222 rtr 2 reachability
  5、写路由
  ISP1 (config) #router ospf 1…………………………启用OSPF协议
  ISP1 (config-router) #net 0.0.0.0 255.255.255.255 area 0
  ISP2 (config) #router ospf 1
  ISP2 (config-router) #net 0.0.0.0 255.255.255.255 area 0
  R1 (config) #roueter ospf 1
  R1 (config-router) #net 0.0.0.0 255.255.255.255 area 0
  -----------------------------------------------------------------------
  R1(config)#ip route 1.1.1.0 255.255.255.0 192.168.0.2 track 111
  R1(config)#ip route 2.2.2.0 255.255.255.0 192.168.1.2 track 222
  R1(config)#ip route 0.0.0.0 0.0.0.0 192.168.0.2 track 111
  R1(config)#ip route 0.0.0.0 0.0.0.0 192.168.0.2 track 111
  实验测试:
  1、在PC1上cmd ping 1.1.1.1 R1 debug ip nat

  在
  PC1上cmd ping 2.2.2.2 R1 debug ip nat
在R1
  上 e0/0 shutdown ping 1.1.1.1

  4、在ISP1路由器上e0/0 shutdown后

  实验总结:
  以前一直以为cisco单路由设备在做双ISP链路时,只能实现线路的负载分担、不能实现真正的线路冗余(一条链路失效会造成黑洞现象),因为NAT转换时不够灵活。
  以前思路的配置:
  1、 定义两个ACL
  R1(config)#no ip access-list extended isp1
  R1(config-ext-nacl)#permit ip any 1.1.1.0 0.0.0.255
  R1(config)#no ip access-list extended isp2
  R1(config-ext-nacl)#permit ip any 2.2.2.0 0.0.0.255
  2、 定义两个route-map
  R1(config)#route-map isp1-line permit 10
  R1(config-route-map)#match ip address isp1
  R1(config)#route-map)#set ip next-hop 192.168.0.2
  R1(config)#route-map isp2-line permit 10
  R1(config-route-map)#match ip address isp2
  R1(config)#route-map)#set ip next-hop 192.168.1.2
  3、 NAT/Route-map
  R1(config)#ip nat inside sourse route-map isp1-line int e0/0 over
  R1(config)#ip nat inside sourse route-map isp2-line int e0/1 over
  通过以前思路的配置不难发现,当一条ISP链路失效时,数据包经过路由图条件匹配,仍会经过NAT转换(很不灵活),这样数据包出去却不能返回,造成“黑洞”,不能达到真正的线路冗余。
  通过这次实验再次说明route-map工具确实很强大,很灵活,能解决不少实际问题,在这个地方它可以迷补NAT的一些缺陷。
发表于 2008-12-12 16:21:32 | 显示全部楼层
很强大!!!

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|boway Inc. ( 冀ICP备10011147号 )

GMT+8, 2024-5-18 14:45 , Processed in 0.084893 second(s), 16 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表