Skip to content

Instantly share code, notes, and snippets.

@rzdhop
Last active September 16, 2020 12:30
Show Gist options
  • Save rzdhop/7f8adb92a8831aa25b0caf72c2f45fe1 to your computer and use it in GitHub Desktop.
Save rzdhop/7f8adb92a8831aa25b0caf72c2f45fe1 to your computer and use it in GitHub Desktop.
Check the service status with standard systemctl command:
$ sudo systemctl status ufw
Enable UFW with enable command:
$ sudo ufw enable
Syntax to open specific TCP port:
$ sudo ufw allow (port)/tcp
Syntax supports also names which reffer to specific ports:
$ sudo ufw allow https
To allow incoming tcp and udp packet on port 21, enter:
$ sudo ufw allow 21
Example for specific IP Address:
$ sudo ufw allow from 190.34.21.113 to any port
Let’s check the configuration:
$ sudo ufw status verbose
To open a specific port
$ iptables -A INPUT -p tcp -i eth0 --dport 80 -j ACCEPT
$ firewall-cmd --zone=public --add-port=3306/tcp --permanent
$ firewall-cmd --reload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment