How to turn my Linux netbook into WiFi AP

I'm trying find out how to make a linux (Fuduntu) netbook with two network interfaces a wireless access point and act as router and share internet connection for a WiFi tablet.

  • one interface is connected to inet, eth0 (wired),
  • other eth1 is WiFi

So the question is some sort of tethering


It is easy to turn an old notebook into a wireless AP. I don't know Fuduntu. I use Debian, therefore the following instructions are Debian centric but can easily be adapted to other distributions as well. What differs are the package names and the location of the configuration files.

Required software

The following packages are needed:

  • hostap
  • wpasupplicant
  • bridge-utils
  • wireless-tools

Configuration

In the following it is assumed that your wireless connection is wlan0 and your wired one eth0, you need to adapt it to your setup.

First you need to set up the bridge. Remove or comment out any entries that set up wlan0 or eth0 in the file /etc/network/interfaces and add the following lines.

Setting up the bridge

auto br0
iface br0 inet dhcp
  bridge_ports eth0 wlan0
  pre-up ifconfig eth0 0.0.0.0 up
  pre-up ifconfig wlan0 0.0.0.0 up
  pre-up brctl addbr br0
  pre-up brctl addif br0 eth0
  post-down ifconfig wlan0 0.0.0.0 down
  post-down ifconfig eth0 0.0.0.0 down
  post-down brctl delif br0 eth0
  post-down brctl delbr br0

Setting up hostapd

Tell the hostapd daemon to use a particular configuration file: Ensure the following line is present in /etc/default/hostapd

DAEMON_CONF=/etc/hostapd/hostapd.conf

Now you can set up your wireless network. Here I just provide an example configuration. The exact values depend on your hardware, which encryption is supported and your environment (e.g. surrounding networks). Open the file /etc/hostapd/hostapd.conf and ensure the following values are set.

interface=wlan0
bridge=br0
driver=nl80211
ssid=MyNetwork
hw_mode=g
channel=9
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=myverysecretpassword
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

Important here is to select a driver that works with hostapd and your hardware. The SSID is a random string to identify your network. The channel should be picked, so that there is the least interference with the surrounding networks. The passphrase should be at least eight characters long.

For the other options read the provided configuration file. It is heavily commented and almost serves as a manual.

Starting the access point

Now you can bring up the interfaces

/etc/init.d/networking restart

and start the access point

/etc/init.d/hostapd start

Another possible solution

The FreeBSD distribution pfSense is a firewalling and routing platform with AP functionality. Everything can be set up nicely using a GUI. Behind the scenes it also uses hostap, but the configuration is simpler and more user friendly. The drawback of using pfSense is that you should not do your regular computing on the same box, pfSense expects to be running on a dedicated system, although this is not a technical requirement.


If it's for your one and only tablet, an adhoc connection would be enough. You can use iptables to forward the traffic.

For other purposes, check if hostap works with your adapter, then you have a real access point for multiple users (use iptables for forwarding too here).