Giter VIP home page Giter VIP logo

Comments (11)

ycshao avatar ycshao commented on August 23, 2024 3

I run into the same problem on my MBP server, and my solution is to specify -p 0.0.0.0:19132:19132/udp instead of the default localhost. Then this server shows up in my LAN world as well as a dedicated server.

from docker-minecraft-bedrock-server.

itzg avatar itzg commented on August 23, 2024 2

That's a really great discovery and thanks for posting all of the information.

from docker-minecraft-bedrock-server.

kchenery avatar kchenery commented on August 23, 2024 1

Ok... I have done some reading (and a lot of Googling) and come up with a working solution for me!

When looking up how to assign a static IP address to a container you will find this SO quesiton/answer: https://stackoverflow.com/questions/27937185/assign-static-ip-to-docker-container The very last response spun me off to learning about macvlan in docker here: https://docs.docker.com/network/macvlan/

That looked very promising. So I added a new macvlan to the host with:
docker network create -d macvlan --subnet=192.168.94.0/24 --gateway=192.168.94.1 -o parent=ens3 pub_chenery

This gives the same range as the host

I then removed the IP addresses from the host I had assigned before (see earlier post).

Removed the existing containers and then started them up like this:

docker run -d --name mc-survival --restart=unless-stopped  -e EULA=TRUE -v /opt/docker-minecraft/survival:/data --net pub_chenery --ip=192.168.94.12 itzg/minecraft-bedrock-server

Did the same for the second container (different name, path and IP address of course). And joy they both started with the two IPs I wanted.

And best of all I can now see them on my network as they've got their own "public" IP on my subnet. They are pingable too. Didnt have to map any ports as you'll have seen in the command.

For me the hint was on the docker page about some services needing access to the network card with the wording:

expect to be directly connected to the physical network

from docker-minecraft-bedrock-server.

zolkiss avatar zolkiss commented on August 23, 2024 1

Ok... I have done some reading (and a lot of Googling) and come up with a working solution for me!

When looking up how to assign a static IP address to a container you will find this SO quesiton/answer: https://stackoverflow.com/questions/27937185/assign-static-ip-to-docker-container The very last response spun me off to learning about macvlan in docker here: https://docs.docker.com/network/macvlan/

That looked very promising. So I added a new macvlan to the host with: docker network create -d macvlan --subnet=192.168.94.0/24 --gateway=192.168.94.1 -o parent=ens3 pub_chenery

This gives the same range as the host

I then removed the IP addresses from the host I had assigned before (see earlier post).

Removed the existing containers and then started them up like this:

docker run -d --name mc-survival --restart=unless-stopped  -e EULA=TRUE -v /opt/docker-minecraft/survival:/data --net pub_chenery --ip=192.168.94.12 itzg/minecraft-bedrock-server

Did the same for the second container (different name, path and IP address of course). And joy they both started with the two IPs I wanted.

And best of all I can now see them on my network as they've got their own "public" IP on my subnet. They are pingable too. Didnt have to map any ports as you'll have seen in the command.

For me the hint was on the docker page about some services needing access to the network card with the wording:

expect to be directly connected to the physical network

I'm fighting with this issue in the last couple of days, but finally I found your comment. This is still working with Minecraft Bedrock 1.20.31.01! Thank you!

from docker-minecraft-bedrock-server.

kchenery avatar kchenery commented on August 23, 2024

Have tried mapping different ports (e.g. 19142 instead but that doesnt work either). Seems only 19132 will show up under LAN games :(

from docker-minecraft-bedrock-server.

itzg avatar itzg commented on August 23, 2024

That's a great idea with adding multiple IP addresses on the host. I would recommend debugging by running sudo tcpdump -v udp port 19132 to see if the broadcast packets (and others) are making it to the host.

Unfortunately I can't work on recreating this since I recently stopped my Xbox Gold membership and that seems to have prevented LAN games from showing up at all for me :( .

from docker-minecraft-bedrock-server.

kchenery avatar kchenery commented on August 23, 2024

Ahh good call with tcpdump.

I had fired up Wireshark on the PC and could see the broadcasts going out but nothing back from the host when the IP address is specified. The tcpdump doesnt reveal anything either. Tried disabling the firewall on the host (which is Ubuntu BTW) - no change with that either.

So it only responds when no IP is specified (or 0.0.0.0 is specified).

At a bit of a loss how to check things with the container - bit new to Docker.

from docker-minecraft-bedrock-server.

itzg avatar itzg commented on August 23, 2024

Previously my normal setup "wasn't working" because I didn't have the container running :) After adding an IP address to my host's (also Ubuntu) interface and using a -p with that address I'm guessing I'm seeing the same as you in tcpdump: just broadcast packets coming in but no responses.

Using sudo lsof -i:19132 I can see the docker-proxy process is supposedly listening:

COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
docker-pr 912 root    4u  IPv4 563066      0t0  UDP nuc:19132 

One thing that looked suspicious is that when using arp the HWaddress of the IP address I added shows (incomplete).

At this point I'm left wondering if it's a multi-homing issue in general or something with docker-proxy not fully supporting it.

from docker-minecraft-bedrock-server.

kchenery avatar kchenery commented on August 23, 2024

So weirdly the host cant ping the addresses (other clients on the network can just fine). Im not sure why that is - perhaps cause the gateway is defined as the IP address of the host. That needs a bit of investigation.

Anyway - feel free to close this issue. Might be worth adding some documentation about how to run multiple instances and still make them discoverable by Minecraft though 😃

from docker-minecraft-bedrock-server.

maxfield-allison avatar maxfield-allison commented on August 23, 2024

So weirdly the host cant ping the addresses (other clients on the network can just fine). Im not sure why that is - perhaps cause the gateway is defined as the IP address of the host. That needs a bit of investigation.

Anyway - feel free to close this issue. Might be worth adding some documentation about how to run multiple instances and still make them discoverable by Minecraft though

Fyi, macvlan usually has issues with host communication even in vm's. Why, I don't remember but there is some router nat magic you can use to circumvent if needed.

from docker-minecraft-bedrock-server.

borger avatar borger commented on August 23, 2024

I had a very similar issue, however, in a kubernetes cluster. What fixed it for me, was setting the container's network in host mode (in k8s context, hostNetwork=true).

from docker-minecraft-bedrock-server.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.