Difference between revisions of "HOWTO: XBOX360 Internet Through Laptop"
m (→Added Italian Translation)
Latest revision as of 11:47, 3 May 2009
Use your laptop as the wireless interface for you XBOX360
xbox --> cable --> pc --> wireless --> router --> internet
OK, I'm pretty sure you could do two things on this.
1. Bridge the cards into the same IP range, and then you'd have connectivity.
2. Assign different IP range to LAN card than the WIFI card and then enable IP routing.
For me, the second is the easiest, because I've done it. The first, whilst in theory it should work, I'm not entirely sure as I've not tested it. But you could try, and I'll explain how I think it should work.
Esentially this sets up 2 IP ranged networks and provides routing between the two.
1) Bridging the cards
Ensure that bridge-utils are installed. You can then use a command called brctl to do many things such as add a bridge, etc. Here is how I just bridged my eth0 with wlan0.
[email protected]:/home/ian# brctl show bridge name bridge id STP enabled interfaces pan0 8000.000000000000 no
shows that I don't have any bridges other than the bluetooth one that was set up on my system already.
[email protected]:/home/ian# brctl addbr mybridge [email protected]:/home/ian# brctl show bridge name bridge id STP enabled interfaces mybridge 8000.000000000000 no pan0 8000.000000000000 no
now you can see I've created a bridge called mybridge, and so now I need to add interfaces:
[email protected]:/home/ian# brctl addif mybridge eth0 wlan0 [email protected]:/home/ian# brctl show bridge name bridge id STP enabled interfaces mybridge 8000.001a4b65d43e no eth0 wlan0 pan0 8000.000000000000 no
now you can see I've added eth0 and wlan0 to "mybridge". Now, you can allocate IP addresses from the same range to the xbox as you would for the wlan0 interface. For example, if I had all this, I would have something like:
Internet Router - 192.168.1.1 wlan0 - 192.168.1.2 xbox - 192.168.1.3
default router for the xbox would be 192.168.1.1, the same as it is for wlan0, and then of course you just need to supply the same DNS servers that you have for the PC using wlan0, so check /etc/resolv.conf and look for the nameserver lines, and give this IP address in here to the xbox for the DNS.
As I said, I don't know if this works, you can try it, but the next step definitely works.
Now, another way is with routing, and so what you'd need to do is look inside /etc/sysctl.conf for the following line:
net.ipv4.ip_forward = 1
if it's set to 0 set it to 1 like above, and then do:
to activate the setting, or alternatively, just simply reboot. Now, ensure you have an IP address assigned to eth0 that is different from wlan0. For example, this is how I would do it:
xbox: 192.168.2.2 eth0: 192.168.2.1 wlan0: 192.168.1.2 router: 192.168.1.1
so that you understand the above, your current internet connection is via the router, which is 192.168.1.1 in my example (of course replace this with your IP that you have for your router). Also, replace my IP for wlan0 with your IP. Then, what you need to do is ensure that the xbox uses a default gateway that points to the IP of eth0, so the default gateway for the xbox in my example is 192.168.2.1. For DNS, you'll have to use whatever you normally use for your PC that has the internet connection (check in /etc/resolv.conf as before). Now, once that's been done, you should be able to ping eth0 and wlan0 from the xbox, but you won't be able to go any further. This is because now, we need to set up iptables to do NAT'ing for us, so ensure you have iptables installed, and then run it by doing:
chkconfig iptables on service iptables start
iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
this will ensure that you have source nat set up for the xbox connection, so that it will pass through your PC and go to the internet. Once this is done, you should then be able to ping the internet router, which in my example was 192.168.1.1. And if that works, you should be able to browse the internet!