PAT配置

PAT配置

1.定義訪問控制列表:
router(config)#access-list 1 permit 10.1.1.0 0.0.0.255
2.定義合法IP地址池:
router(config)#ip nat pool onlyone 61.159.62.131 61.159.62.131 netmask 255.255.255.248
3.實現網絡地址轉換:
router(config)#ip nat insde source list 1 pool onlyone overload
4.在內部和外部端口上啓用NAT,以及配置默認路由:與靜態NAT配相同
5.定義內部訪問列表:
router(config)#access-list 1 permit 10.1.1.0 0.0.0.255
6.定義合法的IP地址池:

由於直接使用外部接口地址,所以不在定義IP地址池

7.設置複用動態IP地址轉換
router(config)#ip nat inside source list 1 interface FastEthernet 0/0 overload

Demo4:PAT

在這裏插入圖片描述

sw:
sw#conf t
sw(config)#no ip routing
sw(config)#int f1/0 
sw(config-if)#speed 100
sw(config-if)#dup full
sw(config-if)#ex
R1:
R1#conf t
R1(config)#int f0/0
R1(config-if)#ip add 192.168.100.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#int f0/1
R1(config-if)#ip add 12.0.0.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#ex
R1(config)#access-list 1 permit 192.168.100.0 0.0.0.255
R1(config)#ip nat inside source list 1 interface fastEthernet 0/1 overload 
R1(config)#int f0/0
R1(config-if)#ip nat inside
R1(config-if)#int f0/1
R1(config-if)#ip nat outside
R1(config-if)#end
R1#debug ip nat
IP NAT debugging is on
主機配置IP地址:
PC1> ip 192.168.100.10 192.168.100.1
Checking for duplicate address...
PC1 : 192.168.100.10 255.255.255.0 gateway 192.168.100.1

PC2> ip 192.168.100.20 192.168.100.1
Checking for duplicate address...
PC1 : 192.168.100.20 255.255.255.0 gateway 192.168.100.1

PC3> ip 12.0.0.12 12.0.0.1
Checking for duplicate address...
PC1 : 12.0.0.12 255.255.255.0 gateway 12.0.0.1
測試互通:
PC1> ping 12.0.0.12 -t                                       
12.0.0.12 icmp_seq=1 timeout
84 bytes from 12.0.0.12 icmp_seq=2 ttl=63 time=31.424 ms
84 bytes from 12.0.0.12 icmp_seq=3 ttl=63 time=31.560 ms
84 bytes from 12.0.0.12 icmp_seq=4 ttl=63 time=31.278 ms
84 bytes from 12.0.0.12 icmp_seq=5 ttl=63 time=39.174 ms

R1#
*Mar  1 00:12:39.347: NAT: s=192.168.100.10->12.0.0.1, d=12.0.0.12 [48340]
//此時在R1中可以看到192.168.100.10轉換成12.0.0.1這個外網地址

PC2> ping 12.0.0.12 -t                                       
84 bytes from 12.0.0.12 icmp_seq=1 ttl=63 time=31.402 ms
84 bytes from 12.0.0.12 icmp_seq=2 ttl=63 time=33.339 ms
84 bytes from 12.0.0.12 icmp_seq=3 ttl=63 time=38.074 ms

R1#
*Mar  1 00:15:17.887: NAT*: s=192.168.100.20->12.0.0.1, d=12.0.0.12 [48502]
//此時在R1中可以看到192.168.100.20也轉換成12.0.0.1這個外網地址
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章