PDA

View Full Version : TUT: Use your Ubuntu laptop as WiFi adapter for XBOX360


pippin418
05-02-2010, 08:12 PM
I use this guide I made to connect to Xbox LIVE. It's easy, but takes a while. When you connect, your NAT will be Moderate.

Items needed:
Xbox
Xbox LIVE
Laptop w/ Ubuntu 10.04 LTS (what I used, will work on lower versions too I think)
Crossover cable (not one that came with xbox), you probably have one lying around

Pre-Instructions:
Put one end of cable in xbox, don't plug in other end to computer until I say to.

Instructions:
Open 2 terminals - Have one run ping google.com.
Use the other one to run these commands

sudo su
ifconfig wlan0 0.0.0.0 #i am using wlan0 since the connection i'm giving my xbox is on wlan (wireless) your pings will stop working until you do the second step
dhclient wlan0 # same as above
ifconfig eth0 192.168.111.1 netmask 255.255.255.0 #eth0 is the cable going to xbox
iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE #replace wlan0 with your connection
echo 1 > /proc/sys/net/ipv4/ip_forward
apt-get install dnsmasq ipmasq #if you already have these, skip
/etc/init.d/dnsmasq restart
dpkg-reconfigure ipmasq
Select Allow, OK, After established
gedit /etc/sysctl.conf #enable sharing. look for line #net.ipv4.ip_forward=1 Remove the "#"


Right click on the wireless icon at the top. Edit connections. Wired > Auto eth0 > IPv4 Settings
Uncheck connect automatically
Address: 192.168.0.1
Netmask: 255.255.255.0
Gateway: (run route and wait for entry: default. in the second column, put that IP in Gateway)
Apply (enter password if asked)
Go to settings th network on XBOX 360 and edit the IP setting manually to 192.168.111.2 , then the netmask to 255.255.255.0 (or leave it to automatic 0.0.0.0 if you couldn't assign a netmask previously on ubuntu) and then set the gateway to 192.168.111.1 . Then you edit the DNS settings and change the Primary DNS to 192.168.111.1 and leave the secondary automatic (0.0.0.0).
Now plug in the other end of the crossover cable in to your computer. Connect to xbox live or test connection on your xbox. You're all set.

IMPORTANT:
When you're finished and want to browse the web again run sudo dpkg-reconfigure ipmasq And select No, OK, Disable. Then reboot.
Also, don't close anything until you connect on the xbox. Then feel free to close.

There you have it. Any questions? Post a reply.

EDIT
--------
I have a bash script to run to do this automatically. Put this in a file called xbox.sh and run it with root privileges. Remember to replace wlan0 and eth0 if you need to.

#!/bin/bash
ifconfig wlan0 0.0.0.0
dhclient wlan0
ifconfig eth0 192.168.111.1 netmask 255.255.255.0
iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
/etc/init.d/dnsmasq restart
dpkg-reconfigure ipmasq

At the end choose Yes, OK, After established.
MAKE SURE YOU DID THE apt-get AND EDITED /etc/sysctl.conf OR ELSE THE SCRIPT WILL NOT WORK.
Thank you.

pippin418
05-07-2010, 01:14 AM
There's a good python script I made for this too.
Run it as root.

import os
proc = raw_input("Do you want to turn XBOX compatability on or off? (on/off): ")
if proc in ('on', 'o', 'y', 'yes', 'ye'):
os.system('ifconfig wlan0 0.0.0.0')
os.system('dhclient wlan0')
os.system('ifconfig eth0 192.168.111.1 netmask 255.255.255.0')
os.system('iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE')
os.system('echo 1 > /proc/sys/net/ipv4/ip_forward')
os.system( '/etc/init.d/dnsmasq restart')
os.system('dpkg-reconfigure ipmasq')
elif proc in ('off', 'n', 'no'):
os.system('dpkg-reconfigure ipmasq')
elif proc in ('cancel', 'c', 'stop'):
quit()

Bubmeister
12-26-2010, 05:48 AM
will i still be able to use internet on my laptop at the same time?