實(shí)現(xiàn)內(nèi)網(wǎng)通過公網(wǎng)域名訪問NAT映射的內(nèi)網(wǎng)服務(wù)器
實(shí)現(xiàn)內(nèi)網(wǎng)通過外網(wǎng)域名訪問NAT 映射的內(nèi)網(wǎng)服務(wù)器大家都知道在用Huawei 的中低端路由器做NAT 地址映射時(shí)只能支持 “外網(wǎng)訪問” 不支持 “內(nèi)網(wǎng)訪問”。也就是說只支持NAT 映射后外網(wǎng)IP 通過外
實(shí)現(xiàn)
內(nèi)網(wǎng)通過外網(wǎng)域名訪問NAT 映射的內(nèi)網(wǎng)服務(wù)器
大家都知道在用Huawei 的中低端路由器做NAT 地址映射時(shí)只能支持 “外網(wǎng)訪問” 不支持 “內(nèi)網(wǎng)訪問”。也就是說只支持NAT 映射后外網(wǎng)IP 通過外網(wǎng)域名(外
,網(wǎng)IP )訪問NAT 映射的服務(wù)器 ,不支持NAT 映射后內(nèi)網(wǎng)IP 通過外網(wǎng)域名(外網(wǎng)IP )訪問NAT 映射的服務(wù)器, 而在實(shí)際應(yīng)用中實(shí)現(xiàn)后者還是很有意義的,相信遇到這個(gè)問題各位800的兄弟還是可以聽到用戶說:“三四百塊的東西能支持的,這么貴的華為設(shè)備居然不支持#¥!”不知以何言以對(duì)好??! 用戶當(dāng)然也會(huì)問有沒有實(shí)現(xiàn)的方法?。?想了個(gè)方法供大家參考,也做了實(shí)驗(yàn)是可以實(shí)現(xiàn)的, 但目前這個(gè)方法實(shí)現(xiàn)的前提是需要NAT 必需是以地址池 做的。(原因是在做實(shí)驗(yàn)時(shí), 發(fā)現(xiàn)當(dāng)策略匹配到的目的地址是路由器本身的接口地址時(shí), 策略不會(huì)被匹配! 所以如果將10.153.2.115設(shè)為ETH0的接口地址,做nat outbound interface 的話, 去往10.153.2.115的IP 包就不會(huì)被重定向到 next-hop 192.168.0.33了. )
以上圖拓?fù)錇槔?/p>
1.FTP server通過路由器的NAT 映射對(duì)外網(wǎng)提供FTP 服務(wù)。
2. 內(nèi)網(wǎng)用戶通過外網(wǎng)域名(外網(wǎng)IP )來訪問FTP server 。
配置路由器如上圖:
1. 在路由器上做策略路由把192.168.0.0/24 訪問10.153.2.115這個(gè)地址的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 上建立一個(gè)loopback 虛擬口,將這個(gè)loopback 口的IP 設(shè)成跟路由器上的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)一直 “下一步”到 “添加新設(shè)備”
(3)“下一步”選“否,我想從列表選擇硬件(O )。”
,(4)“下一步”選“網(wǎng)卡”
(5)左選“Microsoft ”右選“Microsoft Loopback Adapter”
,(6)“下一步”到“完成”。
(7)完成以后會(huì)在網(wǎng)絡(luò)連接里多一快網(wǎng)卡。
,(8)設(shè)置“Microsoft Loopback Adapter”網(wǎng)卡
IP