天天看點

使用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

繼續閱讀