CentOS installed by default only opened 22 ports, if you want to open other ports, then, need to open the required ports.
Such as opening the default port 80 http
editing iptables
vi / etc / sysconfig / iptables
添加
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 3001 -j ACCEPT
Restart the service
/ sbin / service iptables restart
# / sbin / iptables the INPUT -p tcp - dport the -I 22 -j ACCEPT
and save:
# / etc / rc.d / init.d / iptables save
after this restart the computer, the default firewall has open ports 80 and 22
here should be not to restart the computer:
# / etc / init.d / iptables restart
the firewall turned off, shut down its service to:
view firewall information:
# / etc /init.d/iptables status
turn off the firewall service:
# / etc / init.d / iptables STOP
permanently closed? I do not know how permanent law:
#chkconfig -Level 35 iptables OFF
and then check whether they have been:
[root @ vcentos ~] # /etc/init.d/iptables Status
Such as opening the default port 80 http
editing iptables
vi / etc / sysconfig / iptables
vi /etc/sysconfig/iptables
添加
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 3001 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 3001 -j ACCEPT
Restart the service
/ sbin / service iptables restart
/sbin/service iptables restart
Check whether the port is open
/ sbin / iptables -L -n
------------------------------------------------------------------
# / sbin / iptables the INPUT -p tcp - dport the -I 80 -j ACCEPT# / sbin / iptables the INPUT -p tcp - dport the -I 22 -j ACCEPT
and save:
# / etc / rc.d / init.d / iptables save
after this restart the computer, the default firewall has open ports 80 and 22
here should be not to restart the computer:
# / etc / init.d / iptables restart
the firewall turned off, shut down its service to:
view firewall information:
# / etc /init.d/iptables status
turn off the firewall service:
# / etc / init.d / iptables STOP
permanently closed? I do not know how permanent law:
#chkconfig -Level 35 iptables OFF
and then check whether they have been:
[root @ vcentos ~] # /etc/init.d/iptables Status
Reproduced in: https: //my.oschina.net/cjkall/blog/195910