实现内网通过外网域名访问NAT映射的内网服务器
2012-02-21 20:20
1186 查看
大家都知道在用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\administrator>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
相关文章推荐
- 通过NAT实现内网访问外网并发布内网服务器
- NAT分析(内网用户通过域名访问服务器)
- 内网服务器配置DDNS实现外网固定域名访问
- 用静态NAT实现外网PC访问内网服务器
- tomcat 绑定花生壳域名实现访问去端口号和项目名称通过域名访问内网可以,外网不加项目名怎么不行?
- 用NAT实现外网对内网服务器的访问
- 内网FTP服务器映射外网访问实现
- 如何把域名映射到内网服务器(内网能访问,但是通过域名不能访问)
- NAT分析(内网用户通过域名访问服务器)
- 无需端口映射实现从外网访问内网服务器网站
- 花生壳实现SVN客户端远程访问某局域网内SVN服务器(内网ip地址映射外网地址)
- 端口映射,在内网映射外网,利用P2P实现外面跨网穿透nat访问内网80网站和应用
- NAT外网访问内网方法,内网端口映射外网ip
- Seafile内外网同时访问的实现(端口映射:将外网的一个端口映射到内网80端口)
- VMware NAT端口映射 外网可以访问内网虚拟机
- ADSL宽带路由器实现外网访问公司内网服务器_ 路由交换
- MySQL workbench外网通过PuTTY设置SSH的tunnels远程访问内网服务器中的MySQL
- CentOS7下搭建nginx反向代理服务器使得外网可以二级域名访问内网应用