Introduction: Managing ports is a crucial part of server administration. This tutorial will guide you through the process of allowing additional ports on your Virtual Private Server (VPS) using UFW (Uncomplicated Firewall), a user-friendly interface for managing iptables firewall rules.

Prerequisites: Before you begin, make sure you have:

  1. Access to your VPS via SSH with a username and password.

Step-by-Step Guide

Step 1: Enabling UFW

Before altering firewall rules, ensure UFW is enabled. This can be done with the following command:

sudo ufw enable

This command activates the UFW firewall, allowing you to manage its rules.

Step 2: Allowing a Specific Port (TCP)

To allow traffic on a specific port, use the ufw allow command. For instance, to allow traffic on port 80 (commonly used for HTTP) for TCP only, use:

sudo ufw allow 80/tcp

This command configures the firewall to allow TCP traffic on port 80.

Step 3: Allowing a Specific Port (TCP and UDP)

If you want to allow both TCP and UDP traffic on the same port, you don't need to specify the protocol. For example, to allow both TCP and UDP traffic on port 80, simply use:

sudo ufw allow 80

Step 4: Checking the Firewall Status

After configuring the rules, it's important to check if they've been applied correctly. Use this command to display the current rules and their statuses:

sudo ufw status

This command lists all active rules in UFW, allowing you to verify that the correct ports are allowed.

Conclusion

By following these steps, you can easily manage the ports on your VPS using UFW. This is essential for running various services and ensuring that your server's communication channels are open and secure.

Ha estat útil la resposta? 454 Els usuaris han Trobat Això Útil (496 Vots)