NAT協議的配置

 實驗目的:

掌握網絡地址轉換NAT/PAT的配置。

實驗環境拓撲圖及要求:

 

image

 

實驗要求:

1、 如圖所示,路由器A模擬PC,實現全網互通。但是PC不能PING通外網。

基本思路:

實現全網互通.

1:命名

2:配置接口IP地址

3:配置RIP

4:宣告網段

(一)靜態NAT:

1:配置外部端口IP

2:配置內部端口的IP

3:建立靜態地址轉換

4:在內部和外部端口上啓用NAT

(二)動態NAT:

1:配置外部端口IP

2:配置內部端口的IP

3:定義內部可訪問外部的控制列表

4:定義合法地址池

5:實現網絡地址轉換

6:在內部和外部端口上啓用NAT

(三)PAT:

1:配置外部端口IP

2:配置內部端口的IP

3:定義內部訪問列表

4:定義合法地址池

5:設置複用動態IP地址轉換

6:在內部和外部端口上啓用NAT

2、

配置:

--------------------------------------------------------

RA:

en

conf t

host PC

no ip routing //禁用路由功能

no ip domain-lo

int f0/0 //配置端口IP

ip add 192.168.1.1 255.255.255.0

no sh

exit

ip default-gateway 192.168.1.2 //指向網關

end

----------------------------------------------------------

RB:

en

conf t

host RB

no ip domain-lo

int f0/0

ip add 202.1.1.1 255.255.255.0

no sh

exit

int f1/0

ip add 192.168.1.2 255.255.255.0

no sh

exit

router rip //啓用rip

version 2 //配置版本2

no auto-summary //不自動彙總

network 202.1.1.0 //宣告網段

end

---------------------------------------------------------

RC:

en

conf t

host RC

no ip domain-lo

int f0/0

ip add 202.1.2.1 255.255.255.0

no sh

exit

int f1/0

ip add 202.1.1.2 255.255.255.0

no sh

exit

router rip

version 2

no auto-summary

network 202.1.2.0

network 202.1.1.0

end

---------------------------------------------------------

RD:

en

conf t

host RD

no ip domain-lo

int f0/0

ip add 202.1.2.2 255.255.255.0

no sh

exit

router rip

version 2

no auto-summary

network 202.1.2.0

end

---------------------------------------------------------

clip_image002clip_image004clip_image006clip_image008

3、 測試靜態NAT :
在路由器B上配置靜態NAT,將192.168.1.1 地址轉換成202.1.1.10,實現路由器A能訪問到外部網絡,列出轉換列表。

配置:

RB:

conf t

ip nat inside source static 192.168.1.1 202.1.1.10 //配置NAT轉換地址

int f0/0

ip nat outside //在端口上配置NAT出

exit

int f1/0

ip nat inside //在端口上配置NAT進

end

clip_image010clip_image012clip_image014

4、 測試動態NAT:
刪除之前的NAT,在路由器B上配置動態NAT,將192.168.1.0 網段內的地址轉換成202.1.1.50-60,實現路由器A能訪問到外部網絡,列出轉換列表。

配置:

RB:

conf t

access-list 1 permit 192.168.1.0 0.0.0.255 //配置允許訪問列表

ip nat pool test0 202.1.1.50 202.1.1.60 netmask 255.255.255.0 //配置合法IP地址池

ip nat inside source list 1 pool test0 //將控制列表和地址池綁定

int f0/0

ip nat outside

exit

int f1/0

ip nat inside

end

clip_image016clip_image018clip_image020clip_image014[1]

5、 測試PAT:

a) 刪除之前的NAT,在路由器B上配置PAT,複用到外部全局地址,將192.168.1.0 網段內的地址轉換成202.1.1.100,實現路由器A能訪問到外部網絡,列出轉換列表。

配置:

RB:

conf t

access-list 1 permit 192.168.1.0 0.0.0.255 //配置允許訪問的控制列表

ip nat pool only 202.1.1.100 202.1.1.100 netmask 255.255.255.0 //配置合法地址池

ip nat inside source list 1 pool only overload //綁定

int f0/0

ip nat outside

exit

int f1/0

ip nat inside

end

clip_image022

clip_image023

b) 刪除之前的NAT,在路由器B上配置PAT,複用到外部接口地址,將192.168.1.0 網段內的地址轉換成202.1.1.1,實現路由器能訪問到外部網絡,列出轉換列表。

配置:

RB:

conf t

access-list 1 permit 192.168.1.0 0.0.0.255

ip nat inside source list 1 interface f0/0 overload //配置爲綁定到接口上

int f0/0

ip nat outside

exit

int f1/0

ip nat inside

end

clip_image002[4]clip_image004[4]

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章