Bobcares

How to Manage Vultr Ubuntu Firewall Rules with UFW

by | Jul 22, 2024

Learn how to manage Vultr Ubuntu Firewall Rules with UFW. Our Vultr Support team is here to help you with your questions and concerns.

How to Manage Vultr Ubuntu Firewall Rules with UFW

How to Manage Vultr Ubuntu Firewall Rules with UFWDid you know that when setting up a Vultr instance running Ubuntu, UFW is an effective way to manage the firewall rules?

UFW offers a user-friendly interface to create, manage, and view firewall rules. Furthermore, it makes it easier to secure our Ubuntu server.

How to Install and Enable UFW

UFW is usually pre-installed on Ubuntu. However, if it’s not installed, we can install it manually. Once installed, enabling UFW will start protecting our server.

We can update and install UFW with these commands:

sudo apt update
sudo apt install ufw

Then, enable UFW with this command:

sudo ufw enable

Default Policies

By default, UFW denies incoming traffic and allows outgoing traffic. We can change these default policies if needed.

sudo ufw default deny incoming
sudo ufw default allow outgoing

Allowing SSH Connections

To avoid locking ourselves out of our server, we have to make sure SSH connections are allowed before enabling UFW.

sudo ufw allow ssh

Adding Rules

Furthermore, we can add rules to allow or deny traffic on specific ports, IP addresses, or ranges.

We can allow HTTP and HTTPS with these commands:

sudo ufw allow 80/tcp # Allow HTTP
sudo ufw allow 443/tcp # Allow HTTPS

We can allow SSH from a Specific Subnet with this command:

sudo ufw allow from 192.168.1.0/24 to any port 22

Deleting Rules

We can delete rules by specifying the rule number or using the rule syntax.

First, list rules with numbers with this command:

sudo ufw status numbered

Then, we can delete a specific rule by number as seen here:

sudo ufw delete 2

Additionally, we can also delete a specific rule by syntax as seen below:

sudo ufw delete allow 80/tcp

Checking Status

We can check the status of UFW to see which rules are currently applied.

sudo ufw status verbose

Disabling UFW

If we need to disable UFW for any reason, run this command:

sudo ufw disable

Integrating UFW with Vultr Firewall

While UFW manages the firewall rules on the Ubuntu instance itself, Vultr provides a cloud firewall that adds an additional layer of security. Here’s how to integrate both:

  1. First, we have to set up a Vultr Firewall. So, go to the Vultr control panel, and create a firewall group, and add rules to allow or block traffic.
  2. Then, assign the firewall group to the instance.
  3. Now, it is time to manage granular rules that are specific to the instance via UFW.
  4. Additionally, we can use the Vultr firewall to manage broader network access,. This includes restricting access to certain geographic regions or IP ranges.

As seen above, combining UFW with Vultr’s cloud firewall leads to better security of our Ubuntu instance.

[Need assistance with a different issue? Our team is available 24/7.]

Conclusion

In brief, our Support Experts demonstrated how to manage Vultr Ubuntu Firewall Rules with UFW.

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.