Ubuntu 11.04 as Wifi Router

Step 1

Install Ubuntu 11.04 Server Edition on your netbook/old pc/thin client etc.. with default settings.
In my case I am using a thinclient (eth0 = wired ethernet adapter; wlan0 = wireless adapter).

Step 2

sudo apt-get install isc-dhcp-server hostapd

Step 3

sudo pico /etc/hostapd/hostapd.conf

	interface=wlan0
	driver=nl80211
	ssid=UbuntuAP
	hw_mode=g
	channel=11
	wpa=1
	wpa_passphrase=UbuntuAPPassPhrase
	wpa_key_mgmt=WPA-PSK
	wpa_pairwise=TKIP CCMP
	wpa_ptk_rekey=600

Step 4

sudo pico /etc/dhcp/dhcpd.conf

default-lease-time 600;
max-lease-time 7200;
option subnet-mask 255.255.255.0;
option broadcast-address 10.20.30.255;
option domain-name "mydomain.example";
subnet 10.20.30.0 netmask 255.255.255.0 {
        range 10.20.30.10 10.20.30.50;
        option domain-name-servers 8.8.4.4, 208.67.222.222;
        option routers 10.20.30.254;
}

Step 5

sudo pico /etc/default/isc-dhcp-server

	INTERFACES="wlan0"

Step 6

Enable IP Routing and save the IPtable rules.

	sudo bash
	echo "1" > /proc/sys/net/ipv4/ip_forward
	iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
	iptables-save > /etc/iptables.rules

Step 7

Assign static IP to Wireless adapter and auto load IPtable rules
sudo pico /etc/network/interfaces

auto wlan0
iface wlan0 inet static
 address 10.20.30.254
 netmask 255.255.255.0
pre-up iptables-restore < /etc/iptables.rules

Step 8

Auto start DHCP Server and hostapd (AccessPoint)
sudo pico /etc/rc.local

service isc-dhcp-server start
hostapd -dd /etc/hostapd/hostapd.conf

Reference

  • https://exain.wordpress.com/tag/rt2800usb/
  • https://help.ubuntu.com/community/IptablesHowTo

Leave a comment

Your email address will not be published. Required fields are marked *

WordPress Appliance - Powered by TurnKey Linux