Friday, 14 December 2007

Hosting UT3 games... a truly daft solution!

Update: it now seems that one can simply remove the STUN server address in the ini file in order to get rid of the message and host games successfully. I.e. change "StunServerAddress=stunserver.org" to "StunServerAddress=" in UTEngine.ini

So... read on if you like - there's info there on what the error message actually means, and why it's totally stupid - but the solution below is now even dafter than before ;)

(end of update)

Well, last night I finally got sick of that stupid UT3 error message telling me that my NAT was incompatible with hosting games, and that I should check my router's manual about setting up 'port forwarding' and 'DMZ'. Oddly enough, you see, I actually know all about that. You'll also note that at no point does it bother to mention which ports need forwarding, making this particular error doubly crap: it's misleading as well as eroneous.

Anyway, all this malarky started when Patch 1 beta 1 was installed, and one of the things that patch did was to add STUN support for hosting games behind NAT. None of the later betas or the final patch have improved matters in this respect, BTW.

Now, you may well be wondering what STUN is and why it's useful in this context. I know that I was. And, quite frankly, I still am. STUN (more info here) basically just lets an application find out the machine's public IP address (i.e. the address that the NAT results in) and what sort of port-forwarding is in operation. OK - so far, so good.

Where it all goes a bit wrong is that if, like me, you're behind a 'restricted' NAT (and you probably are, if you have any useful sort of NAT at all - especially the type that acts as a very primitive 'firewall') then UT3 throws its chubby little hands up in despair and gives that error message. Even that isn't the real problem, annoying as it is. No, the real problem is that UT3 then will not let you untick the 'LAN' option when creating a game.

STUN might be useful for some things... but in this context, it really doesn't help.

So, like I said way back at the beginning of this entry, I'd had enough. If UT3 wanted to use STUN to annoy me, then I figured that I'd also use STUN to shoot that stupid error down.

I'm on a LAN here, which is why I have NAT in the first place. And on that LAN I have a linux box, ee-i-ee-i-oh. Well, actually I have quite a few linux boxes, but just one will suffice. You can certainly do what I'm about to describe using windows, and even on the same PC as you're running UT3 but, since I haven't tried that yet, I'll stick to describing what I have done.

I've set up a STUN server on the LAN, is what I've done. It's not visible to the outside world, which makes it utterly pointless as a STUN server since the only applications that can query it are also running on machines on the LAN, and thus the result will always be "open internet" (unless some firewall rules on the box(es) interfere, of course). Just for added value, the STUN server isn't even configured quite properly either.

I'm sure you can see where this is going ;)

So now my UT3 is configured to query the local STUN server, which leads it to believe that it has a direct connection to the internet with no NAT. UT3 then quite happily hosts games because, coming back to the original point, I have read my router's manual and set up 'port forwarding' properly (screw using a DMZ - that's way beyond what's actually required).

BTW, hosting games matters to me because the only way to really enjoy the single player campaign is to play it multiplayer. Yeah, I know. But then using a STUN server on the LAN makes no sense either. I'm getting almost used to that with UT3 now.

OK, so here's the juicy details, step by step, of what I did:

Download the STUN server/client from hereObviously, I downloaded the source and compiled it. If you're using windows, you'll probably want the precompiled windows binaries.

The STUN server wants to use two IP addresses on the box it's running on. Luckily, by stretching the point a little, you already have two with no need to muck about: your ethernet interface & the loopback interface. In my case, those IP addresses are 192.168.3.86 and 127.0.0.1, so I run the server like this: ./server -h 192.168.3.86 -a 127.0.0.1 -v(that -v is just for verbose output so that I can see what's going on). NB you do NOT need to be root to do this.

Check that the server is 'working': ./client localhostThat should return "Open".

Next up is editing UT3's configuration to tell it to use the local server instead of stunserver.org (the default). This is set in UTEngine.ini, which you'll find in My Documents\My Games\Unreal Tournament 3\UTGame\Config (phew). Searching that file for "stunserver.org" is probably the easiest way to find it. Replace stunserver.org with the hostname (or IP address, I guess - I haven't checked that) of the machine your STUN server is now running on.

Now you need to actually forward the relevant ports from the outside world to the machine that you're playing UT3 on. All the ports are UDPand their numbers are:7777, 7778, 7787, 6500, 13000, 27900Disclaimer: I'm not 100% certain that all of those ports are required. Some of them probably aren't. I arrived at that list thanks to enough trial and not enough error, i.e. it works with those ports forwarded, but I haven't tried closing them to see what makes it break ;)

Enjoy public, non-LAN games! I know that I do :)

In conclusion: my 'solution' is hacky, dumb and should never have seen the light of day. Much like UT3 in its current state. -- zing! --

14 comments:

Wow. Amazing. It absolutely blows my frickin mind that in this day and age it is still this difficult to make computers talk to each other. To think I actually looked forward to UT3 being better at this sort of thing ...

Yeah - 7777 is the bare minimum; the others are query ports AIUI, allowing clients/etc to get info on the game you're hosting (7778 and 7787 are traditional UT ports for that, for instance). As for the rest... no idea what they're for, I got the list from a topic on the UT3 forums :)

Like the guy before me, this fix doesn't work. I am unable to host despite trying everthing listed here.

I was really hoping the UT3 Black patch and Steam integration would make this game finally work, but amazingly it doesn't. Most people I know that have the game get this error message and cannot host. It blows my mind that Epic does nothing to fix this.

This worked with 1.3. This doesn't seem to work any longer with 2.1. All required ports open and forwarded on the router firewall, UT3 itself allowed in Windows' firewall, STUN server running, UTEngine.ini edited.

The warnings don't pop up, but people just get "Connection Failed" after a time. This used to work fine with v1.3 of the game.

Sorry - 'fraid I don't have a clue... It's actually been a long time since I even tried to host a UT3 game - I just didn't enjoy the game that much so when things like Left4Dead came along I pretty much lost any enthusiasm I had for UT3 :p

Forks fine with me - AND I have a patch 1.5!! This solution matters only if you have patched the UT3. You gotta do as described here: http://www.lanpartyguide.com/ut3.html Now while having all things rendered according to the manual from web I put link here of, you need only to add your IP in router settings to DMZ - then enjoy.. OH and don´t forget that you´d better have the subnet mask 255.255.255.0 - other masks won´t let anyone to connect!! I dunno why but it´s like that.