[TIP][转载]使用nat实现负载均衡

[复制链接]
查看11 | 回复0 | 2005-2-28 12:57:00 | 显示全部楼层 |阅读模式
转自:“共享联盟”技术论坛
作者:雪孤寒
使用nat实现负载均衡
如图所示,
1、一个外部主机要访问你的服务器,如果你的服务器的ip地址为192.168.0.1(注:此ip为虚拟主机地址)。
2、路由器收到此信息,在本地的nat pool里进行检索,并建立一个会话,发送信息到在你的nat pool中的下一个真正的主机。
3、真正的主机192.168.0.2接受到信息并回应。
4、第二个主机要访问你的服务器192.168.0.1,重复1-2部操作,192.168.0.3回应请求
配置如下:
router#conf t
router(config)#ip nat pool realhost 192.168.0.2 192.168.0.11 prefix-length 24 type rotary
;此行表示建立一个nat pool名为realhost,地址范围从2到11,掩码长度为24位,使用循环相应。
router(config)#access-list 1 permit 192.168.0.1
;此行表示建立一个访问控制列表1,允许192.168.0.1地址
router(config)#ip nat inside destination list 1 pool realhost
;此行表示建立一个nat对应表,要注意,destination和source的用法
router(config)#interface s0
router(config-if)#ip nat outside
router(config-if)#interface e0
router(config-if)#ip nat inside
router(config-if)#end
router#wr
至此,一个使用nat实现负载均衡的配置已建立,要求你的其他配置正确,此处,没有写出s0和e0的ip地址,所用ip也为私有地址,可根据实际情况变更
回复

使用道具 举报

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

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行