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 "" 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 here
    Obviously, 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 and, so I run the server like this:
    ./server -h -a -v
    (that -v is just for verbose output so that I can see what's going on).
    you do NOT need to be root to do this.

  • Check that the server is 'working':
    ./client localhost
    That should return "Open".

  • Next up is editing UT3's configuration to tell it to use the local server instead of (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 "" is probably the easiest way to find it. Replace 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 UDP and their numbers are:
    7777, 7778, 7787, 6500, 13000, 27900
    Disclaimer: 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! --


noise said...

Excellent. Thanks for this solution to an annoying problem :)

Anonymous said...

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 ...

But, um, thanks for the solution.

JoeBlack said...

Hey there, thanks for this howto, you saved my day! ;)

But you don't have to forward all these ports. I tested it and the only port you actually need is 7777! Try it by yourself - it works fine for me.

Adny said...

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 :)

Anonymous said...


6500 (Query)
6515 (Dplay UDP)
7777 (Port for UT3 - default is 7777, you can change in server setup)
13000 (Port for UT3)
13139 (Custom UDP Pings)
27900 (Master Server UDP Heartbeat)

3783 (Voice)
6667 (IRC)
28900 (Master SErver List Request)
29900 (GP Connection Manager)
29901 (GP Search Manager)

Adny said...

Thanks for the port list :)

Anonymous said...

I've tried this fix before and after the 2 patch without much success. The solution that involves erasing the stunserveraddress= line does nothing, my error message still stays.

Running the server as explained in the long fix removes the message, but other players are still unable to join my server.

I understand that others have seen this working, but for some reason I, and 3 of my friends, are unable to replicate the result.

Is there something that I'm missing, or is some other, un-fixable factor denying me my hosting ability.

Jeff said...

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.

Danny said...

I bought UT3 via steam and gifted it to a friend las week with the 12€ offer, and I've tried a hell of stuff to hos games and play between us, but we seem to be unable to make it work.

Also this amazing workaround does indeed make the error message disappear, but my fiend is still unable to join my games.

I've posted about it in the Epic forums to see if I get any sort of answer.

Adny said...

I tried hosting my first game with the new version of UT3 the other day...

I removed the "stunserver=" from the INI file (the update put a new one in there)... but the annoying error message came up. I could, however, host games just fine.

I didn't bother trying a local STUN server, but I guess it's possible that Epic have broken things even more and now doing that could make it fail (with no message) instead of work.

For those having trouble hosting, I'd suggest making sure that your router is forwarding the appropriate ports to your PC... beyond that, I don't have a clue :p

It amazes me that they're still using such an idiotic test. But then again they do apply the test at a stupid time anyway, so I guess I shouldn't be so shocked that the test itself is so dumb.

What a farce :(

Fairlight said...

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.

Any updates to this?

Adny said...

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

Anonymous said...

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:
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 - other masks won´t let anyone to connect!! I dunno why but it´s like that.

Anonymous said...
This comment has been removed by a blog administrator.