本實例中硬件配置同上,運用了動態NAT地址轉換功能。將2501的以太口作為內部端口,同步端口0作為外部端口。其中10.1.1.0網段采用動態地址轉換。對應內部合法地址為192.1.1.2~192.1.1.10
Current configuration:
version 11.3
no service password-encryption
hostname 2501
ip nat pool aaa 192.1.1.2 192.1.1.10 netmask 255.255.255.0
ip nat inside source list 1 pool aaa
interface Ethernet0
ip address 10.1.1.1 255.255.255.0
ip nat inside
interface Serial0
ip address 192.1.1.1 255.255.255.0
ip nat outside
no ip mroute-cache
bandwidth 2000
no fair-queue
clockrate 2000000
interface Serial1
no ip address
shutdown
no ip classless
ip route 0.0.0.0 0.0.0.0 Serial0
access-list 1 permit 10.1.1.0 0.0.0.255
line con 0
line aux 0
line vty 0 4
password cisco
end
3、復用動態地址轉換適用的環境:
復用動態地址轉換首先是一種動態地址轉換,但是它可以允許多個內部本地地址共用一個內部合法地址。只申請到少量IP地址但卻經常同時有多于合法地址個數的用戶上外部網絡的情況,這種轉換極為有用。
注意:當多個用戶同時使用一個IP地址,外部網絡通過路由器內部利用上層的如TCP或UDP端口號等唯一標識某臺計算機。
復用動態地址轉換配置步驟:
在全局設置模式下,定義內部合地址池
ip nat pool 地址池名字 起始IP地址 終止IP地址 子網掩碼
其中地址池名字可以任意設定。
在全局設置模式下,定義一個標準的access-list規則以允許哪些內部本地地址可以進行動態地址轉換。
access-list 標號 permit 源地址 通配符
其中標號為1-99之間的整數。
在全局設置模式下,設置在內部的本地地址與內部合法IP地址間建立復用動態地址轉換。
ip nat inside source list 訪問列表標號 pool 內部合法地址池名字 overload
在端口設置狀態下,指定與內部網絡相連的內部端口
ip nat inside
在端口設置狀態下,指定與外部網絡相連的外部端口
ip nat outside
實例:應用了復用動態NAT地址轉換功能。將2501的以太口作為內部端口,同步端口0作為外部端口。10.1.1.0網段采用復用動態地址轉換。假設企業只申請了一個合法的IP地址192.1.1.1。
2501的配置
Current configuration:
version 11.3
no service password-encryption
hostname 2501
ip nat pool bbb 192.1.1.1 192.1.1.1 netmask 255.255.255.0
ip nat inside source list 1 pool bbb overload
interface Ethernet0
ip address 10.1.1.1 255.255.255.0
ip nat inside
interface Serial0
ip address 192.1.1.1 255.255.255.0
ip nat outside
no ip mroute-cache
bandwidth 2000
no fair-queue
clockrate 2000000
interface Serial1
no ip address
shutdown
no ip classless
ip route 0.0.0.0 0.0.0.0 Serial0
access-list 1 permit 10.1.1.0 0.0.0.255
line con 0
line aux 0
line vty 0 4
password cisco
end