4O4 / mtasa-docker

Unofficial Docker image for Multi Theft Auto: San Andreas game server
https://hub.docker.com/r/notfound/mtasa-server
16 stars 8 forks source link

How to select IP to register in serverlist on muli wan machine ? #5

Closed websharik closed 1 year ago

websharik commented 2 years ago

MTA is auto detect and register default gateway as server IP. Any solution to select another IP ?

Example WANs: 77.77.77.1 (eth0), 77.77.77.2 (eth1) Default docker gateway is first eth: 77.77.77.1 So MTA auto detect and register server as 77.77.77.1 How to switch it to 77.77.77.2 ?

-p 77.77.77.2:22003:22003/udp not working, its just tell docker listen input only from eth1, output traffic still be default 77.77.77.1 so MTA still register server as 77.77.77.1

websharik commented 2 years ago

I think solution is change output gateway of container, but dont know how do it + mta container require local access to mysql container in same compose.

4O4 commented 2 years ago

Hi @websharik, can you tell me what are you trying to achieve? It will be easier to help

websharik commented 2 years ago

@4O4 Hi. Im trying use second IP of my machine (with register right ip in mtasa list servers).

By default mta register first ip (default gateway).

4O4 commented 2 years ago

Okay, the thing is It doesn't matter what IP address MTA binds to inside the container. Docker networks are isolated. Any advanced networking configuration related to external IP addresses should be done on the host OS level, most likely via iptables if you're hosting on Linux. This can't be configured via docker or compose. I don't have any articles on hand that I could link to, but you'll find what you want if you google for iptables and secondary external ip keywords.

You might need to set the desired IP address in your mtaserver.conf though. Maybe that's the missing piece if you have everything else configured.