By veritas at 2006-07-03 15:24
This is a common setup for Xbox users. You have a computer, TV and Xbox in one room, and a wireless router on the other side of the home. A logical option, besides buying an Xbox wireless adapter, is to connect your xbox to a PC that is connected to that router. In my opinion, is just as easy to get this working in Linux as it is in Windows.
1. You have a WLAN card and a regular LAN card installed
2. Both have working drivers installed
3. You can connect to the router with the wireless card and access the internet without problems
4. You have a crossover cable
5. Your WLAN interface is wlan0, and LAN is eth0
5. iptables is installed
1. Configure eth0
First, assign an IP address to the eth0 interface, which is the card that is connected to the Xbox via a crossover cable. Be sure to 'su' to root before continuing.
These two commands should have assigned an ip address to eth0. Verify this with
# ifconfig eth0 up
# ifconfig eth0 192.168.2.1
The ip address assigned should be a network that is not in use on your network. If your router address is 192.168.2.1 use something besides 2.1... 0.1, 1.1, etc.
2. Enable forwarding
The next step is enabling IP forwarding. Check to see if forwarding is enabled:
If the output is 1, you are good. If its 0, then run this command:
# cat /proc/sys/net/ipv4/ip_forward
3. Configure iptables
# echo "1" > /proc/sys/net/ipv4/ip_forward
With iptables, you can forward all of the traffic from eth0 to your wireless card wlan0:
You may have to replace 192.168.2.0 with whatever your network was from step 1. If you used 192.168.1.1 as the IP, then use 192.168.1.0 with the iptables command.
# iptables -t nat -A POSTROUTING -o wlan0 -s 192.168.2.0/24 -j MASQUERADE
4. Configure the Xbox
Go into the dashboard and then go to network settings. Then select IP Address and set the configuration type to manual. Here are the settings if you configured your eth0 as 192.168.2.1:
IP Address: 192.168.2.2
Subnet mask: 255.255.255.0
Go back a screen and go to DNS Servers. Set the primary DNS server to your router's IP address. Now, go back to the network settings screen and go to Connect. You should now be connected to Xbox live.
5. Making it permanent
If you restart your computer, you will lose all of these settings. So find the custom startup script for whatever distro you are using (for slackware, open the file /etc/rc.d/rc.local) and add this text to the file:
You should be good to go next restart.
ifconfig eth0 up
ifconfig eth0 192.168.2.1
echo "1" > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o wlan0 -s 192.168.2.0/24 -j MASQUERADE