_$: apt-get install wireless-tools
_$: apt-get install hostapd
_$: apt-get install bridge-utils

Check compatibility with Ubuntu

If you are planning to add a wireless card to your server, first check that it is supported. In this case we will add an Edimax EW-7612PIN V2 300Mbps 11n Wireless PCI Express to our server.

To check that it is, indeed, compatible, go to and you will find a list of links to the manufacturers. In our case, we will go to and see that it works out of the box and that it has been tested at least in Ubuntu 10.10 (x86).

Install drivers

_$: apt-get install build-essentials
_$: apt-get install linux-headers-`uname -r`
_$: mkdir wireless && cd wireless

Now we have two options, first one is to use the Edimax’s driver, wich is deprecated. You can read how that would be done, but we will go with the second option: use the Realtek’s driver.

Download the driver from

_$: wget
_$: unzip
_$: mv 7612_Linux_\ Driver/ 7612_Linux_Driver
_$: cd 7612_Linux_Driver
_$: make
_$: lspci | grep -i wifi
05:00.0 Network controller: Realtek Semiconductor Co., Ltd. RTL8188CE 802.11b/g/n WiFi Adapter (rev 01)

So the chip is RTL8188CE.

Download the driver from

_$: tar xvfj linux_mac80211_0012.0207.2013.tar.bz2
_$: cd rtl_92ce_92se_92de_8723ae_88ee_linux_mac80211_0012.0207.2013
_$: vi pci.h

Now we have to modify one of the source files before compiling the driver:

 * Copyright(c) 2009-2010  Realtek Corporation.
 * ...
 * Larry Finger <>

#ifndef __devinit       <=== Comment this line
#define __devinit       <===  "       "    "
#define __devinitdata   <===  "       "    "
#endif                  <===  "       "    "

#ifndef __RTL_PCI_H__
#define __RTL_PCI_H__

Once you have done this, compile it and reboot.

_$: make
_$: make install

_$: reboot

_$: lsmod | grep rtl
rtl8192ce             141806  0
rtlwifi               123323  1 rtl8192ce
mac80211              630977  2 rtl8192ce,rtlwifi
cfg80211              525244  2 rtlwifi,mac80211

After the reboot the wireless module has been loaded.


These are the configuration files you need to modify for your wireless network to work. If you have your smartphone near you, you can use it to see if it finds the network once it is configured.

# Defaults for hostapd initscript
# See /usr/share/doc/hostapd/README.Debian for information about alternative
# methods of managing hostapd.
# Uncomment and set DAEMON_CONF to the absolute path of a hostapd configuration
# file and hostapd will be started during system boot. An example configuration
# file can be found at /usr/share/doc/hostapd/examples/hostapd.conf.gz

# Additional daemon options to be appended to hostapd command:-
#   -d   show more debug messages (-dd for even more)
#   -K   include key data in debug messages
#   -t   include timestamps in some debug messages
# Note that -B (daemon mode) and -P (pidfile) options are automatically
# configured by the init.d script and must not be added to DAEMON_OPTS.
# Wireless interface

# Driver

# Country


# Operation mode

# Channel number

# WPA mode

# Password

# Key management algorithms

# Cipher suites (encryption algorithms)
# TKIP = Temporal Key Integrity Protocol
# CCMP = AES in Counter mode with CBC-MAC

# Shared Key Authentication

# Accept all MAC address

We will now configure the server to use IP addresses in the network for the wireless devices. The IP addresses for the hosts in the Local Area Network will be in the network. The server’s IP address for both networks will be in the 192.168.X.101 form.

This is the network scheme:

         +-----------------+             +---------------+
         |                 |             |               |
WiFi --- wlan0  Server  eth0 --- LAN --- eth0 Gateway eth1 --- Internet
         |                 |             |               |
         +-----------------+             +---------------+

The wireless server is also acting as a DNS server for all the hosts in the Local Area Network. That is the reason for the dns-nameservers setting to be the loopback address when configuring the eth0 interface.

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
	post-up   /sbin/ethtool -s eth0 wol g
	post-down /sbin/ethtool -s eth0 wol g

# The wireless interface.
auto wlan0
iface wlan0 inet static


All of the communications that this server receives through wlan0 will be transmitted through eth0 to the gateway of the Local Area Network pretending to come from the server. That way we provide the wireless devices with internet access.

:OUTPUT ACCEPT      [0:0]
_$: iptables-restore < /etc/iptables.up.rules


It is time to chek how routes have been set up:

_$: route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface         UG    100    0        0 eth0     U     1000   0        0 eth0   U     0      0        0 eth0   U     0      0        0 wlan0

If we had some other devices, like printers, in the network and we wanted to make them visible for the wireless devices, we should add them:

_$: route add -net netmask dev eth0

_$: route -n
route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface         UG    100    0        0 eth0     U     1000   0        0 eth0   U     0      0        0 eth0   U     0      0        0 wlan0   U     0      0        0 eth0

See connected devices

We can see at any given time which wireless devices are connected with this command:

_$: iw dev wlan0 station dump | grep 'Station'