How to use the ufw command in Ubuntu?
In Ubuntu, ufw (Uncomplicated Firewall) is a user-friendly firewall management tool that offers easy commands and options for configuring and managing firewall rules.
Here are common ways to use the ufw command:
- Check the status of ufw.
- Check the status of the UFW firewall.
- Enable or disable ufw:
- Enable or disable the UFW with the following commands:
– sudo ufw enable
– sudo ufw disable - Allow or deny specific ports:
- Grant access to a specific port using sudo ufw allow
command and deny access using sudo ufw deny command. - Allow or deny specific services/applications:
- Allow and deny services using sudo ufw.
- Allow or deny specific IP addresses:
- Grant permission for IP in ufw
Block IP in ufw - Allow or deny specific IP ranges:
- Permit traffic from the specified range of IP addresses using ufw, then block traffic from the same range of IP addresses.
- Remove the added rules:
- Remove a specific rule from ufw using sudo.
- Deny all incoming connections except for the specified port.
- Block all incoming traffic using the default deny policy in UFW.
- Allow all outgoing connections except for the specified port.
- Set the default outgoing rule to allow using sudo ufw.
These are some common uses of the ufw command, but there are more features and options available. You can view the full manual of ufw by running the command man ufw.