Wednesday, October 12, 2011

wifi enabling your xbox 360

my daughter received an xbox 360 from her friend for her birthday. i wanted to try out kinect, so i bought a used one from the local eb games and rented just dance 3 from gamefly. unfortunately it is a rather old 360, so i had to buy the ac adapter for it. (lame! the 360 is a really power hog and now we have to plug something else in?!?) i hook everything up, power on the xbox, and up comes "you need to do a system upgrade".

so, i go to system settings to setup the wifi to do the upgrade and that is when i discover -- no built-in wifi! really!?! the wifi adapter is another $40, but all i really need it for is the upgrade. so i pull out my trusty thinkpad and try a bridge. (wow, i should be getting paid for these product placements!)

it turns out to be really easy if you have a linux laptop with wifi and an ethernet port.

it helps to know a bit of background information:

private network addresses are networks not found in the internet. they are designed to be used for local private networks. you see them used in your home router. if you look at the address of your laptop right now, it will probably be 192.168.1.X. you can find a full list, and description, at http://en.wikipedia.org/wiki/Private_network.

we are going to use nat aka masquerading to route traffic from the xbox to through the laptop to the internet. when doing nat the laptop will rewrite network traffic flowing through it so that it looks like the traffic is coming from the laptop, which is connected to the internet. (the funny thing is, your laptop is probably connected to a wireless router which is doing exactly the same thing.)

when connecting network devices, such as a laptop and an xbox using twisted pair ethernet (in other words, using those glorified phone jacks) you usually use two cables to connect each device to a network hub. the hub is too much of a pain if we are only connecting two devices. an alternative is to use a crossover cable that allows two devices to directly connect to each other. in a sense it makes each device look like a hub to the other device. fortunately, any reasonably new laptop will have an ethernet port that supports auto-mdix, which will automatically detect if a cross-over cable is needed and adjust accordingly. this allows you to get the cross-over cable functionality using a normal ethernet cable.

finally, network devices use DNS to translate names into addresses, so we need the address of a DNS server to do this translation. fortunately, google provides an open DNS server for anyone to use. (right now you are probably using a DNS server provided to you by your internet service provider.) the address of the google DNS server is 8.8.8.8.

physically connecting xbox to the laptop

  1. connect the xbox and laptop together using a single ethernet cable.
okay that was simple...

setting up the networking on linux

we are going to use a private network to connect the two devices. our linux box which will be the router will have the address 172.16.17.1. our xbox will have the address 172.16.17.2. we also need to turn on routing on our linux box. finally, we need to tell the kernel to masquerade the packets coming from the xbox. we do this all with the following three simple commands. (make sure you are root when you do this!)
# ifconfig eth0 172.16.17.1
# echo 1 > /proc/sys/net/ipv4/ip_forward
# iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
that wasn't too hard either right?

setting up the networking on the xbox

go to the system settings menu and choose to configure the wired settings. by default it will do automatic configuration. we could set linux up to configure the xbox automatically, but that is more work. it's easy to setup manually:

  1. change the ip address to 172.16.17.2
  2. change the subnet to 255.255.0.0
  3. change the gateway to 172.16.17.1 (the laptops ip address)
  4. change the DNS server to 8.8.8.8 (the google dns server)
you should end up with a screen that looks like:


and there you have it. you are good to go! the update came down and i was able to play just dance 3 on my update xbox 360 with my kids.