Depending upon the configuration of your server you may need to be more aware of its IP address configuration and how it relates to your game server.
This guide is not designed to be an in-depth guide to networking, instead focusing on parts relevant to game servers.
Your game server can be hosted online using a server provider such as Linode or on a local network at home for either local-only LAN parties or allowing online players in through your router.
If your server is hosted on the internet using a server provider you should have been allocated a public internet IP address that will be accessible by everyone on the internet.
Using a home server or virtual machine on your desktop is a great way to get started with LinuxGSM. However, a local network (LAN) may require a better understanding of networking equipment, how local IP addressing works, and technologies such as DHCP and NAT.
When a server is hosted on a local network it will be given a private IP address that is only accessible to other devices on your local network. This is fine if you want to get friends around host a game server for a good old-fashioned LAN party. But if you want to allow online players access to your local game server you will need to configure your home router's firewall and setup port forwarding using NAT.
All computers will have some sort of physical or virtual network interface (ethernet, fiber optic, wi-fi) to connect to a network. On Linux, you can see your server's interfaces by using the following command.
ip -o link show
Typically you may see (depending on distro) a localhost
loopback interface and an eth0
interface. The eth0
(Ethernet) is used for your standard copper network cable and is what you will likely see. If you have multiple interfaces you may also see eth1
, eth2
, etc. More advanced setups can choose to bond together interfaces to work as one to increase bandwidth and resilience.
An IP (Internet Protocol) address is a numerical label assigned to each device connected to a computer network that uses the Internet Protocol for communication. It serves two primary functions: host or network interface identification and location addressing. IP addresses enable devices to send and receive data within a network, facilitating communication and data transfer across the Internet.
LAN IP Address:
Example: 192.168.1.10
Explanation: In a typical home or office network, devices are often assigned private IP addresses within the range defined by the Internet Engineering Task Force (IETF) for private networks. The "192.168.1.10" address is an example of a private IP address commonly used within a LAN. Each device on the local network would have a unique private IP address for internal communication.
Internet IP Address:
Example: 203.0.113.45
Explanation: Internet IP addresses, also known as public IP addresses, are assigned by Internet Service Providers (ISPs) and are globally unique. The "203.0.113.45" address is an example of a public IP address. Websites, servers, and other devices connected to the Internet have public IP addresses that are used for communication between different networks on a global scale. These addresses are essential for routing data across the Internet.
Some servers may be connected to a VPN (Virtual Private Network) using software such as Wireguard or OpenVPN. This normally creates its own interface that gets allocated an IP address. It is possible to use a VPN to create a private connection to a LAN server
A relatively new technology is starting be become popular that allows applications hosted (think self-hosted web applications) on a private network to be accessed on the internet via a network "tunnel". This typically involves running a tunnel client in the private network that points to a specific internal IP and port. This bypasses the need to port forward on a router. Currently, there is a service called playit.gg that is specifically designed for game servers. However other solutions may work.
Each network interface can be allocated an IP address either manually on the server or via DHCP. If you are using a provider an internet IP address is normally automatically allocated to your server. For a local network, your router DHCP server will allocate a local IP address. A local IP address can be reserved using DHCP or you can manually set an IP on the server.
Game Servers will typically bind (attach a network socket) to all available IP addresses making the game server available on all networks. However, sometimes a particular IP address may need to be specified if you only want a particular network to access it or the game server requires it.
The simplest and most common server configuration will have one network interface and thus one IP address. When your game server starts it will simply listen and bind to this IP address.
Some servers will have multiple network interfaces available, allowing for multiple IP addresses to be assigned to your server. In this configuration, a server might listen and bind itself to all IP addresses or just one (depending on the game server).
If you have multiple interfaces you may choose to multihome your server. This simply means each interface is on a different network. For example, eth0
is on the 192.168.0.0
network and eth1
is on the 192.168.1.0
network and wg0
(WireGuard VPN) is attached to 10.0.0.0
. While it is unlikely there is a specific use case for game servers to use multiple networks you need to be aware of what IP addresses your server is bound to.
The 0.0.0.0 IP is a meta-address means non-specific or all addresses. When you set up a game server you may notice the IP address 0.0.0.0 in command line parameters and settings. It is the default IP for game servers just signifies that the game server can bind to all available server IP addresses.
Unless a specific IP address is required the game server IP can be set to 0.0.0.0.
Ports are communication endpoints for an application. A port will either listen to or transmit network traffic on specific ports.
There are port standards set by IANA for common protocols such as HTTP (port 80), SSH (port 22), SMTP (port 25), etc. Game servers tend to use standard ports depending on the game engine. For example source engine games by default use port 27015 as the port it listens on.
Port listening is what a service like a game server does in order to receive packets from incoming connections: by listening to a port, the program waits for incoming packets on a given port.
Port opening happens on a firewall, it consists of allowing traffic to a port.
Port redirection is part of NAT and happens on a router or firewall. It consists of forwarding incoming traffic on a given port to a specific local IP.
Network Address Translation (NAT) is a method of remapping an IP address into another by modifying network address information.
Game Servers typically have ports for the following functions.
Game port: The port that players connect to. Query port: Used by software to gather information from the server such as server name, map, and number of players. Rcon port: Some game servers have remote console port allowing remote administration of a game server. Web port: used for game servers that have web interface.
Depending upon which game server is being used, you can set game server ports within your start parameters or game server config file.
LinuxGSM allows you to see the ports your game server is using with the ./gameserver details
command.
Useful port diagnostic command:
ss -tuplwn | grep RustDedicated
DESCRIPTION PORT PROTOCOL LISTEN
Game 28015 udp 1
Query 28017 udp 1
RCON 28016 tcp 1
App 28082 tcp 1
Default ports are set in either the start parameters or game config.
You can use ./gameserver details
to find out where to edit port settings
# Ports
# =====================================
# Change ports by editing the parameters in:
# /home/lgsm/qlserver/serverfiles/baseq3/ql-server.cfg
To alter them you will need to edit the file using nano
.
Example: for source games, you need to alter the following:
# Start Variables
port="27015"
sourcetvport="27020"
clientport="27005"
ip="0.0.0.0"
You can use any port as long as it is not already in use and it is up to you to set up port allocation. It is recommended that ports are close together and sequential i.e. 27015, 27016, 27017 to save confusion. Some server's ports by default are not sequential, however, there is nothing stopping you from changing this. For example for source engine game servers; you could set port 27015, source TV port 27016, client port 27018. The next game server instance could simply follow on from this.
Should a server have multiple dedicated IP addresses allocated, it is possible for game servers to have the same ports but bound to different IP addresses. Admins will need to set the specific IP address in the LinuxGSM config or game config.
Each type of server has a default set of ports. This is fine to use if only one server is being set up. However, if multiple servers are being used a port scheme needs to be considered. There is no requirement to stick to specific ports but it is recommended they are in a logical order.
Source Default Ports
port="27015"
sourcetvport="27020"
clientport="27005"
You can allocate ports incrementally, one after the other. With each server following on from the last.
port="27015"
sourcetvport="27016"
clientport="27017"
This scheme is the simplest option to avoid confusion when managing ports. Plus this is the most efficient scheme for reducing unused ports.
This method increments each type of port keeping the scheme closer to the default. It is not as efficient but keeps ports more "standard".
port="27016"
sourcetvport="27021"
clientport="27006"
Then increment those ports by 1 for every new server. 25 servers are using 75 ports. After making 25 servers, if you need more it is a good idea to add +100 to this 27000 range.
port="27125"
sourcetvport="27150"
clientport="27100"
You can get new IP addresses for your dedicated server, and assign each server a new IP. This scheme is quite inefficient.
If you are running several game servers it is a good idea to create a spreadsheet of the ports you have used. Allowing you to keep track of what you have already used.
Ensure the game server ports are bound and listening before anything else. You can check if your server is actually listening by using ./gameserver details
if a port is bound and listening then the LISTEN
column will not be zero.
Useful port diagnostic command:
ss -tuplwn | grep RustDedicated
DESCRIPTION PORT PROTOCOL LISTEN
Game 28015 udp 0
Query 28017 udp 0
RCON 28016 tcp 0
App 28082 tcp 0
Running the ss
command will bring up any ports that are listening. If not, the game server has not started or not correctly binding to its allocated ports.
Check that ports are not already in use by another application.
Check that you are trying to listen to an actual interface IP.
Check that the server does not crash upon start by checking console logs or try starting the server with ./gameserver debug
Firewalls are a regular source of connectivity issues. When diagnosing connection issues temporarily disabling a firewall will help identify if it is the source of the problem.
Ensure that the router correctly redirects incoming traffic to the correct ports and local IP displayed with ./gameserver details
with the correct protocol (TCP and/or UDP).
Both Source engine and GoldSrc engine use the following ports by default.
Game Port: 27015
Query Port: 27015
RCON Port: 27015
Client Port: 27020
Source TV: 27005
The port that is configured in the start parameters must be the port that is exposed to the Internet. This is because the game server reports the port that it is configured in start parameters to use to the master server. If this does not match the game client will not be able to connect to the server.