Linux iptables將nat中內(nèi)網(wǎng)多臺ftp服務器映射出去
我們來看看Linux iptables將nat中內(nèi)網(wǎng)多臺ftp服務器映射出去的具體方法。
首先分兩步:
1 首先把三臺ftp服務器的源地址轉(zhuǎn)換成網(wǎng)關(guān)的地址
192.168.0.254是網(wǎng)關(guān) 10.0.0.0/24 是網(wǎng)段
iptables -t nat -A POSTROUTING -s 10.0.0.0/24 --sport 20,21 -j SNAT --to-source 192.168.0.254
如果網(wǎng)關(guān)是動態(tài)ip,可以這樣
iptables -t nat -A POSTROUTING -s 10.0.0.0/24 --sport 20,21 -j MASQUERADE
2. 把網(wǎng)關(guān)源地址轉(zhuǎn)換成外網(wǎng)的地址
iptables --table nat --append POSTROUTING -s 192.168.0.254 -j SNAT --to *.*.*.*(外網(wǎng)公布IP)
3。和dns結(jié)合
iptables -t nat -A POSTROUTING -s 10.0.0.0/24 --sport 53 -j SNAT --to-source DNS服務器IP
通過文章,我們不難看出Linux iptables將nat中內(nèi)網(wǎng)多臺ftp服務器映射出去的過程還是很簡單的。
【編輯推薦】
- Linux Iptables 內(nèi)核添加time模塊
- Linux防火墻Iptables入門筆記
- Linux Iptables 語法大全
- 用iptables做IP的靜態(tài)映射
- 如何把iptables外網(wǎng)端口全部映射到內(nèi)網(wǎng)一臺主機上
- 配置Linux 內(nèi)核并利用iptables 做端口映射
- iptables映射端口具體操作