Hi, I am having an issue with the server port, the process I am doing is this
zrok reserve private localhost:25566 --backend-mode tcpTunnel --unique-name stefzzzfeb262024test
zrok share reserved stefzzzfeb262024test --headless
zrok access private stefzzzfeb262024test --bind 127.0.0.1:25565
the command I use with my friends for them join to my minecraft server is this
zrok access private stefzzzfeb262024test
the problem is when they use the command they get other port
they get the same ip but with other port, it looks like this: 127.0.0.1:9191, when it should be 127.0.0.1:25565 or 127.0.0.1:25566 (the problem I would like to solve)
I also want to say that yesterday it wasnt happening, it had happened a few times a time ago but I have never found a solution.
Hey again @stefzzzz! TCP port 9191 on the loopback (localhost) network interface is the default proxy port when you don't override it with --bind
.
Your Minecraft guests can run the same command you did to change the port on their computer, e.g.,
zrok access private stefzzzfeb262024test --bind 127.0.0.1:25565
This only changes their local proxy port, so it doesn't affect anyone else accessing your private share.
It's good for them to use Minecraft's default TCP port number when they run zrok access
because that way Minecraft can "see" the server. I'm not even sure it's possible to tell Minecraft to look for a different port, so it may be necessary.
I wanted to ensure this worked so I tested it by running a Minecraft server in a Docker container like this.
# make a Docker network for the server
❯ docker network create minecraft
294b3c973a8fb53927693f1bb011a11213041a4049f79db18cd51a35a5f0c7bf
# run a server on the Docker network with domain name "minecraft-server"
❯ docker run \
--detach --restart "unless-stopped" \
--name "minecraft-server" \
--network "minecraft" \
--env "EULA=TRUE" \
itzg/minecraft-server
8b33998d86c2de0a95bfb34bddfaaff7aac3eb3f6d518cc9cc3dcb3a7a8e99c4
# reserve a zrok private share for the server targeting its domain name inside the Docker network
❯ zrok reserve private \
--unique-name "kbmcsrv" \
--backend-mode "tcpTunnel" \
minecraft-server:25565
[ 1.009] INFO main.(*reserveCommand).run: your reserved share token is 'kbmcsrv'
# run a headless zrok share in the same Docker network so it can reach the server
❯ docker run \
--detach --restart "unless-stopped" \
--name "zrok-share-minecraft" \
--network "minecraft" \
--volume ~/.zrok:/.zrok \
--user "$UID" \
openziti/zrok share reserved "kbmcsrv" --headless
# bind zrok access to the Minecraft port
❯ zrok access private "kbmcsrv" --headless --bind 127.21.71.1:25565
Finally, in Minecraft Java Edition, I typed the IP address in "Direct connection" or "Add server" like 127.21.71.1
. Any guest of the server can use any bind IP starting with 127.
as long as they use the same value for zrok access private
and when connecting in Minecraft.
I left the server running for now in case you want to try connecting with the zrok access private
command.