Opening Ports on a VPS

For Windows OS

  1. To open ports on Windows, access "Windows Defender Firewall with Advanced Security." You can achieve this by utilizing the Windows search function or navigating to the control panel, both of which are accessible by pressing the Windows Key.

  2. Once you locate the "Windows Defender Firewall with Advanced Security" and reach the main page, proceed to access the "Inbound Rules" section located in the left column. On the right column, choose "New Rule..." as indicated below.

  3. Navigate to the "New Rule..." page and choose "Port." On the subsequent page, opt for either TCP or UDP based on your requirements. Select "Specific local ports" and input the desired port. On the following page, choose "Allow the connection." Finally, provide a name for the new port. This process applies similarly to "Outbound Rules." As an illustration, for FiveM, select TCP, and input ports as "30120, 40120," as demonstrated below.


For Ubuntu OS

- Install UFW: If UFW is not already installed on your system, run the following command to install it:

sudo apt-get install ufw

- Check the status of UFW: Before making any changes, it's a good idea to check the current status of UFW. Run the following command:

sudo ufw status

- Allow incoming connections: To allow incoming connections on a specific port, run the following command, replacing "port_number" with the desired port number (tcp or udp can be added to open that required protocol):

sudo ufw allow port_number/tcp

- Check UFW rules: To view the rules that UFW is currently following, run the following command:

sudo ufw show added

- Enable UFW: Once you have added the necessary rules, you can enable UFW by running the following command:

sudo ufw enable

That's it! You have successfully enabled and opened a port using UFW. Remember to check the UFW status regularly to ensure that it's configured as desired.

Last updated