#Networking problem

61 messages · Page 1 of 1 (latest)

fluid sinew
#

Hey, maybe somebody here can help me..

I use a Service which uses the IP-Addresses of Game-Servers to identify them.
Pretty much like this: I have eg. IP 172.18.0.2 set to be Server "1" in the Database of that Service.. The Gameserver communicates with that Service and because it runs on the same root server, it only sees the 172.18... network.
Now the Problem: The Server does not always get the .0.2 IP as it depends on the starting order in which case the service may see .0.4 and reject communication with that Server..

Any Ideas what I can do?

tender lilyBOT
#

Please explain the issue you're experiencing in as much detail as possible. Preferably with error messages in a text format or paste link to logs. Nobody can assist you without information that helps to understand the issue. Help us help you. Messages such as "doesn't work" or "i need help" will most likely be ignored.

paper talon
#

You have to do it by port. You should be using the gateway IP for connections, 172.18.0.1

fluid sinew
paper talon
#

Yes. And look at the Minecraft Guide under Community Guides to get an idea of the networking here; the concepts apply to more than just Minecraft.

tender lilyBOT
paper talon
#

This has some info too:

tender lilyBOT
#

If your server cannot see the database, please make sure your mod/plugin is connecting to pterodactyl0 interface 172.18.0.1 or the public IP to reach the local database. You can not use localhost or 127.0.0.1 as that would be the container itself.

You also have to configure the database bind-address to listen on all interfaces following the guide below.
https://pterodactyl.io/tutorials/mysql_setup.html#creating-a-database-host-for-nodes

fluid sinew
#

Ok, I just tried to use 172.18.0.1:<servicePort> on the game server.
But the Service still receives the packages from 172.18.0.2:<gameserverPort>. Which is wrong in this case.

paper talon
#

Are you trying to whitelist the IP? You'd have to do it by subnet or by the port. For example when making a database for a game server in Pterodactyl Panel I'd only allow connections from 172.18.% (% is a wildcard in MariaDB), and those first two sections are the only ones that are going to stay the same. The default subnet will be 172.18.0.0/16

fluid sinew
#

No sadly not.
Do you by any chance know HLSTATSX? That stats System for Source Servers

paper talon
#

I haven't heard of it before now

#

What does it's config section look like?

fluid sinew
#

Ok well, it uses a deamon, which is running on my host. And the game servers communicate to that deamon. Problem is, the deamon checks the IPs from the gameservers > Looks into a mysql database and from there gets eg. the Name of the Server to show on the Webpanel of hlstats.

paper talon
#

If it's using the IP to try to connect to the gameserver you would put the gateway IP there. Is there a specific error you see when you try it?

#

Firewalls can get in the way sometimes; if you see timing out or refusing that could be the case. There are firewall examples for UFW and FirewallD in the Minecraft Guide under Community Guides. For iptables I use -A INPUT -i pterodactyl0 -d 172.18.0.1 -j ACCEPT.

fluid sinew
#

no no they can communicate.. But the IPs of the Gameservers change if I start them in another order.
Server 1 could then be server 2 because I started them the other way around.
And then the daemon will think server 1 is server 2 or the other way around

paper talon
#

It doesn't offer a way to define them by port?

fluid sinew
#

it checks ip and port, but only together

paper talon
#

So server 1 would be 172.18.0.1:port1, server2 would be 172.18.0.1:port2

It shouldn't be confusing them

fluid sinew
#

yes but the daemon for some reason always receives the connection from the direct container IP, not from the interface IP

paper talon
#

Oh. The server is contacting the daemon, not the other way around?

fluid sinew
#

yes yes

paper talon
#

I haven't run into anything that works like that before. That complicates it a bit.

fluid sinew
#

well yes.. it's a dumb problem for me at least

paper talon
#

Does it accept wildcards in the IP address?

#

172.18.% if it's really reliant on the database, 172.18.0.0/16 if it will accept a subnet

fluid sinew
#

sadly not, as it has to match the server IP in the database to get information from it

paper talon
#

Would it accept a hostname?

fluid sinew
#

ehm, not sure tbh

#

I guess if there is no better solution I will just try to rewrite the source of the daemon to only check the port lol.. If I can manage at least..

paper talon
#

Test it. Manually make test point to 172.18.0.2 or whatever it currently is in /etc/hosts and see if it will accept the connection. If it works, I'm sure there's a way to give all Docker Containers a hostname and if not there's always the making a script option.

#

Oh, have you tried setting the IP to 0.0.0.0 yet?

#

Forgot about that; 0.0.0.0 typically means everything, it might be a way to essentially wildcard the entire IP.

fluid sinew
#

Yeah I tried that anyway

paper talon
#

Have you tried setting the IP to 172.18.% while the config uses 172.18.0.1 yet?

fluid sinew
#

Eh, wait.. Where what of the two?

paper talon
#

?

fluid sinew
#

I did not understand what exactly you meant with that. Where would I set the % IP?

paper talon
#

In the database (Assuming it's MySQL or MariaDB)

#

% means wildcard, so if the program uses the database to check if the strings match, 172.18.% will match any of your game servers.

fluid sinew
#

ah.. hm I can try.

#

nope, does not accept wildcards

paper talon
#

Well, I'm out of ideas.

#

Good luck though.

fluid sinew
#

Yeah thanks.. I will try some things.. Maybe I come to a solution

fluid sinew
#

Ok, found no other solution than to edit the source of the daemon..
Not fixed but at least a workaround

mortal mason
#

you wont find a fix for that

#

the container ips will never be static, each container gets ips in the next sequence as they are started

#

so the container ip will never be the same

modern storm
glossy aurora
modern storm
glossy aurora
glossy aurora
#

stuck using tmux screens 😭

modern storm
#

Here is what I did

NORMALIZE DOCKER IPs (172.x.x.x → 127.0.0.1)

        if ($s_peerhost =~ /^172\.\d{1,3}\.\d{1,3}\.\d{1,3}$/) {
            $s_peerhost = "127.0.0.1";
            $s_addr = "$s_peerhost:$s_peerport";
        }
#

Not a great way to achieve but it works

modern storm
glossy aurora
#

Thank you so much