1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-29 23:24:55 +02:00
tldr/pages/linux/ufw.md

38 lines
886 B
Markdown
Raw Normal View History

# ufw
> Uncomplicated Firewall.
> Frontend for iptables aiming to make configuration of a firewall easier.
2021-06-25 05:43:37 +01:00
> More information: <https://wiki.ubuntu.com/UncomplicatedFirewall>.
- Enable ufw:
`ufw enable`
- Disable ufw:
`ufw disable`
2016-08-28 15:21:54 +05:30
- Show ufw rules, along with their numbers:
2016-05-17 13:31:03 +02:00
2016-08-28 15:21:54 +05:30
`ufw status numbered`
2016-05-17 13:31:03 +02:00
2017-10-06 08:37:07 -06:00
- Allow incoming traffic on port 5432 on this host with a comment identifying the service:
`ufw allow {{5432}} comment "{{Service}}"`
2016-08-28 15:21:54 +05:30
- Allow only TCP traffic from 192.168.0.4 to any address on this host, on port 22:
`ufw allow proto {{tcp}} from {{192.168.0.4}} to {{any}} port {{22}}`
2016-08-28 15:21:54 +05:30
- Deny traffic on port 80 on this host:
2016-08-28 15:21:54 +05:30
`ufw deny {{80}}`
- Deny all UDP traffic to port 22:
`ufw deny proto {{udp}} from {{any}} to {{any}} port {{22}}`
2016-08-28 15:21:54 +05:30
2016-09-01 16:02:55 +05:30
- Delete a particular rule. The rule number can be retrieved from the `ufw status numbered` command:
2016-08-28 15:21:54 +05:30
`ufw delete {{rule_number}}`