4

Lately I've been having some trouble with Minecraft LAN games. Not with hosting them or even with joining them exactly, but with seeing them at all. Here's the situation:

  • I am not able to see Minecraft LAN games on my multiplayer screen automatically
  • I can see them if I add them as I would a server on the internet
  • I can join them if I add them, or if I connect to them directly

Basically, I can join games but not find them automatically. It just says "Scanning for games on your local network..." indefinitely. My current theory is that while joining games obviously doesn't require opened ports discovering them might - is this the case?

As far as I know I can't permit specific applications through my firewall (I'm on Linux, and not that I'd care to just give a blanket permit to Java in any case) so I can't test this without having some idea of what ports would be required. It's also possible it's another issue pertinent to Linux or something else altogether, though.

This isn't a huge deal as I can just ask what port the server is being hosted on, but it's been bugging me. Oh, and in case anyone comes across this question with a similar problem, I'm just going to reiterate:

You can join the game by connecting to it directly, just ask for the port. The person hosting will receive a message with it when they open the game. Then you can directly connect to it at (probably) 192.168.#.###:####.

UPDATE: Hosting on LAN works fine, I just can't see the games others host. Additionally, I should clarify I actually mean opening ports on my local firewall, I said port forwarding but that was not actually what I meant.

For a further clarification, this isn't isolated to one person - I've tried with both my brothers, neither of whom is using any special security software that I know of. And they can see each others'.

  • as far as i know, no. – Ender Dec 27 '13 at 4:31
2

Newer Fedora versions (Fedora 18 and onwards) use Firewalld to manage iptables rules. The iptables service that loads rules out of /etc/sysconfig/iptables is not present by default. A bunch of my answer involves manually bashing about in iptables rules. This is a bit of new ground for me, as my main experience with firewalld up to this point has been making a beeline back to traditional reading of iptables rules out of the save file. Most of the firewalld information was collected on the fly based on the iptables rules that it implemented.

I double-checked this on a Fedora 20 VM that I've been fiddling with. When a rule is set in firewall-config, the packet for a new connection must go through the following steps to be accepted.

  1. New packet hits INPUT chain. Packets in existing connections are automatically accepted.
  2. All prospective connections from the outside are sent to the either the INPUT_ZONES_SOURCE chain or INPUT_ZONES chain, based on whether they were picked out based on source IP or the interface the packet came in on. The logic within each is pretty much the same, other than the IP/interface note. I'll be focusing on INPUT_ZONES_SOURCE for my example.
  3. I added my Minecraft rule to the 'home' zone, so I had added an entry in home->sources stating that packets coming from the network address of 10.20.30.0/24 were coming from home. In INPUT_ZONES_SOURCE, there was a rule that would send all packets coming from that IP range to the IN_home chain.
  4. In the IN_home chain I had three chains dedicated to specific tasks: IN_home_log, IN_home_deny (this was empty, as I hadn't set anything), and IN_home_allow.
  5. IN_home_allow held all of the allowed services for the 'home' zone, including the 25565 rule that I had just put in. Though I didn't start up a Minecraft server or bind anything else to TCP/25565, I could see that some other default rules did record that packets were being accepted, so traffic was being evaluated against this rule.
  6. Any rule that does not get accepted will eventually splatter against the last rule of the INPUT chain. The final rule will reject any packet that is still on the chain.

To get to the point of my explanation, could I confirm that you've set an input interface or a IP address/range for the zone that you're allowing the port in? You've placed a rule to allow the port in a given zone, but it sounds as though the packet doesn't have a way to reach that rule and be accepted.

You can list a table using iptables -nvL. Firewalld sets up a lot of chains, so if you want to take a look at one in particular, add the chain name as an argument: iptables -nvL <chain-name>. If you can see numbers greater than zero in the lefthand columns, this means that packets have reached and triggered the rule. (The action the rule takes is in the third column).

To force your firewall to accept everything, and to see if something along the line is causing you grief, you could stop the firewalld service altogether temporarily.

systemctl stop firewalld

You can alternately flush the tables with iptables -F, though I'm not sure when/if firewalld will repopulate the chains on their own without a rule change to prompt it to do so.

Hopefully this will solve your issue. But if you want/need to go to a custom iptables layout by having the firewall load its rules out of /etc/sysconfig/iptables, you will need to install and enable the service, as well as disable firewalld.

  1. Install iptables service: yum install iptables-services
  2. Stop Firewalld: systemctl stop firewalld
  3. Disable Firewalld: systemctl disable firewalld
  4. Start the iptables service (If you don't have an /etc/sysconfig/iptables at this point, this won't do anything): systemctl start iptables
  5. Enable the iptables service: systemctl enable iptables
1

No you do not need to forward ports for playing on LAN. Port Forwarding is only for connections that are leaving/incoming through your router, ie. internet game hosting. It's part of something called Network Address Translation, NAT for short. Without going into too much technical detail, basically it's a clever way routers hide/protect your computer from being exposed on the public internet. So, in order to allow public internet computers to talk to your computer, you have to "expose" certain ports that the router will allow to talk to your computer. Anything that's going on within your local network, LAN, does not need to go out to the public internet, so NAT is not involved, and therefore no port forwarding needed.

Now, there can be other things at play, such as if you or your buddy have installed any 3rd party Firewall software on your computer, it may be blocking the game. If so, either temporarily disable it, or tell it to allow your game to make connections. For the normal Windows firewall built into Vista and up, it will ask you if you want to allow the program to talk to the network (LAN) usually the first time you run it.

  • Okay, I shouldn't have said port forwarding as that's not actually what I'm doing. Just from force of habit doing so on my router so many times. I just needed to allow them through my firewall. I'll edit the question to reflect that. – Dylan Dec 27 '13 at 4:41
  • Minecraft uses port 25565 for everything, internet hosting and local network hosting. So, your local firewall will need to allow this port. Which linux are you running? Is the firewall iptables or something else? – SnakeDoc Dec 27 '13 at 4:49
  • The firewall is the default firewall. I am using the interface provided by Fedora to modify it, but I'm 99% certain it's iptables. And local servers aren't hosted on 25565 and, in any case, that's not the thing I have a problem with. I can host fine, and my servers are even visible. – Dylan Dec 27 '13 at 5:09
  • Yes Fedora uses iptables (I <3 fedora btw lol). I don't use the gui for it, does it have an option to allow the minecraft executable/jar? If you want to verify it is indeed a local firewall problem, try temporarily disabling the firewall. If no gui option, on the terminal do sudo service iptables save then sudo service iptables stop and see if it works. To start it again, sudo service iptables start – SnakeDoc Dec 27 '13 at 5:17
  • As far as I know iptables hasn't had support for allowing specific applications for some time, certainly not in Fedora's version, and I would assume that this isn't something that can be handled in the GUI interfaces provided as they ultimately deal with iptables. You can allow based on groups, however (though I don't think in Fedora's GUI). It was in fact a firewall issue and I've posted an answer for any who are curious. – Dylan Jan 1 '14 at 0:15
1

It is necessary to open UDP port 4445, commonly used for the service upnotifyp. I tested this across a couple games and, since it's actually a registered port rather than the random ones Minecraft usually chooses, I think it can safely be assumed to be consistent across games. I hope someone else finds a use for this, it took a fair amount of effort to figure out what was wrong.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.