tldr/pages/linux/ufw.md
2016-09-01 22:51:56 +05:30

37 lines
756 B
Markdown

# ufw
> Uncomplicated Firewall.
> Frontend for iptables aiming to make configuration of a firewall easier.
- Enable ufw:
`ufw enable`
- Disable ufw:
`ufw disable`
- Show ufw rules, along with their numbers:
`ufw status numbered`
- Allow incoming traffic on port 5432 on this host:
`ufw allow {{5432}}`
- 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}}`
- Deny traffic on port 80 on this host:
`ufw deny {{80}}`
- Deny all UDP traffic to port 22:
`ufw deny proto {{udp}} from {{any}} to {{any}} port {{22}}`
- Delete a particular rule. The rule number can be retrieved from the `ufw status numbered` command:
`ufw delete {{rule_number}}`