实现内网通过公网域名访问NAT映射的内网服务器
实现内网通过外网域名访问NAT 映射的内网服务器大家都知道在用Huawei 的中低端路由器做NAT 地址映射时只能支持 “外网访问” 不支持 “内网访问”。也就是说只支持NAT 映射后外网IP 通过外
实现
内网通过外网域名访问NAT 映射的内网服务器

大家都知道在用Huawei 的中低端路由器做NAT 地址映射时只能支持 “外网访问” 不支持 “内网访问”。也就是说只支持NAT 映射后外网IP 通过外网域名(外
,网IP )访问NAT 映射的服务器 ,不支持NAT 映射后内网IP 通过外网域名(外网IP )访问NAT 映射的服务器, 而在实际应用中实现后者还是很有意义的,相信遇到这个问题各位800的兄弟还是可以听到用户说:“三四百块的东西能支持的,这么贵的华为设备居然不支持#¥!”不知以何言以对好啊! 用户当然也会问有没有实现的方法啊! 想了个方法供大家参考,也做了实验是可以实现的, 但目前这个方法实现的前提是需要NAT 必需是以地址池 做的。(原因是在做实验时, 发现当策略匹配到的目的地址是路由器本身的接口地址时, 策略不会被匹配! 所以如果将10.153.2.115设为ETH0的接口地址,做nat outbound interface 的话, 去往10.153.2.115的IP 包就不会被重定向到 next-hop 192.168.0.33了. )
以上图拓扑为例:
1.FTP server通过路由器的NAT 映射对外网提供FTP 服务。
2. 内网用户通过外网域名(外网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 )。”
,
(4)“下一步”选“网卡”

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

(7)完成以后会在网络连接里多一快网卡。
,
(8)设置“Microsoft Loopback Adapter”网卡

IP