In this tutorial, all the commands are written for MySQL port 3306. You can use the same command for any other ports as per your requirements.

Allow Port for All Traffic

Use the following commands to allow incoming traffic on port 3306 to all traffic coming from public network. To add rule for permanent use –permanent option with command.

Allow Port for Specific IP

You can also restrict access on any port based on source address. To open port access based on source address needed to add firewall rich rule. Run the below command to allow access for port 4567 to network. Reload the firewall rules to apply changes.

Verify Rules

After adding the rules in firewalld, You can verify the by the running following command. Output: The last line of output shows the rich rules added the firewalld.

Remove Rules from Firewalld

If you don’t need to keep the ports open, you can remove/deny the above ports from the firewalld using the –remove-port option: Next, run the following command to apply the changes:


In this tutorial, you have learned to open port access to all traffic or specific IP address/network using firewalld on Linux operating systems.