This post is about how to open specific tcp and udp ports using the command firewall-cmd. So without further due, let's get started.
Opening TCP ports:
Let's say, I want to open the tcp ports 80 and 443 which are used by http and https protocol respectively.
To do that, run the following commands,
firewall-cmd --permanent --add-port=80/tcp firewall-cmd --permanent --add-port=443/tcp
Opening UDP ports:
Let's say, I want to open the udp port 53, which is used by bind dns service.
To do that, run the following command,
firewall-cmd --permanent --add-port=53/udpReload the Configuration:
Now we have to reload firewall-cmd configurations. To do that, run the following command,
firewall-cmd --reloadVerification:
To verify that the commands worked, let's view the current opened port list,
firewall-cmd --list-ports 443/tcp 80/tcp 53/udpTested on: CentOS 7
No comments:
Post a Comment