天天看點

PAT&NAT在企業上網中的綜合應用

昨天和哥們一塊喝酒,說到他們機關從電信那裡租用了4個公網位址,機關上想讓上司單獨使用一個IP位址,普通員工共同使用一個IP位址,伺服器使用一個IP,在區域網路中,上司、普通員工、伺服器都是用私有位址并在一個網段内。

要實作這樣的目标,主要是在企業出口路由器上應用PAT(端口位址轉換)和NAT(網絡位址轉換)。下面是根據上面案例抽象出的網絡模型:

拓撲圖:

網絡目标:

企業從ISP獲得3個公網位址:200.1.1.1,168.1.1.2,168.1.1.3

C1,C2通過PAT使用200.1.1.1這個位址。

C3使用168.1.1.2;

C4使用168.1.1.3;

R1設定:

!

interface FastEthernet0/0

 ip address 192.168.1.254 255.255.255.0

 ip nat inside

 ip virtual-reassembly

 duplex auto

 speed auto

interface Serial1/0

 ip address 200.1.1.1 255.255.255.252

 ip nat outside

 serial restart-delay 0

ip route 0.0.0.0 0.0.0.0 200.1.1.2

ip nat inside source list 10 interface Serial1/0 overload

ip nat inside source static 192.168.1.3 168.1.1.2

ip nat inside source static 192.168.1.4 168.1.1.3

access-list 10 permit 192.168.1.1

access-list 10 permit 192.168.1.2

作為企業網關隻需要設定上面的内容就可以實作我們的PAT和NAT設計目标了。可能會有朋友想知道R2的設定,列如下參考:

interface Serial0/0

 ip address 200.1.1.2 255.255.255.252

interface Serial0/1

 ip address 200.2.1.1 255.255.255.252

router eigrp 100

 redistribute static metric 2048 20 255 255 1 (路由重分發)

 passive-interface Serial0/0

 network 200.1.1.0

 network 200.2.1.0

 no auto-summary

ip route 168.1.1.2 255.255.255.255 200.1.1.1

ip route 168.1.1.3 255.255.255.255 200.1.1.1

現面來驗證試驗結果(用wireshark監聽R2的S0/0接口):

<a target="_blank" href="http://blog.51cto.com/attachment/201005/104237832.jpg"></a>

<a target="_blank" href="http://blog.51cto.com/attachment/201005/104422768.jpg"></a>

<a target="_blank" href="http://blog.51cto.com/attachment/201005/104457668.jpg"></a>

<a target="_blank" href="http://blog.51cto.com/attachment/201005/104555266.jpg"></a>

<a target="_blank" href="http://blog.51cto.com/attachment/201005/104643130.jpg"></a>

<a target="_blank" href="http://blog.51cto.com/attachment/201005/104725877.jpg"></a>

<a target="_blank" href="http://blog.51cto.com/attachment/201005/104802721.jpg"></a>

<a target="_blank" href="http://blog.51cto.com/attachment/201005/104834370.jpg"></a>

根據實驗結果,PAT&amp;NAT方案是成功的。

本文轉自 tiger506 51CTO部落格,原文連結:http://blog.51cto.com/tiger506/323326,如需轉載請自行聯系原作者

繼續閱讀