128.30.14.221 is a public IP address, 128.30.14.233 is a private IP address, and a normal Web server is set up on 233. Objective: To open a Web port 88 on 221 and map it to 80 on 233
------- Ing Web port ------
service iptables stopiptables -Xecho 1 >/proc/sys/net/ipv4/ip_forward/sbin/modprobe iptable_natiptables -t nat -A PREROUTING -d 128.30.14.221 -p tcp -m tcp --dport 88 -j DNAT --to-destination 128.30.14.233:80iptables -t nat -A POSTROUTING -d 128.30.14.233 -p tcp --dport 80 -j MASQUERADEservice iptables saveservice iptables start
Open the browser and enter http: // 128.30.14.221: 88. The webpage is displayed normally.
-------- Ing FTP port -------
128.30.14.221 is a public IP address, 128.30.14.233 is a private IP address, and a normal FTP server is set up on 233. Objective: To open a port 88 on 221 and map it to port 21 on 233.
Run script on 221:
service iptables stopiptables -Xecho 1 >/proc/sys/net/ipv4/ip_forward/sbin/modprobe iptable_natiptables -t nat -A PREROUTING -d 128.30.14.221 -p tcp -m tcp --dport 88 -j DNAT --to-destination 128.30.14.233:21iptables -t nat -A POSTROUTING -d 128.30.14.233 -p tcp --dport 21 -j MASQUERADEservice iptables saveservice iptables start
When FTP or CuteFTP is connected to 128.30.14.221: 88, remember to use PASV passive mode, but still encounter 425 security error. At this time, you need to run the script on the 233 Server:
/Sbin/modprobe ip_conntrack_ftp
/Sbin/modprobe ip_nat_ftp
Try again. Everything is normal.
Iptables port ing and vsftp security check 425 Security Solution