实现内网通过外网域名访问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\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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值