NAT實戰——設置動態NAT

動態NAT

拓撲圖以下:網絡

NAT實戰——設置動態NAT

實驗步驟

一、設置三層交換機swide

sw#conf t 
Enter configuration commands, one per line.  End with CNTL/Z.
sw(config)#no ip routing 
sw(config)#

二、設置路由R1code

R1#conf t 
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#int f 0/1
R1(config-if)#ip add 192.168.20.1 255.255.255.0         //僅設置IP地址與子網掩碼
R1(config-if)#no shut 
*Mar  1 00:00:54.063: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up
*Mar  1 00:00:55.063: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
R1(config-if)#int f 0/0
R1(config-if)#ip add 192.168.100.1 255.255.255.0          //僅設置IP地址與子網掩碼
R1(config-if)#no shut 
R1(config-if)#ex 
*Mar  1 00:01:08.423: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar  1 00:01:09.423: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R1(config)#

三、對三臺PC機進行設置blog

PC1ip

PC1> 
PC1> ip 192.168.20.20 192.168.20.1
Checking for duplicate address...
PC1 : 192.168.20.20 255.255.255.0 gateway 192.168.20.1

PC1>

PC2路由

PC2> 
PC2> ip 192.168.20.30 192.168.20.1 
Checking for duplicate address...
PC1 : 192.168.20.30 255.255.255.0 gateway 192.168.20.1

PC2>

PC3it

PC3> 
PC3> 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

PC3>

注意:此時理論上是已經能夠作到全網互通的,具體見下圖。若是沒法鏈接請自行檢查命令。

NAT實戰——設置動態NAT

爲知足實驗要求,下面將正式進行動態NAT的設置。io

R1ast

R1(config)#
R1(config)#ip access-list standard zhy                          //設置命名訪問控制列表
R1(config-std-nacl)#permit 192.168.20.0 0.0.0.255 
R1(config)#ip nat pool test 12.0.0.10 12.0.0.20 netmask 255.255.255.0        //設置公網地址池
R1(config)#
*Mar  1 00:09:46.123: %LINEPROTO-5-UPDOWN: Line protocol on Interface NVI0, changed state to up
R1(config)#ip nat inside source list zhy pool test                  //實現網絡地址轉換

R1(config)#int f 0/1
R1(config-if)#ip nat inside                          //啓用內部NAT
R1(config-if)#int f 0/0
R1(config-if)#ip nat outside                         //啓用外部NAT
R1(config-if)#ex

驗證結果

NAT實戰——設置動態NAT

以上就是動態NAT的地址轉換,不須要手動進行指定,他自動轉換的都是區間範圍內的地址

相關文章
相關標籤/搜索