Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@edcote
Last active December 3, 2018 00:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edcote/9077e5677dab94eb8d732c6582dfa8e0 to your computer and use it in GitHub Desktop.
Save edcote/9077e5677dab94eb8d732c6582dfa8e0 to your computer and use it in GitHub Desktop.
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