LinuxGSM server ( https://linuxgsm.com/ ) is a  bunch of server scripts which allows you to simply run multiple game server on your Linux. It’s really awesome and if it supports your game I really recommend it to you.

The problem is that it allows to be bind only to 1 IP,  in this tutorial we will take a look at:

How make LinuxGSM server available on all network interfaces.

Our problem is that we are running Project Zomboid server on a a machine which has 2 network interfaces ( 1x hamachi, 1x local network) problem is that free Hamachi supports only up to 5 computers. And if you bind the server to one IP it’s not accessible from the second one. We want to be able to connect to the server with both IPs.

We will take a look how we  can “fix” this using Nginx reverse proxy. Btw we could do it also using iptables or maybe some other way.
This tutorial can be applied in general on any game server but it describes Project Zomboid specific ports.

Please note that setting up the server ip as 0.0.0.0 or 127.0.0.1 doesn’t work.

First let’s take a look at our server IPs using command ip -4 address

[email protected]:/var/log/nginx# ip -4 address
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    inet 10.0.11.59/22 brd 10.0.11.255 scope global eth0
       valid_lft forever preferred_lft forever
4: ham0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1404 qdisc pfifo_fast state UNKNOWN group default qlen 1000
    inet 25.88.158.20/8 brd 25.255.255.255 scope global ham0
       valid_lft forever preferred_lft forever

As you can see our server is listening on 2 IPs, 10.0.11.59 and 25.88.158.20 , let’s select one and set it up as our “main” IP for the server.

Setup your main IP on your server

Edit your lgsm config file using your favorite editor vi or nano (location might be different)
vi /home/pzserver/lgsm/config-lgsm/pzserver/common.cfg

Change the config ip to your main IP:

...
## Server Start Settings | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters
ip="25.88.158.20"
adminpassword="adminpassord"
servicename="mygame"

fn_parms(){
parms="-ip ${ip} -adminpassword \"${adminpassword}\" -servername ${servicename}"
}
...

Restart your server using command ./pzserver restart

Check that you can connect to your server. So far this is basic settings. We haven’t done anything special.

Install NGINX

Just install NGINX server on your system. This guide is pretty nice:

https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-16-04

Basically all you have to do is:

sudo apt-get update
sudo apt-get install nginx -y

Configure the NGINX proxy server

Edit the config file for the nginx which should be located at /etc/nginx/nginx.conf , you can leave the default settings there.

Now the PZ is using UDP port 16261 for server handshake. More info about ports here https://pzwiki.net/wiki/Multiplayer_FAQ#Windows

We need to redirect this port from our second IP to the main one where the server is running.
Just add to the config this part:

stream {                                       
        server {                               
                listen 10.0.11.59:16261 udp;   
                proxy_pass 25.88.158.20:16261; 
        }                                      

# PZ Guide is saying that it's necessary TCP but it's working without the redirect                                               
#       server {                               
#               listen 10.0.11.59:16262;       
#               proxy_pass 25.88.158.20:16262; 
#       }                                      
}

Note about TCP redirect. It might be necessary to redirect also TCP ports  but it’s working for me so far without it. If you run into problem check out the link describing the TCP.

Now just restart the nginx service service nginx restart

Conclusion

Now you should be able to access the server using both IPs

Btw note that if you changed the IP you will have to migrate the folder of your character located on your computer.

So copy the folder
C:\Users\pagep\Zomboid\Saves\Multiplayer\25.88.158.20_16261_pagep
into
C:\Users\pagep\Zomboid\Saves\Multiplayer\10.0.11.59_16261_pagep
(change the location based on your IPs and your usernames) 

 

 


2 Comments

')) �)=' · 2.10.2018 at 10:54

f

BestStephaine · 19.7.2019 at 20:43

I see you don’t monetize pagep.net, don’t waste your traffic,
you can earn extra bucks every month with new monetization method.
This is the best adsense alternative for any type of website
(they approve all websites), for more info simply search
in gooogle: murgrabia’s tools

Leave a Reply

Your email address will not be published. Required fields are marked *