XBox Live!, Linux, NAT, and UPNP

| 5 Comments

A little bit of background first. I've been a subscriber to XBox Live! since its launch in November of 2002. For a while, I was on DSL (at my old apartment), and had a nice static IP dedicated solely to the XBox. Later, I bought a house and could no longer get DSL, so I switched to cable. No more nice static IPs, but I paid for a second dynamic IP and strung a looooong ethernet cable across my entire house and hooked up the XBox that way. In both of these cases, life was good. Of course, I couldn't just leave well enough alone. I was annoyed by the long ethernet cable, and Microsoft had just shipped the XBox Wireless Adapter, so I bought it. Now, a bit of background on my wireless setup: I use a Linux machine to do Network Address Translation (NAT) for my internal network (a wired desktop, a wireless laptop, a wireless TiVO, and now a wireless XBox). I've used a similar setup since college, oh so many years ago (I believe the first time I set this up was 1998). Anyway, back to the story. I plugged in the XBox wireless adapter, set it up, and things worked great. The XBox could connect to Live!, and I could play games. Then I noticed that there were some games I couldn't connect to. I lived with it, because there was usually an abundance of games to choose from (btw, my poison of choice is Project Gotham Racing 2 (PGR2)). Now that the game has been out for more than a year, the number of available online games or "rooms" has dwindled, and the "This session is no longer available" message is much more annoying. When there are only four or five available games in the list, and I can only connect to one of those if I'm lucky, my gaming time is spent more on searching for games than actually playing.

Well, I finally decided to do something about it. I was told to check out this page to help diagnose my problem. The key metric here was the "NT" value, or NAT Type. My XBox reported that value as 1, or "open", which means I shouldn't have any problems connecting to online games. And yet, I was. The description of NAT Type 1 is as follows, and gave me my first clue:

Open NAT means that either the port assignment policy is minimal or the router has a fully compliant version of UPnP (Universal Plug and Play) enabled by default.

"Ah ha!" I thought. UPNP is where to start. I knew for a fact that my Linux NAT server didn't support UPNP, so that was a very good first lead. A bit of time on Google gave me the SourceForge site for the Linux UPnP Internet Gateway Device (linux-igd) project. My first instinct was to see if it was available already in Debian, but of course it wasn't. So, time to grab the source. As I read the README, I was pointed to the Linux SDK for UPnP Devices (libupnp) page as a requirement for building linux-igd. Not a problem, so I check Debian's package list again with no luck, and download the source for 1.2.1.

Building and installing the source went smoothly, so I switched over to the linux-igd code and started building. Holy crap, there were a lot of errors! After a half hour of investigation (or, "investigation", meaning, "hair-pulling, cursing at my PC, and just general frustration"), I realized that linux-igd is pretty old (the latest tarball was Jan 12, 2003), while libupnp was a little newer (latest tarball Feb 13, 2003). I grabbed an older version of libupnp (or upnpsdk, as the 1.0 version was called), removed the 1.2.1 version, and built and installed the 1.0.4 version.

Okay, now back to linux-igd. With upnpsdk 1.0.4 in place, linux-igd built like a champ. I installed the binaries, added the necessary route (route add -net 239.0.0.0 netmask 255.0.0.0 internalInterface), ran the daemon (upnpd externalInterface internalInterface), and started tailing the syslog debug log (/var/log/debug in my case, but where you've told syslogd to log debug messages).

Time to fire up the XBox. I turned it on, put PGR2 in the tray, and loaded up the game. While the XBox was starting, I noticed a request to the UPnP daemon for a port mapping. This is starting to look good. I connected to Live! in the game, went to Optimatch, and did my standard search ("Kudos racing, selection limited to class of cars", because I like competition and it's better when everyone is forced to choose cars of similar capabilities). Seven or eight games showed up the list, and I picked one at random. Previously, I would've gotten an error saying "The session is no longer available" (well, okay, that only happened about 75-80% of the time). Tonight, the first game I chose allowed me right in. Thinking to myself that it must've been a fluke, I left the lobby and tried a different game. It worked. I did that another four or five times, and aside from trying to join one game with 7 out of 8 people in the lobby and having it fill up on me right as I tried to join, every game worked.

The moral of the story is that an "open" NAT as the XBox Dashboard reports it may not actually be an "open" NAT, if you don't have UPnP support. It seems that XBox Live! really relies on UPnP when running in a NAT configuration, so you need to provide that support if you want a smooth experience. The easiest route is to just buy one of the many commercially available routers that are now available at very reasonable prices, but I don't always like "easy". Now that my Linux box has UPnP support, I have the best of both worlds: Complete control over my network configuration and firewall, and rock-solid XBox Live! support. And best of all, it didn't cost me a thing since I already had everything I needed in place already.

5 Comments

I followed your instructions and had no trouble getting upnpd to run on my own Debian NAT box. I noticed, however, that the Xbox's network diagnostics still show "NT: 2", indicating a "moderate" router, which is exactly what it was showing before I installed upnpd. Does yours show "NT: 1" for an "open" router? If so, what might I be doing wrong? (If not, I suppose it really doesn't matter.)

The dashboard was showing "NT: 1" before even doing this, which is why I was initially confused. If you're showing a different "openness" level, your firewall may be more restrictive than mine (mine is pretty liberal, only blocking known-bad incoming ports and not blocking any outgoing ports). Also, if your linux box is behind a hardware router doing NAT (ie, you have two levels of NAT), rather than being connected directly to your cable or DSL modem, that could be the culprit. Finally, your ISP may have you behind a NAT that they control, though this seems to be pretty rare these days.

From the logs I watched, I found that I have to "prime" the UPNP first by going through the Network setup in the dashboard (running the "Connect" under Network Settings, which you have to do to get your NT value anyway). It seems that once the XBox has requested a port from the UPNP server, that port will always be available until the UPNP server is shut down. You only need to prime if you've restarted the upnp server (either by stopping and starting it yourself, or by rebooting your linux box). The games themselves apparently don't send out UPNP requests according to my logs, which is a little perplexing. That may be a bug in linux-igd or libupnp/upnpsdk where it doesn't receive all UPNP requests (there are patches around for upnpsdk to work with MSN Messenger, for example).

I suspect that the "NT: 2" is the root of your problems, but if implementing UPNP on your NAT box didn't help that, I don't know where to go from there. I would suggest calling XBox Live support and seeing if they can give you any information. However, they're usually not willing to help if your NAT is provided by a Linux system rather than a commercial hardware router, so you may have to get them to escalate you to a higher support level, or you may just be out of luck.

Good luck.

Actually, not long after I posted that comment, I got a display of "NT: 1". But then later I got a display of "NT: 2" again. However, it doesn't seem to affect me that much (I was able to connect to several World Championship Poker and Tetris Worlds games last night), so I'm gonna leave well enough alone for the moment and hope for the best. But I'll keep the "prime" requirement in mind.

The Linux box is acting as the only router here, and I'm going through Comcast, so I don't think they're double-NATting me. Also, I'm seeing UPNP port requests from my wife's computer in the logs; she uses MSN Messenger, so this may help her, too.

Thanks.

Hey mine is at nat 3 and i am so lost and confused ... if someone could walk me through what to do i would highly appreciate it :)

i have the same problem but i have a 360 and when i try to join game sessions it always says the game session is no longer avaible then i get disconnected from xbox live and when i get connected to live it says i have an open NAT. so can anyone help me get connected right.

About this Entry

This page contains a single entry by published on January 12, 2005 11:10 PM.

Get your TiVO ready! was the previous entry in this blog.

Greasemonkey for Internet Explorer - GreasemonkIE is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Ads

Pages

OpenID accepted here Learn more about OpenID
Powered by Movable Type 5.01