Laptop to an AP

So, the other day I was at a location that has a wired internet connection but no wireless and no switch. I didn’t have switch and wireless with me and so, I decided to take on the task of making my laptop a wireless access point with WPA2 security. The guide that I followed the most is here, and much thanks to the author, although I did find that I had to do more to get it to work than the guide provided.

Very first you will need to have installed the following packages:

wireless-tools
iw
linux kernel 2.6.30 or later (I am using 2.6.31-21 ubuntu generic)
hostapd
dhcp-server

My hardware: Macbook Pro 3,1 running Ubuntu Linux (9.10 Karmic). This laptop has a wireless card that uses the atheros ath9k driver.

The rest of this article assumes that you already have a good working WIFI card, my point is not to troubleshoot why your wifi card doesn’t work. Also I assume that you know how to set up a DHCP server, know how to edit files, etc.

First, after making sure that my wireless card would even do it I set the static IP on my wirless card.

ifconfig wlan0 192.168.10.1 netmask 255.255.255.0

Next, I set up DHCP on the wireless interface only with my dhcpd.conf looking like this.

subnet 192.168.10.0 netmask 255.255.255.0 {
range 192.168.10.10 192.168.10.49;
option routers 192.168.10.1;
option ip-forwarding off;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.10.255;
option domain-name-servers 4.2.2.2, 4.2.2.1;
}
Then I set up my hastapd.conf file thusly.
interface=wlan0
driver=nl80211
ssid=YourSSID
channel=6
hw_mode=g
auth_algs=1
wpa=3
wpa_passphrase=12345678 (Change this, obviously)
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP CCMP
rsn_pairwise=CCMP
Lastly, run the thing.
#hostapd -d hostapd.conf
Some other caveats. I did have to change some iptables stuff to allow routing through the eth0 interface and allow access to the DHCP server through port 67. My rule set looked like this:
-A POSTROUTING -o eth0 -j MASQUERADE
-A INPUT -p tcp -m tcp –dport 67 -j ACCEPT
-A INPUT -p udp -m udp –dport 67 -j ACCEPT
-A FORWARD -i wlan0 -j ACCEPT
Otherwise, that was all there really was to it. My brother-in-law could connect to the web through my laptop and I could use it with the wired. The world was right as rain.

Tags: ,

2 Responses to “Laptop to an AP”

  1. Marty Says:

    Don’t you have one of them fancy smart phones that can act as a modem for you? I was thinking that all of the 3G phones could do that…

  2. Will Says:

    While my 3G Smartphone can act as a wireless hotspot not all of them can. In fact, most can not. With that said, at the time that I was doing this in Alaska I had data roaming turned off and so I could not get a data connection at all.

    Even with all this, there may be a time when someone would want to have a impromptu wireless hotspot.

Leave a Reply