天天看点

使用nat技术实现tcp负载均衡

 使用nat技术实现tcp负载均衡

我使用的是GNS3模拟器实现的,拓扑图如下:

<a target="_blank" href="http://blog.51cto.com/attachment/201212/184727260.png"></a>

要想做成实验必须要有以下条件:

1.       电脑上装有虚拟机

2.       拥有能发布网站的服务器系统(server 2000 即可)

3.       电脑上虚拟三块网卡(我用的是vm1接在c1、vm2接在c3、vm8接在c2)

4.       gns3模拟器和相关思科路由器ios(我用的是3640)

要实现的功能:

C1,C2模拟两台web服务器,通过路由器R1实现外部主机访问的负载均衡

C1:ip 192.168.1.5/24 网关192.168.1.254

C2:ip 192.168.1.6/24 网关192.168.1.254

下面是详细的配置:

R1:

nterface FastEthernet0/0

 ip address 192.168.1.254 255.255.255.0

 ip nat inside

 ip virtual-reassembly

 duplex auto

 speed auto

!

interface FastEthernet1/0

 ip address 200.1.1.1 255.255.255.252

 ip nat outside

no ip http server

ip route 0.0.0.0 0.0.0.0 FastEthernet1/0

ip nat pool web 192.168.1.5 192.168.1.6 prefix-length 24 type rotary

ip nat inside destination list 10 pool web

access-list 10 permit 200.1.1.1

R2:

interface FastEthernet0/0

 ip address 192.168.6.254 255.255.255.0

 ip address 200.1.1.2 255.255.255.252

c1网卡配置:

<a target="_blank" href="http://blog.51cto.com/attachment/201212/184807533.png"></a>

C2网卡配置

<a target="_blank" href="http://blog.51cto.com/attachment/201212/184824811.png"></a>

C3网卡配置

<a target="_blank" href="http://blog.51cto.com/attachment/201212/184845100.png"></a>

Vm1

<a target="_blank" href="http://blog.51cto.com/attachment/201212/184902510.png"></a>

Vm2

<a target="_blank" href="http://blog.51cto.com/attachment/201212/184916326.png"></a>

Vm8

<a target="_blank" href="http://blog.51cto.com/attachment/201212/184932982.png"></a>

验证:

在C3上访问200.1.1.1多次

记录R1上的nat转换:

<a target="_blank" href="http://blog.51cto.com/attachment/201212/184947911.png"></a>

本文转自 chenming421  51CTO博客,原文链接:http://blog.51cto.com/wnqcmq/1093345

继续阅读