Wednesday, April 18, 2018

Centos and Redhat EL firewall port opening

Centos 7
To open up a new port (e.g., TCP/80) permanently, use these commands.
$ sudo firewall-cmd --zone=public --add-port=80/tcp --permanent
$ sudo firewall-cmd --reload 
Check the updated rules with:
$ firewall-cmd --list-all
Centos 6, iptables
Use iptables command to open up a new TCP/UDP port in the firewall. To save the updated rule permanently, you need the second command.
$ sudo iptables -I INPUT -p tcp -m tcp --dport 80 -j ACCEPT
$ sudo service iptables save 
Start / Stop / disable firewall completely


No comments:

Post a Comment