配置静态地址映射
操作步骤
- 配置静态地址映射分以下两种方式:
方式一:在接口视图下配置静态映射:
- 执行命令system-view,进入系统视图。
- 执行命令interface interface-type interface-number [ .subnumber ],进入接口或子接口视图。
- 用户根据实际情况选择下面的一条命令执行:
- nat static protocol { tcp | udp } global { global-address | current-interface | interface interface-type interface-number [ .subnumber ] } global-port [ global-port2 ] [ vrrp vrrpid ] inside host-address [ host-address2 ] [ host-port ] [ vpn-instance vpn-instance-name ] [ netmask mask ] [ acl acl-number ] [ global-to-inside | inside-to-global ] [ description description ]
- nat static [ protocol { protocol-number | icmp | tcp | udp } ] global { global-address | current-interface | interface interface-type interface-number [ .subnumber ] } [ vrrp vrrpid ] inside host-address [ vpn-instance vpn-instance-name ] [ netmask mask ] [ acl acl-number ] [ global-to-inside | inside-to-global ] [ description description ]
- nat static protocol { tcp | udp } global { global-address | current-interface | interface interface-type interface-number [ .subnumber ] } global-port global-port2 [ vrrp vrrpid ] inside host-address host-port host-port2 [ vpn-instance vpn-instance-name ] [ netmask mask ] [ acl acl-number ] [ description description ]
方式二:在系统视图下配置静态映射:
- 执行命令system-view,进入系统视图。
- 用户根据实际情况选择下面的一条命令执行:
- nat static protocol { tcp | udp } global global-address global-port [ global-port2 ] inside host-address [ host-address2 ] [ host-port ] [ vpn-instance vpn-instance-name ] [ netmask mask ] [ description description ]
- nat static protocol { tcp | udp } global interface loopback interface-number global-port [ global-port2 ] [ vpn-instance vpn-instance-name ] inside host-address [ host-address2 ] [ host-port ] [ vpn-instance vpn-instance-name ] [ netmask mask ] [ description description ]
- nat static [ protocol { protocol-number | icmp | tcp | udp } ] global { global-address | interface loopback interface-number } inside host-address [ vpn-instance vpn-instance-name ] [ netmask mask ] [ description description ]
- nat static protocol { tcp | udp } global global-address global-port global-port2 inside host-address host-port host-port2 [ vpn-instance vpn-instance-name ] [ netmask mask ] [ description description ]
- 执行命令interface interface-type interface-number [ .subnumber ],进入接口或子接口视图。
- 执行命令nat static enable,在接口下使能nat static功能。
说明
- 如果想实现Global侧VPN,建议在接口下配置静态NAT,设备会自动获取到接口关联的VPN,不需要手动配置Global侧VPN参数;在系统视图下配置静态NAT绑定Global侧VPN的场景可以通过配置Global侧出接口为Loopback接口,然后指定VPN的方式实现。
- 配置静态NAT时,其中的global-address和host-address必须保证和设备现有地址没有重复,包括设备接口地址,用户地址池地址,以避免冲突。
- 在设备上执行undo nat static命令,设备上的静态映射表项不会立刻消失,如果需要立刻清除静态NAT映射表项,请手动执行reset nat session命令来清除静态映射表项信息。
- 多个接口使用同一条nat static映射的情况下,建议使用第二种方法。
- 当配置借用接口地址的静态1:1 NAT(不指定端口号,接口地址对应一个私网地址)时,可能会造成在该接口地址上启用的其他业务无法正常使用,请谨慎选择,如果确定在该接口地址上启用其他应用,请在配置后面增加ACL排除启用应用的端口号。
- 指定的端口号global-port或host-port不能被其他应用程序所占用,否则,配置不生效。