CentOS 7 open port command

To open the default MySQL port 3306 as an example:
Adding port
firewall-cmd --zone = public --add- port = 3306 / tcp --permanent

Refresh rule
firewall-cmd --reload

View all too open ports
firewall-cmd --list-ports

Check the specified port
firewall-cmd --zone = public --query- port = 3306 / tcp

Delete the specified port
firewall-cmd --zone = public --remove- port = 3306 / tcp --permanent

Parameter Description:
1. firwall-cmd: the operation is a tool provided for Linux firewall
2. zone: zone is firewalld units, use the public default, firewalld zone 9 as follows:
        -1 drop (discard) any received network data is discarded, no reply, sent public network connection
        network connection any received -2 block (restrictions) are icmp-host-prohibited information IPV4 and icmp6-adm-prohibited information of the IPV6 rejected
        -3 public (public) use in public areas, can not believe the other computers in the network will not cause harm to your computer, connect only after receiving selected
        extranet -4 external (outside) especially for camouflage enabled router function. You can not trust other computing from the network, you can not trust that they will not cause harm to your computer, can only receive through the selected connection.
        -5 dmz (demilitarized zone) for your computer demilitarized zone, publicly accessible within this area can be limited access to your internal network, only after receiving the connection selected
        -6 work (work) can basic trust network will not harm other computers in your computer, only after receiving the selected connection
        -7 home (home) for home network, other computers in the network will not harm the basic trust your computer to receive only the chosen connection
        - 8 internal (inside) for internal network, other computers in the network can basic trust will not harm your computer, receive only through selected connection
        -9 trusted (trusted) may receive all of the network connections
3. add-port: the port identifier added
4. permanent: provided persistent represented

Guess you like

Origin www.cnblogs.com/youngyajun/p/11939478.html