CentOS 7 Open Port and centos Open Port
After CentOS is upgraded to 7, iptables cannot be used to control the Linuxs port, because CentOS 7 uses firewalld instead of the original iptables. The following describes how to use firewalld to open a Linux Port:
1. check whether a port is open
[Root @ localhost bin] # firewall-cmd -- query-port = 8080/tcpno
2. Enable a port permanently
Firewall-cmd -- zone = public -- add-port = 8080/tcp -- permanent
[Root @ localhost bin] # firewall-cmd -- add-port = 8080/tcp -- permanentsuccess
Or:
[Root @ localhost bin] # firewall-cmd -- zone = public -- add-port = 8080/tcp -- permanent
3. open multiple ports at the same time
[Root @ localhost taotao] # firewall-cmd -- zone = public -- add-port = 30000-30999/tcp -- permanent [root @ localhost taotao] # firewall-cmd -- reload
Command description:
-- Zone # Scope
-- Add-port = 80/tcp # add a port in the format of port/communication protocol
-- Permanent # takes effect permanently. If this parameter is not set, it becomes invalid after restart.
4. Restart the Firewall
[Root @ localhost bin] # firewall-cmd -- reloadsuccess