DNAT
DNAT(Destination Network Address Translation):目的地址转换的作用是将一组本地内部的地址映射到一组全球地址。通过端口映射实现从外网可以访问内部的机器。
例子:
有两台服务器Server A(具有双网卡em1, em2), Server B,其中(proxy_ip和private_ip可以ping通):
1. Server A:具有内网地址proxy_ip (proxy_nic=em1)和外网地址public_ip (public_nic=em2);
2. Server B:具有内网地址private_ip;
具体配置
只需要配置Server A实现到ServerB的端口映射,即可从外网通过Server A访问Server B。
iptables-A INPUT -p tcp -d $public_ip --dport $public_port -j ACCEPT