Set up an ubuntu computer to be a wireless router
Needed: computer running ubuntu with a wireless card and an ethernet port.
This tutorial covers how to set up the madwifi drivers, so if your wireless card isn't supported by those drivers you'll have to look elsewhere to figure out how/if you can get it into master mode.
sudo apt-get install dhcp3-server
sudo vim /etc/dhcp3/dhcpd.conf
Go through all the settings. In particular, it's important to set the name server settings from what you've got it /etc/resolv.conf and add a declaration of your network like this one:
subnet 10.1.1.0 netmask 255.255.255.0 {
range 10.1.1.20 10.1.1.255;
option routers 10.1.1.1;
}
https://help.ubuntu.com/community/Router/Madwifi says:
sudo apt-get install linux-restricted-modules madwifi-tools
and add options ath_pci autocreate=ap to /etc/modprobe.d/madwifi
edit /etc/network/interfaces to look like this (be sure to replace eth0 with your ethernet card name and ath0 with your wireless card name. Do ifconfig -a to get a list of valid names)
auto lo iface lo inet loopback # ethernet cable to modem auto eth0 iface eth0 inet dhcp pre-up iptables-restore < /etc/iptables.conf # wireless card (atheros chip) as wireless access point auto ath0 iface ath0 inet static address 10.1.1.1 netmask 255.255.255.0 wireless-mode master wireless-essid 17Fayette
Create /etc/iptables.conf containing this (as above, replace network device names)
# Generated by iptables-save v1.3.8 on Thu Sep 4 18:35:01 2008 *nat :PREROUTING ACCEPT [0:0] :POSTROUTING ACCEPT [0:0] :OUTPUT ACCEPT [0:0] -A POSTROUTING -s 10.1.1.0/255.255.255.0 -o eth0 -j MASQUERADE COMMIT # Completed on Thu Sep 4 18:35:01 2008 # Generated by iptables-save v1.3.8 on Thu Sep 4 18:35:01 2008 *filter :INPUT ACCEPT [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [0:0] -A FORWARD -s 10.1.1.0/255.255.255.0 -o eth0 -j ACCEPT -A FORWARD -d 10.1.1.0/255.255.255.0 -i eth0 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT COMMIT # Completed on Thu Sep 4 18:35:01 2008
enable forwarding: sudo bash -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
To be sure that forwarding stays on after reboots and power outages, so you probably want to also put that line in your /etc/rc.local
sudo /etc/init.d/networking restart
If your DNS servers change ever, or if you want to do fun things with dns, you might look into dnsmasq and/or djb's tinydns.
If you have questions you can contact Jason Woofenden