Skip to content

Instantly share code, notes, and snippets.

@edcote edcote/firewall.md
Last active Dec 3, 2018

Embed
What would you like to do?
Firewall

Firewall setup

Ubuntu

Official wiki has excellent documentation.

Example commands:

sudo ufw allow ssh/tcp
sudo ufw allow ssh/nfs
sudo ufw logging on
sudo ufw enable
sudo ufw status numbered
  • Remove rules: ufw delete rule NUM. Use ufw status numbered.
  • Allow many ports: ufw allow proto tcp from 192.168.1.0/24 to any port 22,2049,4000,9000,9009,9099,9990,9999

RHEL7

Use sudo firewall-config.

To stop/start/restart firewall service: sudo service firewalld [stop/stop/restart]

Example commmands:

  • firewall-cmd --zone=public --add-port=5060-5061/udp [--permanent]
  • firewall-cmd --zone=public --list-ports
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.