How to open a port on vps?

Modified on Tue, 30 Apr 2024 at 06:15 PM

Debian / Ubuntu / Kali / Mint / Raspbian / Elemetary OS

Opening ports on a VPS depends on the operating system installed on the server. For example, To open port 25 on a VPS (virtual server) and check it, you will need to follow these steps:

  1. Connect to the VPS via an SSH client (such as PuTTY for Windows or Terminal for macOS and Linux) using the VPS credentials.

  2. Update the packages and install the necessary utilities using the commands:
    sudo apt update
    sudo apt install ufw

  3. Open port 25 with the command:
    sudo ufw allow 25

  4. Check the current state of ufw (firewall management utility) with the command:
    sudo ufw status

  5. There are several ways to check port 25.

    You can use the Telnet utility by running the command:
    telnet localhost 25
    If the connection is successful, the port is up and ready to accept connections.

    You can also use the netstat command to check if the server is listening on port 25. Run the command:

    sudo netstat -tuln | grep 25

    If the output contains the string "LISTEN", it means that the port is open and the server is ready to accept connections on this port.

To open port 25 (SMTP) on CentOS using firewalld, follow these steps:

  1. Add port 25 to the list of allowed ports:

sudo firewall-cmd --zone=public --add-port=25/tcp --permanent

  1. Restart firewalld for the changes to take effect:

sudo systemctl restart firewalld

  1. Check that port 25 is added to the list of allowed ports:

sudo firewall-cmd --list-ports

After completing these steps, port 25 will be open and available for use on your CentOS server.

You can also check port 25 using online utilities, for example, through the website Open Port Check Tool - Test Port Forwarding on Your Router 

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article