在CentOS 6中,放行指定的端口8080,或者端口3306
可以采用两种方式,一种方式是使用vim编辑/etc/sysconfig/iptables文件,另一种方式是使用命令行方式。
一、使用vim编辑/etc/sysconfig/iptables文件的方式,开放端口8080,
1、使用vim编辑/etc/sysconfig/iptables文件,在末尾处添加配置文本,
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
保存编辑后的iptables文件,
[root@centos6 ~]# vim /etc/sysconfig/iptables
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-