Connect to gameserver on VPS
#1

First of all, thank you for reading this! I'm aware this question is probably asked a lot before but I just can't seem to figure out how to resolve it.

 

Me and a friend are trying to figure out how to setup a server as a hobby project, we've always played LC when young and this seemed like a fun project for the weekends. We were off with a good start, source files did compile, on the same network everything works flawlessly but when we tried to set it up on a VPS it became a bit more complicated.

We've got the following setup:


Windows server files (2) Haven't changed anything about the files yet.


Windows Server 2022 on Azure (happen to have some Azure credit laying around)


Windows Firewall disabled


Azure Firewall allow all ports inbound (canyouseemee.org can see both the loginserver port and the gameserver port)


Internal NIC IP: 10.0.0.4


Public NIC IP: 20.105.[CeNsOrEd].[CeNsOrEd]


All the servers are set to 127.0.0.1 except for the loginserver and the gameserver. Those are set to the internal IP op de NIC


Within the same network everything works fine, but over the internet (or introducing NAT) it doesn't work anymore.

My gameserver does not want to bind to the Public IP, there i've set it to the Internal IP, however this is also the IP it sends to the client to connect on. And obviously 10.0.0.4 cannot be resolved over the internet. 

 

Now i'm not completely sure what to resolve, I think i've got multiple options but would like to know what is the route i'm supposed to take:


I might be able to modify the connector/gameserver to send a fixed IP to my client. Then I can leave the gameserver binding to the Internal IP and still get my client to connect on the Public IP. However since my gameserver is not listening on that IP adres i'm not sure wether it will connect or not.


If I could configure the network adapter within windows to use the Public IP then it might be able to bind (however this does not seem possible within Azure, maybe another VPS host is more suited therefore?)


I might be able to modify the client to use a fixed IP to connect to the gameserver, however then i'm afraid of the same problem as my first bullet


I might need to resolve the issue of the gameserver not able to bind on the public IP behind NAT?


 

I don't expect a answer like add this line of code here and it'll work, but i'd love to be pointed in the right direction because with alot of variables its hard to troubleshoot. I'm sure somebody has figured this out already!

Thanks alot in advance!

 

 

#2

A lot of this depends on whether your VPS host is offering you a unique IP for your server, some hosts don't offer this and that can be your issue right off the bat.

 

The gameserver and loginserver need to bind to an external IP so they are listening on that address/port. There's no real way that I can think of that you can go around this with a client edit. So I would definitely look into whether or not you have your own personal IP.

 

Lastly, I would personally recommend running LC on Linux as that is the primary OS the game was intended to run on. In my experience, people typically only run Windows servers for local testing and probably 99% of all public servers have always ran on Linux.

#3

Okay thank you for your answer, I think the most straight forward option would be to get a VPS with a public IP directly on the network adapter.

 

Your comment on hosting with Linux made me think, i'm not afraid of going that route however for now I don't have files for Linux neither could I find them on this forum. So that will end pretty soon I think.. 

#4

The files linked on these forums can be compiled on linux with basically zero modifications. You should be fine, there's guides about compiling and more across our forums if you run into any issues. Its fairly straight forward however.

#5

Do you mean that I can compile the files i've used on windows also to be run on Linux?

#6


1 hour ago, tijntje96 said:




Do you mean that I can compile the files i've used on windows also to be run on Linux?




With a linux compiler, yeah

 

2

 

#7

yes, the same files you are using to run your server on windows will compile just fine on linux as long as you follow a compiling guide.

#8

That sounds very cool! I'm going to give it a try this evening. thanks alot so far for the help!

#9


On 11/1/2021 at 11:11 PM, tijntje96 said:




My gameserver does not want to bind to the Public IP, there i've set it to the Internal IP, however this is also the IP it sends to the client to connect on. And obviously 10.0.0.4 cannot be resolved over the internet.




I was facing the same issue while set-upping a test server on GCP under WIN, it looks like some hosts (e.g: GCP, Azure, along with others ..) handles the routing outside the instance itself...

A way to connect to a test server running on such hosts, would be by forcing the client to ignore the ips of gss (sent by ls), and arbitrarily choose the address to connect to (look for this func ReceiveServerListMessage in SessionState.cpp),

it works(at least it did for me), it should be ok for test servers.

 

this way u should be able to bind gs on internal ip, the internal ip will be sent to the client, client will ignore it and *boom*.

another way would be by forcing ls to send the ext ip of gs(gs binded on internal), but it seems a little tricky and no really point in it imo.

 

 

update: i ran some tests together with /index.php?/profile/2782-tijntje96/&do=hovercard" data-mentionid="2782" href="/index.php?/profile/2782-tijntje96/" rel="">@tijntje96, it seems this solution works on both GCP / Azure (thank you /index.php?/profile/2782-tijntje96/&do=hovercard" data-mentionid="2782" href="/index.php?/profile/2782-tijntje96/" rel="">@tijntje96 for testing it on Azure ?),

should work as well with other hosts.



Forum Jump:


Users browsing this thread: 1 Guest(s)