A little over a year ago, I posted how I fixed some problems I was having with Xbox Live by setting up UPnP on my Linux router. Since I was finally able to get my hands on an Xbox 360, I figured it was time to update my guide on using Live behind a Linux NAT. The instructions work for both Xbox and Xbox 360, but I'm going to focus on the Xbox 360 configuration this time around.
First things first. If you don't need to do this, don't do this. How do you know if you need to do this? Are you using Linux as a NAT router for your home network? Does the Xbox 360 report your NAT as moderate? If so, you probably need to do this. What is "this"? Keep reading.
Since the last time I posted, the Linux-IGD project has seen some development, but to look at their home page you wouldn't know it. Even the Sourceforge page still shows 0.92 as the latest version, having not been updated since January 12, 2003. All of the recent changes are in their CVS repository, though, so we'll build from that instead. Follow the instructions to checkout linux-igd to your machine.
If you followed my previous post, make sure you've fully uninstalled upnpsdk and linuxigd (a "make uninstall" should be enough for upnpsdk, and for linuxigd you should at least make sure upnpd is not running and remove the /etc/linuxigd directory). Once you've checked out the CVS project, you'll find a file called INSTALL. Read that to guide you through installing libupnp-1.2.1. Make sure you download version 1.2.1 and not version 1.2.1a from the download page. The INSTALL file is not exactly correct, as you can't just run "make" from the libupnp-1.2.1 root directory. Instead, go down into the upnp directory under libupnp-1.2.1 and run make there. This should also build ixml and threadutil at the previous directory level. Follow the rest of the INSTALL steps, making sure to copy the extra ixml and threadutil libs and includes. Finally, you can build and install the CVS linux-igd following the steps in the INSTALL file.
Before you fire up upnpd, first take a look through /etc/upnpd.conf and make sure everything is set to your liking. Some settings I suggest (these should be the defaults):
- Make sure "iptables_location" points to the path to your iptables binary. This should default to /usr/sbin/iptables and should already be correct, but double-check to be sure.
- debug_mode = 1. Without this, you're not going to be able to keep tabs on what upnpd is doing.
- Make sure the chain names for forward and prerouting are correct for your configuration. The defaults should usually be right, but it doesn't hurt to double-check.
- Set your upstream_bitrate and downstream_bitrate if you really care. These are in bits per second, not bytes, so make sure you multiply by 8 if you start from bytes per second. For example, 2 Megabits per second would be 2097152, but 2 MegaBytes per second would be 16777216.
Now you can fire up upnpd by running "upnpd <external ifname> <internal ifname>", where <external ifname> and <internal ifname> depend on your configuration (they are eth0 and eth1 for me, respectively, but yours might be different -- check /sbin/ifconfig if you're not sure). If all goes well, upnpd will now be running if you look at the process list (I use "ps waux | grep upnpd", and look for entries like "/usr/sbin/upnpd eth0 eth1"), and you should see some messages in /var/log/messages and /var/log/debug.
Now that that's taken care of, start up your Xbox 360 and go to the System blade. From here, choose Network Settings and then Test Xbox Live Connection. You'll be prompted that testing the connection will sign out all profiles, so choose Yes and get down to business. You should now see something like this:
The most important line is the one called "NAT", and it should read "Open", like so:
(For original Xbox users, read my original post
for steps to check your NAT level.) If it doesn't, something went wrong. On the linux box, run "tail -f /var/log/debug" (if your syslogd is configured to log debug messages somewhere else, tail that log instead -- you can find out what your syslogd will do by looking at /etc/syslog.conf). When you run the Test Xbox Live Connection troubleshooter, you should see something similar to the following in your log when it gets to the "Xbox Live" portion of the test.
If you don't see that, run "killall upnpd" and then check ps to make sure upnpd has died before restarting it. Watch the debug log when restarting, and if you see any errors you can look into the Linux-IGD forums
to see if you can find some help. Luckily for me, everything worked great the first time.
By the way, if you have a Windows box behind your NAT, it should now pick up the UPnP gateway device (you may have to install some components through the Add/Remove Programs applet to be able to see UPnP connections, and even if you already have UPnP support installed you'll need to reboot for the OS to pick up the gateway device). For example, on my XP laptop, I now see this in my Network Connections control panel:
From here, you can drill down into the gateway device's Status, then Properties, and finally Settings to see the list of current port mappings.
If you can't get this working, you can use Noel Danjou's UPnPTest
(about halfway down the page, "Univeral Plug-and-Play Tester") to test your UPnP configuration instead. Linux-IGD still reports itself as version 0.92, but the CVS version is really something like 1.04 or 1.05 now.
Hopefully this will help out other people trying to get Xbox Live working on their original Xbox or new Xbox 360, since Microsoft doesn't officially support Linux as a NAT router. If you've had problems and been told to go buy a router off of the official compatibility list even though you'd rather continue with your Linux setup, this is for you.
Update: One minor note that I forgot. You may need to do a little bit of manual patching of the linux-igd code, if that fix hasn't merged into CVS. Read that thread, and look in your downloaded code to see if you need to manually patch or not before you actually build.