How To Open Ports for Rust Server with Port type

    Posted: (UTC)
How To Open Ports for Rust Server with Port type Image

Introduction

In this tutorial, you will learn how to check and open ports for a Rust server with different port types on both Windows and Linux. It is important that the process of opening ports can vary depending on the operating system, such as Windows or Linux. For Windows, you will need to open ports in both the Inbound and Outbound rules of the Windows Firewall.

If you are using a Windows VPS, some VPS hosting providers have their dedicated panels where you need to open the ports too to make it work. This is necessary because Windows have minimal security. In conclusion, open ports in the Windows firewall and, if your hosting has a dedicated panel for port configuration, open that ports there. If your hosting doesn't have a dedicated panel, then simply open the ports through the Windows firewall.

On Linux, the process may differ between different distros. Debian based distros, such as Ubuntu, it use UFW (Uncomplicated Firewall), while CentOS and other Red Hat-based distros often use firewall-cmd.

In this tutorial, we will focus on Windows and Debian firewalls, UFW, which is commonly used on Ubuntu which is a Debian-based distribution.

If you want to learn How to easily build a Rust server on Windows in 2023, simply click the link and read the tutorial. In that tutorial, we provide a starter script that includes the four required ports for the Rust server.

  • Server Port
  • Query Port
  • RCON Port
  • APP Port

Rust Server Port Types

Here is the list of port types that you must need to open in your operating system or hosting panel:

  • Server connection port: UDP

  • Server query port: UDP

  • RCON port: TCP

  • Rust+ app port: TCP

Precaution About Opening Ports

If you are using a VPS (Linux/Windows) for your Rust server, it is generally fine to open ports as the network is protected by the VPS providers. However, if you are self-hosting from home or an office, you need to be careful because opening ports involves configuring your router to allow external access to your server over the internet, posing a potential security issue. To overcome this, you can close all unnecessary ports on your router and only enable those that are required.

Let me share my personal experience. I have a Huawei router. If my Internet Service Provider (ISP) enables a Static IP Address for me and I have ports 80 and 443 closed on the router, my router configuration page shows up in the browser if someone tries to access it using the IP address. This IP is also used to connect to the Rust server. Since I wasn't using Ports 80 or 443, I fixed this issue by port forwarding/mapping Port 80 and 443 to a different internal IP address and ports. That resolved the problem.

Step To Follow For Specific OS:

We will follow these steps to open ports for rust server without any issue:

Step 1 — Open Rust Ports in Windows (Inbound Rules)

Let's explore how to open ports in Windows. To set this up, you should be aware of the specific ports and their types that need to be opened. Refer to your Rust server starter batch script and identify the mentioned ports. In this section, we will open ports for Inbound traffic. Repeat these steps for each required port, ensuring that you specify the port type.

Open your windows firewall like you can see in the image.

Open Windows Firewall

Click on "Advanced Settings" to access the rules section.

Go to Advanced Firewall Settings

Click on "Inbound Rules," then select "New Rule." Repeat this process for each port you need to configure

Open Inbound Rules section

Select "Port" and then click "Next"

Click Port In Inbound Rule

First, check the port type (TCP or UDP), enter the port number, and then click "Next". Read Rust Server Port Types section for more information.

Inbound Port type and port opening

Now, check "Allow All Connection," and then click "Next"

Allow All Collections Inbound Firewall

Now, check all the options for "Domain, Public, Private," and then click "Next"

Inbound Port Scope In Firewall

Finally, type the rule name of the port you just opened. Now, repeat the process again for all the remaining ports.

Inbound Rule Name in Firewall

Step 2 — Open Rust Ports in Windows (Outbound Rules)

Click on "Outbound Rules," then select "New Rule." Repeat this process for each port you need to configure

Open Outbound Rules section

Select "Port" and then click "Next"

Click Port In Outbound Rule

First, check the port type (TCP or UDP), enter the port number, and then click "Next". Read Rust Server Port Types section for more information.

Outbound Port type and port opening

Now, check "Allow All Connection," and then click "Next"

Allow All Collections Outbound Firewall

Now, check all the options for "Domain, Public, Private," and then click "Next"

Outbound Port Scope In Firewall

Finally, type the rule name of the port you just opened. Now, repeat the process again for all the remaining ports.

Outbound Port Rule Name

Step 3 — Open Rust Ports in Linux (Ubuntu, Debian)

Now, in this section, we'll see how you can open Rust server ports on Linux. Ubuntu and Debian are popular Linux distributions among developers for building game servers due to the simplicity of packages and configuration. This tutorial assumes basic Linux knowledge, such as remote SSH login and using the terminal. To configure UFW (Uncomplicated Firewall), access the terminal on your Linux system through the console over SSH. If you are using Linux with a GUI, simply open the terminal. Let's get started.

Let's check the status to see if UFW is enabled on the Linux system. Open the terminal and type the following command:

sudo ufw status

Check UFW Status

If UFW is inactive, activate it using the following command. Remember, if you are using any services like SSH, please enable the port for it as well.

sudo ufw enable

Enable UFW Status

Now, let's add UFW port rules. Run these commands one by one. Also, please add port 22 for SSH; otherwise, if you are using a VPS over the internet, you will not be able to access it using SSH.

sudo ufw allow *connection_port*/udp

sudo ufw allow *query_port*/udp

sudo ufw allow *rcon_port*/tcp

sudo ufw allow *app_port*/tcp

sudo ufw allow 22

Open Ports in UFW

Now, let's confirm if all ports are open with their specific types.

Check UFW Ports Setting