nat的双线接入负载均衡与虚拟服务器(发布服务器)
2010-08-02 16:14
483 查看
nat的双线接入负载均衡与虚拟服务器(发布服务器)
公司为了快速可靠的访问外网,分别在网通和电信购买了公网地址。要求:正常情况下网络实现等路径负载均衡,若网通/电信的连接出现问题,则公司内部通过正常的线路访问外网,不会造成网络不同!
********************************************************
模拟网络环境:依据拓扑结构环境,在r1,r3上配置默认路由,让r1和r3可以相互通信(这就等于实际公司用两条线拨号上网);现在我们就可以完成关于双接入的负载均衡.
配置思路:
这里我们通过acl、route-map和nat配合实现!
当路由的接口接到数据包时会做一下处理(如图示):
网络拓扑结构:
配置方法:
1) 配置端口ip地址(依据拓扑结构)
2) 配置默认路由
ip route 0.0.0.0 0.0.0.0 10.0.0.1
ip route 0.0.0.0 0.0.0.0 20.0.0.1
3) 配置acl访问控制列表
Router(config)#access-list 100 permit ip host 192.168.1.2 any
Router(config)#access-list 101 permit ip host 192.168.1.3 any //配置ACl规则
注:用acl规则过滤不同的主机,使不同主机经过不同的外网接口访问外网,以实现负载均衡.
4) 配置路由策略(route-map)
Router(config)#route-map goutao permit 10 //定义路由策略并指定其优先级
Router(config-route-map)#match ip address 100 //匹配定义的acl
Router(config-route-map)#match interface Ethernet0/1 //匹配端口(是否为up状态)
Router(config-route-map)#set ip next-hop 20.0.0.1 //如果匹配以上条件指定下一跳地址为 20.0.0.1
Router(config)#route-map goutao permit 20
Router(config-route-map)#match ip address 101
Router(config-route-map)#match interface Ethernet0/2
Router(config-route-map)#set ip next-hop 10.0.0.1
Router(config)#route-map isp2 permit 10
Router(config-route-map)#match ip address 100
Router(config-route-map)#match interface Ethernet0/2
Router(config)#route-map isp3 permit 10
Router(config-route-map)#match ip address 101
Router(config-route-map)#match interface Ethernet0/2
Router(config)#route-map isp1 permit 10
Router(config-route-map)#match ip address 100
Router(config-route-map)#match interface Ethernet0/1
Router(config)#route-map isp4 permit 10
Router(config-route-map)#match ip address 101
Router(config-route-map)#match interface Ethernet0/1
注:配置route-map并定义规则.
5) 关联route-map配置nat规则
Router(config)#ip nat inside source route-map isp1 interface Ethernet0/1 overload // 定义nat规则
Router(config)#ip nat inside source route-map isp2 interface Ethernet0/2 overload
Router(config)#ip nat inside source route-map isp3 interface Ethernet0/2 overload
Router(config)#ip nat inside source route-map isp4 interface Ethernet0/1 overload
注:对照路由策略route-map{isp1/isp2/isp3/isp4},决定数据使用哪个端口的公网地址作为源地址
Router(config)#ip nat inside source static tcp 192.168.1.2 80 20.0.0.2 80 //当外网访问网关服务器的80端口时,则会被转到内部局域网中的web服务器上
Router(config)#ip nat inside source static tcp 192.168.1.3 20 20.0.0.2 20
Router(config)#ip nat inside source static tcp 192.168.1.3 21 20.0.0.2 21 //当外网访问网关服务器的ftp时,则会被转到内部局域网中的ftp服务器上
6) 在内外接口上开启nat功能,内口开启路由策略(route-map)
内--->ip nat inside
内--->p policy route-map goutao
外--->ip nat outside
本文出自 “让我们一起成长!” 博客,请务必保留此出处http://goutao.blog.51cto.com/1917611/365668
公司为了快速可靠的访问外网,分别在网通和电信购买了公网地址。要求:正常情况下网络实现等路径负载均衡,若网通/电信的连接出现问题,则公司内部通过正常的线路访问外网,不会造成网络不同!
********************************************************
模拟网络环境:依据拓扑结构环境,在r1,r3上配置默认路由,让r1和r3可以相互通信(这就等于实际公司用两条线拨号上网);现在我们就可以完成关于双接入的负载均衡.
配置思路:
这里我们通过acl、route-map和nat配合实现!
当路由的接口接到数据包时会做一下处理(如图示):
网络拓扑结构:
配置方法:
1) 配置端口ip地址(依据拓扑结构)
2) 配置默认路由
ip route 0.0.0.0 0.0.0.0 10.0.0.1
ip route 0.0.0.0 0.0.0.0 20.0.0.1
3) 配置acl访问控制列表
Router(config)#access-list 100 permit ip host 192.168.1.2 any
Router(config)#access-list 101 permit ip host 192.168.1.3 any //配置ACl规则
注:用acl规则过滤不同的主机,使不同主机经过不同的外网接口访问外网,以实现负载均衡.
4) 配置路由策略(route-map)
Router(config)#route-map goutao permit 10 //定义路由策略并指定其优先级
Router(config-route-map)#match ip address 100 //匹配定义的acl
Router(config-route-map)#match interface Ethernet0/1 //匹配端口(是否为up状态)
Router(config-route-map)#set ip next-hop 20.0.0.1 //如果匹配以上条件指定下一跳地址为 20.0.0.1
Router(config)#route-map goutao permit 20
Router(config-route-map)#match ip address 101
Router(config-route-map)#match interface Ethernet0/2
Router(config-route-map)#set ip next-hop 10.0.0.1
Router(config)#route-map isp2 permit 10
Router(config-route-map)#match ip address 100
Router(config-route-map)#match interface Ethernet0/2
Router(config)#route-map isp3 permit 10
Router(config-route-map)#match ip address 101
Router(config-route-map)#match interface Ethernet0/2
Router(config)#route-map isp1 permit 10
Router(config-route-map)#match ip address 100
Router(config-route-map)#match interface Ethernet0/1
Router(config)#route-map isp4 permit 10
Router(config-route-map)#match ip address 101
Router(config-route-map)#match interface Ethernet0/1
注:配置route-map并定义规则.
5) 关联route-map配置nat规则
Router(config)#ip nat inside source route-map isp1 interface Ethernet0/1 overload // 定义nat规则
Router(config)#ip nat inside source route-map isp2 interface Ethernet0/2 overload
Router(config)#ip nat inside source route-map isp3 interface Ethernet0/2 overload
Router(config)#ip nat inside source route-map isp4 interface Ethernet0/1 overload
注:对照路由策略route-map{isp1/isp2/isp3/isp4},决定数据使用哪个端口的公网地址作为源地址
Router(config)#ip nat inside source static tcp 192.168.1.2 80 20.0.0.2 80 //当外网访问网关服务器的80端口时,则会被转到内部局域网中的web服务器上
Router(config)#ip nat inside source static tcp 192.168.1.3 20 20.0.0.2 20
Router(config)#ip nat inside source static tcp 192.168.1.3 21 20.0.0.2 21 //当外网访问网关服务器的ftp时,则会被转到内部局域网中的ftp服务器上
6) 在内外接口上开启nat功能,内口开启路由策略(route-map)
内--->ip nat inside
内--->p policy route-map goutao
外--->ip nat outside
本文出自 “让我们一起成长!” 博客,请务必保留此出处http://goutao.blog.51cto.com/1917611/365668
相关文章推荐
- NAT接入双ISP负载均衡+SLA及内部服务器的发布
- NAT的双线接入
- iptables做NAT发布服务器
- 利用NAT做到服务器负载均衡
- NAT双线接入
- 网络地址转换(NAT)实现共享上网及发布服务器
- 手把手教您Linux做网吧双线接入服务器
- UBUNTU server 10.10版服务器电信、联通双线接入加上内网三线接入
- 服务器双线路接入技术常识解析
- 电脑如何做服务器,面对动态IP和NAT转发后无公网IP,一样发布应用
- NAT的双线接入
- 通过NAT实现内网访问外网并发布内网服务器
- NAT的双线接入
- 浅谈内网web服务器发布到公网后路由器回流问题--NAT--PAT---技术研究
- NAT的双线接入 推荐
- 配置iptables NAT端口转发 实现内网服务器端口提供公网接入
- NAT双线接入
- NAT的双线接入
- 服务器租用、托管;提供大带宽租用,百M独享、G口接入、整柜租用更优惠、双线(多线)机房