我们来看看Linux iptables将nat中内网多台ftp服务器映射出去的具体方法。
首先分两步:
1 首先把三台ftp服务器的源地址转换成网关的地址
192.168.0.254是网关 10.0.0.0/24 是网段
iptables -t nat -A POSTROUTING -s 10.0.0.0/24 --sport 20,21 -j SNAT --to-source 192.168.0.254
如果网关是动态ip,可以这样
iptables -t nat -A POSTROUTING -s 10.0.0.0/24 --sport 20,21 -j MASQUERADE
2. 把网关源地址转换成外网的地址
iptables --table nat --append POSTROUTING -s 192.168.0.254 -j SNAT --to *.*.*.*(外网公布IP)
3。和dns结合
iptables -t nat -A POSTROUTING -s 10.0.0.0/24 --sport 53 -j SNAT --to-source DNS服务器IP
通过文章,我们不难看出Linux iptables将nat中内网多台ftp服务器映射出去的过程还是很简单的。
【编辑推荐】
下一篇:用注册表防止病毒复活