Linux server as a wireless bridge
Since learning the XBox 360 doesn’t come with a wifi adapter, and that buying such a thing would add another 60 pounds to the cost of the console… I’ve been thinking of different ways to get an Internet connection from my high-speed wired network in the living room out to the router way out in the spare room. For many reasons, it’s just not practical for me to wire the whole flat.
Most of the solutions I came up with involved things like ‘spending money’, which I’m slightly adverse to do if I can do it with the existing kit, so these are the really basic steps to turn the existing linux box (with both wireless and wired cards) into a useful bridge. As usual, don’t be fooled into thinking this guide is here for anyone else, as much as it’s here for me when I need to rebuild the machine and I’ve forgotten it all. But feel free to leave a comment about how much warmer and fuzzier I’ve made your life through your use of these “instructions”.
The current configuration
Fedora 8 installation
Wireless Ethernet (ath0) card is connected as 192.168.0.8
Wired Ethernet (eth1) card is connected as 192.168.1.8
Named/bind/DNS server already configured and set-up to accept requests on 192.168.1.8
The Xbox will be wired, on 192.168.1.20
Setting up Fedora
Setup the forwarding rules
#Outgoing requests
iptables -t nat -A POSTROUTING -s 192.168.1.8/24 -o ath0 -j MASQUERADE
iptables -A FORWARD -s 192.168.1.0/24 -o ath0 -j ACCEPT
iptables -A FORWARD -d 192.168.1.0/24 -m state --state ESTABLISHED,RELATED -i eth1 -j ACCEPT
#Incoming requests (port forwarding)
iptables -t nat -A PREROUTING -p tcp -i ath0 -d 192.168.0.8 --dport 88 -j DNAT --to 192.168.1.20:88
iptables -t nat -A PREROUTING -p tcp -i ath0 -d 192.168.0.8 --dport 3074 -j DNAT --to 192.168.1.20:3074
Save your rules so they’re applied on start-up
sudo iptables-save > /etc/sysconfig/iptables
Enable ipv4 port forwarding
nano /etc/sysctl.conf
Change this line
net.ipv4.ip_forward = 0
to
net.ipv4.ip_forward = 1
The client machine / Xbox 360
Now on your client machine (note this will only have a wired connection).
IP Address: 192.168.1.20
Subnet mask: 255.255.255.0
Default Gateway: 192.168.1.8
DNS Server: 192.168.1.8
You’re going to need a DHCP server so that these settings are automatically assigned to the XBox 360. If don’t have one for your subnet already, you can set it up through dhcpd. You’ll probably want to do something about
Edit /etc/dhcpd.conf
ddns-update-style interim;
# HardWired
subnet 192.168.1.0 netmask 255.255.255.0 {
option routers 192.168.1.8;
option domain-name-servers 192.168.1.8;
authoritative;
range 192.168.1.10 192.168.1.20;
}
# Assign a static IP
host xbox {
hardware ethernet 00:45:40:10:FE:12;
fixed-address 192.168.1.20;
}
Then restart dhcpd
/etc/rc.d/init.d/dhcpd restart
Router
Remember those ports we forwarded on the server? You’ll also need to add port forwarding to your router, to forward the same ports (88, 3074) to the Fedora machine on 192.168.0.8.
And that’s really it. You should now be able to connect to the Internet without any troubles.
can also use the ‘brctl’ command in linux to create a bridge between each of the interfaces… might also be worth looking into