Recently, we came across a CentOS 7
that was executing MariaDB
(MySQL
) server. The Database Administrators needed a way to open to the port and allow connections to the SQL server from outside the machine.
As they did not have a specific IP
from which they would connect, we provided the following solution.
To temporarily open port 3306
firewall-cmd --add-port=3306/tcp;
To close the port 3306 (method A)
firewall-cmd --remove-port=3306/tcp;
or reload firewalld
which will cause it to loose all changes that are not permanent (method B)
firewall-cmd --reload;
firewalld
(Dynamic Firewall Manager) tool provides a dynamically managed firewall. The tool enables network/firewall zones to define the trust level of network connections and/or interfaces. It has support both forIPv4
andIPv6
firewall settings. Also, it supports Ethernet bridges and allow you to separate between runtime and permanent configuration options. Finally, it supports an interface for services or applications to add firewall rules directly.
This post is also available in: Greek