Linux iptables将nat中内网多台ftp服务器映射出去

运维 系统运维
Linux iptables的问题,我们遇到好多,其中不乏亮点,本文将为大家一个小亮点:Linux iptables将nat中内网多台ftp服务器映射出去。

我们来看看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服务器映射出去的过程还是很简单的。

【编辑推荐】

 

责任编辑:赵鹏 来源: 网络转载
相关推荐

2011-03-21 15:45:55

ClusterSSH管Linux服务器

2011-03-17 13:55:23

iptablesNAT端口映射

2011-03-16 10:43:36

2011-03-16 09:05:33

2011-01-18 09:12:47

Linux服务器集群系统

2011-03-16 09:05:34

iptablesnat

2019-08-21 14:22:31

Linux服务器FTP

2021-09-16 07:52:18

FTP服务器Linux

2017-08-23 10:18:42

2010-08-23 17:23:57

DHCP服务器

2010-11-08 11:53:16

2010-08-29 21:29:25

DHCP服务器

2011-03-07 17:04:02

ProftpdFTP

2011-07-28 13:36:53

2009-04-23 18:17:31

LinuxFTP服务器

2011-09-09 10:03:39

Ubuntu 11.0FTP服务器

2010-09-13 16:13:36

2019-02-26 16:20:52

FTP服务器

2009-02-27 13:22:00

2009-10-27 13:44:04

linux FTP服务
点赞
收藏

51CTO技术栈公众号