Question Connection Error When Hosting on WSL

  • After careful consideration and due to limited usage, we’ve made the decision to discontinue the PaperMC forums. Moving forward, we recommend using Hangar for plugin uploads, and for all other community discussions and support, please join us on Discord.

Huey

New member
Jun 2, 2024
2
0
1
I know that it's very strange to host something on WSL, but I want to use Windows' GUI (e.g. for gaming), while hosting a server without using the <s>&ZeroWidthSpace; disgusting &ZeroWidthSpace;</s> windows commands.

## What I'm Doing

First, I had a server computer with windows 11 pro, and installed WSL:

Code:
OS: Debian GNU/Linux bookworm 12.5 x86_64, 
Kernel: Linux 5.15.146.1-microsoft-standard-WSL2

Then I opened a tmux session and ran Velocity on port 25565

Code:
[08:03:41 INFO]: Velocity 3.3.0-SNAPSHOT (git-71bb0246-b392)
[08:03:41 INFO]: Copyright 2018-2024 Velocity Contributors. Velocity is licensed under the terms of the GNU General Public License v3.
[08:03:41 INFO]: velocitypowered.com - GitHub

The only part I changed in the config file:

Code:
# What port should the proxy be bound to? By default, we'll bind to all addresses on port 25577.
bind = "0.0.0.0:25565"

## The Issue

When I open Minecraft on the server computer itself and try to connect to the WSL IP (172.27.203.221), I got this (on the server side):

Code:
log                                                                                           
[19:55:57 ERROR]: Unable to authenticate player                                                                                                                                    java.util.concurrent.CompletionException: java.net.ConnectException                                                                                                                        at java.base/java.util.concurrent.CompletableFuture.encodeRelay(CompletableFuture.java:368) ~[?:?]
        at java.base/java.util.concurrent.CompletableFuture.uniComposeStage(CompletableFuture.java:1189) ~[?:?]
        at java.base/java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:2309) ~[?:?]
        at java.net.http/jdk.internal.net.http.MultiExchange.responseAsyncImpl(MultiExchange.java:453) ~[java.net.http:?]                                                                  at java.net.http/jdk.internal.net.http.MultiExchange.lambda$responseAsyncImpl$7(MultiExchange.java:449) ~[java.net.http:?]
        at java.base/java.util.concurrent.CompletableFuture.uniHandle(CompletableFuture.java:934) ~[?:?]                                                                                   at java.base/java.util.concurrent.CompletableFuture.uniHandleStage(CompletableFuture.java:950) ~[?:?]
        at java.base/java.util.concurrent.CompletableFuture.handle(CompletableFuture.java:2340) ~[?:?]                                                                                     at java.net.http/jdk.internal.net.http.MultiExchange.responseAsyncImpl(MultiExchange.java:439) ~[java.net.http:?]
        at java.net.http/jdk.internal.net.http.MultiExchange.lambda$responseAsync0$2(MultiExchange.java:341) ~[java.net.http:?]
        at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1150) ~[?:?]                                                                         at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510) ~[?:?]
        at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1773) ~[?:?]
        at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:173) ~[velocity.jar:3.3.0-SNAPSHOT (git-71bb0246-b392)]
        at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:166) ~[velocity.jar:3.3.0-SNAPSHOT (git-71bb0246-b392)]
        at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470) ~[velocity.jar:3.3.0-SNAPSHOT (git-71bb0246-b392)]
        at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:413) ~[velocity.jar:3.3.0-SNAPSHOT (git-71bb0246-b392)]
        at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) ~[velocity.jar:3.3.0-SNAPSHOT (git-71bb0246-b392)]
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[velocity.jar:3.3.0-SNAPSHOT (git-71bb0246-b392)]
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[velocity.jar:3.3.0-SNAPSHOT (git-71bb0246-b392)]
        at java.base/java.lang.Thread.run(Thread.java:840) [?:?]                 
Caused by: java.net.ConnectException
        at java.net.http/jdk.internal.net.http.common.Utils.toConnectException(Utils.java:1055) ~[java.net.http:?]
        at java.net.http/jdk.internal.net.http.PlainHttpConnection.connectAsync(PlainHttpConnection.java:198) ~[java.net.http:?]
        at java.net.http/jdk.internal.net.http.AsyncSSLConnection.connectAsync(AsyncSSLConnection.java:56) ~[java.net.http:?]
        at java.net.http/jdk.internal.net.http.Http2Connection.createAsync(Http2Connection.java:378) ~[java.net.http:?]
        at java.net.http/jdk.internal.net.http.Http2ClientImpl.getConnectionFor(Http2ClientImpl.java:126) ~[java.net.http:?]
        at java.net.http/jdk.internal.net.http.ExchangeImpl.get(ExchangeImpl.java:93) ~[java.net.http:?]                                                                                   at java.net.http/jdk.internal.net.http.Exchange.establishExchange(Exchange.java:343) ~[java.net.http:?]
        at java.net.http/jdk.internal.net.http.Exchange.responseAsyncImpl0(Exchange.java:475) ~[java.net.http:?]
        at java.net.http/jdk.internal.net.http.Exchange.responseAsyncImpl(Exchange.java:380) ~[java.net.http:?]
        at java.net.http/jdk.internal.net.http.Exchange.responseAsync(Exchange.java:372) ~[java.net.http:?]
        at java.net.http/jdk.internal.net.http.MultiExchange.responseAsyncImpl(MultiExchange.java:408) ~[java.net.http:?]
        ... 17 more
Caused by: java.nio.channels.UnresolvedAddressException                                                                                                                                    at java.base/sun.nio.ch.Net.checkAddress(Net.java:149) ~[?:?]                                                                                                                      at java.base/sun.nio.ch.Net.checkAddress(Net.java:157) ~[?:?]                                                                                                                      at java.base/sun.nio.ch.SocketChannelImpl.checkRemote(SocketChannelImpl.java:816) ~[?:?]                                                                                           at java.base/sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:839) ~[?:?]                                                                                               at java.net.http/jdk.internal.net.http.PlainHttpConnection.lambda$connectAsync$0(PlainHttpConnection.java:183) ~[java.net.http:?]
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:569) ~[?:?]                                                                                         at java.net.http/jdk.internal.net.http.PlainHttpConnection.connectAsync(PlainHttpConnection.java:185) ~[java.net.http:?]
        at java.net.http/jdk.internal.net.http.AsyncSSLConnection.connectAsync(AsyncSSLConnection.java:56) ~[java.net.http:?]
        at java.net.http/jdk.internal.net.http.Http2Connection.createAsync(Http2Connection.java:378) ~[java.net.http:?]
        at java.net.http/jdk.internal.net.http.Http2ClientImpl.getConnectionFor(Http2ClientImpl.java:126) ~[java.net.http:?]
        at java.net.http/jdk.internal.net.http.ExchangeImpl.get(ExchangeImpl.java:93) ~[java.net.http:?]                                                                                   at java.net.http/jdk.internal.net.http.Exchange.establishExchange(Exchange.java:343) ~[java.net.http:?]
        at java.net.http/jdk.internal.net.http.Exchange.responseAsyncImpl0(Exchange.java:475) ~[java.net.http:?]
        at java.net.http/jdk.internal.net.http.Exchange.responseAsyncImpl(Exchange.java:380) ~[java.net.http:?]
        at java.net.http/jdk.internal.net.http.Exchange.responseAsync(Exchange.java:372) ~[java.net.http:?]
        at java.net.http/jdk.internal.net.http.MultiExchange.responseAsyncImpl(MultiExchange.java:408) ~[java.net.http:?]
        ... 17 more
[19:55:57 INFO]: [initial connection] /172.27.192.1:52290 has disconnected:

As you can see, the Unable to authenticate player error pops out and the player disconnected without any reason shown

## Things I Tried to Solve the Problem

I don't even know what is happening!
In my opinion, there should be no problem at all when connecting to its own WSL from Windows

But I still tried something:

1. netsh: Using portproxy to forward port to WSL

Code:
Listen on ipv4:             Connect to ipv4:

Address         Port        Address         Port
--------------- ----------  --------------- ----------
0.0.0.0         22          172.27.203.221  22
0.0.0.0         25565       172.27.203.221  25565

2. Hyper-V: Changing the WSL V-Switch to External Network would make the computer lost network connection completely

## Expectation

I can do something so that I can connect to the Minecraft server from any computer in LAN

## By the Way

  • I can connect to the SSH server hosting on WSL from any computer on LAN
  • I can ping the Minecraft server from the server computer's Minecraft (though it takes about 4 seconds to ping), but cannot detect it from other computer on LAN

Because the question is a bit complex, I might forget some details or things that I have tried to do. If you think my description is unclear, please correct me (>.-)d

P.S. Markdown ain't supported on this site?