Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

On CentOS 7, firewall-cmd is used to maintain the firewall.

List All Rules

firewall-cmd --list-all

Allow a port

This example allows a TCP port through the firewall, for all network interfaces in the "public" zone:

firewall-cmd --zone=public --add-port=3306/tcp --permanent

This example allows a UDP port through the firewall, for all network interfaces in the "public" zone:

firewall-cmd --zone=public --add-port=20202/udp --permanent

Reload the firewall

firewall-cmd --reload

Delete a rule

firewall-cmd --zone=public --remove-port=3306/tcp

CentOS 6