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服務器映射出去的過程還是很簡單的。
【編輯推薦】
- Linux Iptables 內核添加time模塊
- Linux防火墻Iptables入門筆記
- Linux Iptables 語法大全
- 用iptables做IP的靜態映射
- 如何把iptables外網端口全部映射到內網一臺主機上
- 配置Linux 內核并利用iptables 做端口映射
- iptables映射端口具體操作