snippetbashTip
ufw — Uncomplicated Firewall. Frontend for `iptables` aiming to make configuration of a firewall easier. M
Viewed 0 times
commandfrontendforclifirewalliptablesuncomplicatedufw
linux
Problem
How to use the
ufw command: Uncomplicated Firewall. Frontend for iptables aiming to make configuration of a firewall easier. More information: <https://wiki.ubuntu.com/UncomplicatedFirewall>.Solution
ufw — Uncomplicated Firewall. Frontend for iptables aiming to make configuration of a firewall easier. More information: <https://wiki.ubuntu.com/UncomplicatedFirewall>.Enable
ufw:sudo ufw enableDisable
ufw:sudo ufw disableShow
ufw rules, along with their numbers:sudo ufw status numberedAllow incoming traffic on port 5432 on this host with a comment identifying the service:
sudo ufw allow 5432 comment "{{Service}}"Allow only TCP traffic from 192.168.0.4 to any address on this host, on port 22:
sudo ufw allow proto tcp from 192.168.0.4 to any port 22Deny traffic on port 80 on this host:
sudo ufw deny 80Deny all UDP traffic to ports in range 8412:8500:
sudo ufw deny proto udp from any to any port 8412:8500Delete a particular rule. The rule number can be retrieved from the
ufw status numbered command:sudo ufw delete {{rule_number}}Code Snippets
Enable `ufw`
sudo ufw enableDisable `ufw`
sudo ufw disableShow `ufw` rules, along with their numbers
sudo ufw status numberedAllow incoming traffic on port 5432 on this host with a comment identifying the service
sudo ufw allow 5432 comment "{{Service}}"Allow only TCP traffic from 192.168.0.4 to any address on this host, on port 22
sudo ufw allow proto tcp from 192.168.0.4 to any port 22Context
tldr-pages: linux/ufw
Revisions (0)
No revisions yet.