Skip to content

Instantly share code, notes, and snippets.

@spig
Last active May 15, 2018 14:32
Show Gist options
  • Save spig/a25ec7288639e32288c713ae9d9439ea to your computer and use it in GitHub Desktop.
Save spig/a25ec7288639e32288c713ae9d9439ea to your computer and use it in GitHub Desktop.
Update firewall on CentOS 7
Taken from http://ask.xmodulo.com/open-port-firewall-centos-rhel.html
Open a Port on CentOS/RHEL 7
Starting with CentOS and RHEL 7, firewall rule settings are managed by firewalld service daemon. A command-line client called firewall-cmd can talk to this daemon to update firewall rules permanently.
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
Without "--permanent" flag, the firewall rule would not persist across reboots.
Check the updated rules with:
$ firewall-cmd --list-all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment