Minecraft LAN world & Firewalld

I block all Firewall ports by default, and that made Minecraft LAN worlds not work anymore.

Apart from that it is basically Microsoft Hell and I will probably play Minetest+Mineclone2.

I found what ports are needed to make LAN worlds work:

sudo firewall-cmd --zone=internal --add-port={5000,25565}/{udp,tcp} --permanent
sudo firewall-cmd --reload

Or add the Port 25565 and another one through the Firewall GUI, for TCP and UDP.

I think on Fedora apps can’t open ports themselves, 25565 is always needed, the other port is manually defined in the game, you always need to use the one you chose.

But I still can’t discover the server in “local available servers”, connecting through IP works perfectly. Anyone know how to add this?

Using the Flathub Flatpak.

You can identify the ports like this:

  • List open sockets and filter by the process name.
  • Capture and analyze the traffic while the firewall is stopped.
1 Like

Could you help me find the needed commands?

Would like to create a howto

Added proposed-howto

You should start with the relevant service definition:

sudo firewall-cmd --info-service=minecraft
sudo firewall-cmd --permanent --add-service=minecraft
sudo firewall-cmd --reload

If the issue persists, check for open sockets, temporarily stop the firewall service, start capturing traffic, and test the previously failed features:

sudo ss -lnpAinet
sudo systemctl stop firewalld.service
sudo tcpdump -evnni any

This helps identify the ports and protocols that can be added to the above service definition.

It is best to isolate the service in a VM or container to minimize unrelated traffic.

In addition, check for SELinux denials and if there’s any, temporarily switch to permissive mode:

journalctl --no-pager -b _AUDIT_TYPE_NAME=AVC
sudo setenforce 0
2 Likes

Added 3rd-party-software and removed server