Opening ports on the firewall of an Ubuntu 22.04 VPS may seem like a complicated process, but it is actually quite simple. By following a few easy steps, you can allow inbound and outbound traffic on specific ports, ensuring that your server is protected and working properly.

Step 1: Connect to the VPS

To open ports on your VPS firewall, you must connect to it through an SSH terminal. If you use Windows, you can use the Putty program to connect to the VPS.

Step 2: Check the firewall rules

Before opening ports on the firewall, it is important to check the existing rules to make sure you are not allowing unauthorized access to your server. To do this, type the following command:

sudo ufw status

This will show a list of all firewall rules currently in effect on your VPS.

Step 3: Allow a port

Suppose you want to allow traffic on port 8080. You can do this with the following command:

sudo ufw allow 8080/tcp

This will allow TCP traffic on port 8080.

Step 4: Verify that the port was opened correctly

To verify that the port was opened correctly, you can use the command sudo ufw status again. The output should include a rule allowing traffic on port 8080.

Step 5: Save the firewall rules

After adding or modifying firewall rules, it is important to save them so that they persist after the VPS restarts. To do this, type the following command:

sudo ufw enable

Step 6: Check the open ports

Finally, to check the open ports on your VPS, you can use the following command:

sudo ufw status

This will show a complete list of all active firewall rules on your VPS, including the ports you just opened.

Conclusion:

Opening ports on the firewall of an Ubuntu 22.04 VPS is essential to ensure that your server is protected and working properly. With these simple steps, you can allow traffic on specific ports and ensure

Was this answer helpful? 0 Users Found This Useful (0 Votes)