LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Linux Answers > Networking
User Name
Password

Notices

By veritas at 2006-07-03 15:24
Introduction

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.

Assumptions

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

The guide

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.

Code:
# ifconfig eth0 up
# ifconfig eth0 192.168.2.1
These two commands should have assigned an ip address to eth0. Verify this with

Code:
# ifconfig
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:

Code:
# cat /proc/sys/net/ipv4/ip_forward
If the output is 1, you are good. If its 0, then run this command:

Code:
# echo "1" > /proc/sys/net/ipv4/ip_forward
3. Configure iptables
With iptables, you can forward all of the traffic from eth0 to your wireless card wlan0:

Code:
# iptables -t nat -A POSTROUTING -o wlan0 -s 192.168.2.0/24 -j MASQUERADE
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.

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
Gateway: 192.168.2.1

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:

Code:
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
You should be good to go next restart.

by Nergar on Mon, 2007-02-12 17:53
hey, great tutorial you gave me one more reason to erase my XP partition.
only one thing. when i test my xbox live connection i have a NAT error, it shows MODERATE. Do you know what can i do to fix this, when i connected through XP i didn't have this error.

thanx

by SiegeX on Fri, 2007-12-14 18:04
He forgot to tell how to Port Forward the Xbox live connection. Here is what you need

Code:
 $IPTABLES -t nat -A PREROUTING -i $WAN_IF -p tcp --dport 3074 -j DNAT --to-destination $XBOX_IP
   $IPTABLES -t nat -A PREROUTING -i $WAN_IF -p udp -m multiport --dports 88,3074 -j DNAT --to-destination $XBOX_IP
   $IPTABLES -A FORWARD -i $WAN_IF -d $XBOX_IP -p tcp --dport 3074 -j ACCEPT
   $IPTABLES -A FORWARD -i $WAN_IF -d $XBOX_IP -p udp -m multiport --dports 88,3074 -j ACCEPT
Make sure you set the variables appropriately

by troubledlinuxuser on Tue, 2008-08-19 20:55
it wont seem to stay permanent can some one please help me?

by Nergar on Wed, 2008-08-20 01:01
Quote:
Originally Posted by troubledlinuxuser View Post
it wont seem to stay permanent can some one please help me?
What distro are you using?

I think I used /etc/rc.local in ubuntu.

by troubledlinuxuser on Wed, 2008-08-20 13:04
im using Ubuntu. but rc.local has no effect, i can type it into my terminal get it to work but then after i turn off my computer it never works again.

also could ndis wrapper have any affect on this?

by Nergar on Thu, 2008-08-21 11:27
I don't think ndiswrapper has anything to do but I can't be sure.

Did you tried creating a script in your /home directory and executing it with rc.local?

/home/daniel/xboxnet.sh:

Code:
#!/bin/bash
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
and /etc/rc.local:
Code:
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

/home/daniel/xboxnet.sh
also make sure nm-applet is not messing with eth0

NOTE: both files need to be executable.

by troubledlinuxuser on Sat, 2008-08-30 16:02
Hey! thanks it works now!!!

by WarTurkey on Wed, 2009-07-08 00:38
Well, I guess I'm the lone soul who this doesn't work even the first time. I don't get any errors upon entering the commands, but when I test my Xbox Live connection, it says there were errors and that it could not reach the xbox live servers or Xbox.com. When I set the DNS to manual and to the address of the laptop (192.168.2.1, like in the tutorial) it hangs for a while and then gives a different error.

Would be great if I could get this to work! Any idea of how to fix it would be nice!

by WarTurkey on Wed, 2009-07-08 00:46
Quote:
Originally Posted by WarTurkey View Post
Well, I guess I'm the lone soul who this doesn't work even the first time. I don't get any errors upon entering the commands, but when I test my Xbox Live connection, it says there were errors and that it could not reach the xbox live servers or Xbox.com. When I set the DNS to manual and to the address of the laptop (192.168.2.1, like in the tutorial) it hangs for a while and then gives a different error.

Would be great if I could get this to work! Any idea of how to fix it would be nice!
Oops! I was lazy, and I didn't read to set the IP to the ROUTER, and not just the LAPTOP! Very sorry!

by takeitslow on Fri, 2010-06-25 15:31
I've successfully connected my Xbox 360 to the internet, but then it says that it does not recognise the port for xbox and xbox live. I think this has to do with the port-forwarding seigex talked about, but I am unsure what to type for $IPTABLES and $WAN_IF when he says to replace the variables. Help would be nice.


  



All times are GMT -5. The time now is 01:01 PM.

Main Menu
Advertisement

My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration