實現(xiàn)內網(wǎng)通過公網(wǎng)域名訪問NAT映射的內網(wǎng)服務器
實現(xiàn)內網(wǎng)通過外網(wǎng)域名訪問NAT 映射的內網(wǎng)服務器大家都知道在用Huawei 的中低端路由器做NAT 地址映射時只能支持 “外網(wǎng)訪問” 不支持 “內網(wǎng)訪問”。也就是說只支持NAT 映射后外網(wǎng)IP 通過外
實現(xiàn)
內網(wǎng)通過外網(wǎng)域名訪問NAT 映射的內網(wǎng)服務器

大家都知道在用Huawei 的中低端路由器做NAT 地址映射時只能支持 “外網(wǎng)訪問” 不支持 “內網(wǎng)訪問”。也就是說只支持NAT 映射后外網(wǎng)IP 通過外網(wǎng)域名(外
,網(wǎng)IP )訪問NAT 映射的服務器 ,不支持NAT 映射后內網(wǎng)IP 通過外網(wǎng)域名(外網(wǎng)IP )訪問NAT 映射的服務器, 而在實際應用中實現(xiàn)后者還是很有意義的,相信遇到這個問題各位800的兄弟還是可以聽到用戶說:“三四百塊的東西能支持的,這么貴的華為設備居然不支持#¥!”不知以何言以對好啊! 用戶當然也會問有沒有實現(xiàn)的方法?。?想了個方法供大家參考,也做了實驗是可以實現(xiàn)的, 但目前這個方法實現(xiàn)的前提是需要NAT 必需是以地址池 做的。(原因是在做實驗時, 發(fā)現(xiàn)當策略匹配到的目的地址是路由器本身的接口地址時, 策略不會被匹配! 所以如果將10.153.2.115設為ETH0的接口地址,做nat outbound interface 的話, 去往10.153.2.115的IP 包就不會被重定向到 next-hop 192.168.0.33了. )
以上圖拓撲為例:
1.FTP server通過路由器的NAT 映射對外網(wǎng)提供FTP 服務。
2. 內網(wǎng)用戶通過外網(wǎng)域名(外網(wǎng)IP )來訪問FTP server 。
配置路由器如上圖:
1. 在路由器上做策略路由把192.168.0.0/24 訪問10.153.2.115這個地址的IP 包的next-hop 重定向到FTP server 192.168.0.33。路由器配置如下:
[Router] ! version 1.74 nat address-group 10.153.2.115 10.153.2.115 115 info-center console firewall enable aaa-enable ftp-server enable ! acl 1 match-order auto rule normal permit source 192.168.0.0 0.0.0.255 ! acl 188 match-order auto rule normal permit ip source 192.168.0.0 0.0.0.255 destination 10.153.2.115 0.0.0.0 rule normal deny ip source any destination any ! interface Aux0 async mode flow link-protocol ppp
,! interface Ethernet0 ip address 10.153.2. 210 255.255.255.0 nat outbound 1 address-group 115 nat server global 10.153.2.115 ftp inside 192.168.0.33 ftp tcp ! interface Ethernet1 ip address 192.168.0.1 255.255.255.0 ip policy route-policy heihei ! route-policy heihei permit 1 if-match ip address 188 apply ip next-hop 192.168.0.33 quit ! ip route-static 0.0.0.0 0.0.0.0 10.153.2.1 preference 60 ! return
2. 在FTP server 上建立一個loopback 虛擬口,將這個loopback 口的IP 設成跟路由器上的NAT 映射IP 一樣的地址。FTP server IP信息如下:
C:Documents and Settings?ministrator>ipconfig /all Windows 2000 IP Configuration Host Name . . . . . . . . . . . . : xyc Primary DNS Suffix . . . . . . . : Node Type . . . . . . . . . . . . : Hybrid IP Routing Enabled. . . . . . . . : No WINS Proxy Enabled. . . . . . . . : No Ethernet adapter loopback: Connection-specific DNS Suffix . : Description . . . . . . . . . . . : Microsoft Loopback Adapter Physical Address. . . . . . . . . : 02-00-4C-4F-4F-50 DHCP Enabled. . . . . . . . . . . : No IP Address. . . . . . . . . . . . : 10.153.2.115 Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : 192.168.0.33 DNS Servers . . . . . . . . . . . : Ethernet adapter 2: Connection-specific DNS Suffix . : Description . . . . . . . . . . . : Intel(R) PRO/100 VE Network Connecti on Physical Address. . . . . . . . . : 00-11-11-14-EE-EA DHCP Enabled. . . . . . . . . . . : No IP Address. . . . . . . . . . . . : 192.168.0.33 Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : 192.168.0.1 DNS Servers . . . . . . . . . . . : 10.72.66.36 10.72.66.37
3. 以windows2000為例添加loopback 口方法如下:
(1)在 控制面板 雙擊 添加/刪除硬件
,
(2)一直 “下一步”到 “添加新設備”

(3)“下一步”選“否,我想從列表選擇硬件(O )?!?/p> ,

(4)“下一步”選“網(wǎng)卡”

(5)左選“Microsoft ”右選“Microsoft Loopback Adapter”
,
(6)“下一步”到“完成”。

(7)完成以后會在網(wǎng)絡連接里多一快網(wǎng)卡。
,
(8)設置“Microsoft Loopback Adapter”網(wǎng)卡

IP