Minecraft can't find server on local LAN
Problem: A minecraft server is running on the local network, but the Minecraft client can't find server on the local LAN.
How to debug?
Test Manual Connection
Test if you can manually connect to the server. Add new server, and set the IP address and port to `IP address of your server:port number`. The IP address of your server is either the IPv4 or IPv6 address of the computer that has opened Minecraft to other players. The port is the number that is displayed in the chat after pressing the "Open to LAN" button. For example, the address could be "10.1.0.37:58314". If you can't connect, try IPv6 instead of IPv4 or the other way around.
If you can connect manually, the problem is with the auto-discovery.
Debug Minecraft auto-discovery
Minecraft advertises servers to UDP port 4445. It does not use DNS-SD.
Advanced users can debug this with Wireshark. However, beware that on Windows, Wireshark will not receive any UDP packets that are not bound to a socket. So you first must start Minecraft before you are able to see these packets. Once bound, they will show, even if Windows Defender Firewall is not forwarding them to Minecraft.
Ensure that Minecraft can receive incoming traffic (note that this is different from connecting to a TCP server, as that is considered outgoing traffic).
- In Windows 10, go to Settings > Updates and Security > Windows Security > Firewall & Network Protection. This should open a new window, called "Windows security".
- In the main window of "Windows security" click "Allow an app through firewall". This should open a new window, called "Allowed apps".
- Find the Java version that Minecraft is using. Likely "Java(TM) Platform SE binary" or "OpenJDK Platform binary". Ensure that both the checkbox in front and the checkbox underneath "private" are checked. Save these settings.
- Minecraft should now be able to see server on the LAN.
On older versions of MacOS, Java uses IPv6 by default for service discovery, but the server is only announced over IPv4.
(Note, I have not seen this problem recently, so it might have been specific to an older MacOS version, or OracleJDK and not OpenJDK).
- Force Java on the client to prefer IPv4.
- Steps to fix
- Quit Minecraft and open the Minecraft Launcher
- Select the Minecraft "Installations" tab.
- Edit the installation that you are normally playing
- Select "More options"
- At the "JVM arguments" append the text ` -Djava.net.preferIPv4Stack=true`. In my case, the whole line now reads `-Xmx4G -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:-UseAdaptiveSizePolicy -Xmn256M -Djava.net.preferIPv4Stack=true`
- Save and start Minecraft.