iptables -I INPUT -p tcp --dport 80 -j ACCEPT
iptables -I INPUT -p tcp --dport 22 -j ACCEPT
iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
Save it:
service iptables save
service iptables restart
Check the rule in the iptables:
iptables -L
-------------------------------------------------------
addition:
#close the iptables
/etc/init.d/iptables stop
service iptables stop # stop iptables service
#Check the rule in the iptables
iptables -L
#allow:8080
/sbin/iptables -I INPUT -p tcp --dport 8080 -j ACCEPT
#restart the iptables to take affect:(or you may reboot)
/etc/init.d/iptables restart
#save the change
/etc/rc.d/init.d/iptables save
未经允许不得转载:VPS啦 » How to allow 80 3306 22 in your CENTOS 6.0 iptables