您的位置:首页 > 理论基础 > 计算机网络

Cisco双ISP线路路径优化备份冗余之 单路由器解决方案

2011-05-09 10:53 337 查看
Cisco

双ISP
线路路径优化备份冗余之


单路由器解决方案


 


通过双ISP
(如:一条电信、一条网通)链路可实现网络路径优化
、负载均衡
及备份冗余
,
以前本人一直认为Cisco
不能实现单路由器双ISP
链路的冗余备份
,后经过多次测试,发现通过SLA
(服务水平)+route-map
完全可以实现,在这里愿意和大家一起分享。

网络拓朴:







实验任务:


l  

PC1/PC2
到1.1.1.1
流经ISP1
,PC1/PC2
到2..2.2.2
流经ISP2

l  

通过SLA+Route-map
实现网络路径优化、负载分担、备份冗余

环境描述:


l  

 
3



Cisco3640 + NE-4E
模块,该配置拥有4
个Ethernet
、2
台PC

l  

 
ISP1
、ISP2
分别模拟两个不同ISP(internet
服务提供商)

l  

 
ISP1 loopback1:1.1.1.1/24
、ISP2 loopback

1:2.2.2.2/24
用来测试

l  

 
R1
作为企业边界路由器e0/0
、e0/1
、分别连接ISP1
、ISP2

 

地址分配:


设备名称


接口


IP

地址


描述


R1

E0/0

192.168.0.1/24

TO ISP1


E0/1

192.168.1.1/24

TO ISP2


E0/2

192.168.20.1/24

TO PC1


E0/3

192.168.30.1/24

TO PC2


ISP1


E0/2

192.168.2.1/24

TO ISP2


E0/0

192.168.0.2/24

TO R1


ISP1


E0/2

192.168.2.2/24

TO ISP1


E0/1

192.168.1.2/24

TO R1


PC1


NIC

192.168.20.20/24

TO R1-E0/2


PC2


NIC

192.168.30.30/24

TO 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.1.2 track 222

 

 

 

实验测试:



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
的一些缺陷。

 

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息