Wireless Access Point

Hardkernel offers a few USB based WiFi modules to enable WiFi connectivity for their Single Board Computers (SBCs). Some of them can also be used to deploy these SBCs as Access Points. The various modules offered can be found at https://www.hardkernel.com/product-category/connectivity/.

Wireless Controller Information

The capability list of these modules can be obtained using the following command:

$ sudo iw list 
...
Supported interface modes:
               * IBSS
               * managed
               * AP
               * AP/VLAN
               * WDS
               * monitor
               * mesh point
...
If there is the “AP” capability listed in the “Supported interface modes”, then that device will support the Access Point mode. Below are the details of all the modules offered by Hardkernel:
Wifi Module 0
Manufacturer: Mediatek Ralink
Part name: RT5370N
Type: chip
Number of busses: 1
Bus(es): USB 2.0
Number of bands: 1
Band(s): 2.4GHz
Data rate: 150Mbps
MIMO configuration: 1x1:1 (1T1R)
IEEE 802.11 PHY Modes: b,g,n
 
Bus 005 Device 002: ID 148F:5370 Ralink Technology, RT5370 Wireless Adapter

Wifi Module 3
Manufacturer: Realtek
Part name: RTL8188CUS
Type: chip
Number of busses: 1
Bus(es): USB 2.0
Number of bands: 1
Band(s): 2.4GHz
Data rate: 150Mbps
MIMO configuration: 1x1:1 (1T1R)
IEEE 802.11 PHY Modes: b,g,n
 
Bus 001 Device 003: ID 0bda:8176 Realtek Semiconductor Corp. RTL8188CUS 802.11n WLAN Adapter

Wifi Module 4
Manufacturer: Ralink
Part name: RT5572N
Type: chip
Number of busses: 1
Bus(es): USB 2.0
Number of bands: 2
Band(s): 2.4GHz, 5GHz
Data rate: 300Mbps
MIMO configuration: 2x2:2 (2T2R)
IEEE 802.11 PHY Modes: a,b,g,n
 
Bus 001 Device 006: ID 148f:5572 Ralink Technology, Corp. RT5572 Wireless Adapter

Wifi Module 5
Manufacturer: Realtek
Type: chip
Number of busses: 2
Bus(es): USB 2.0 / USB 3.0
Number of bands: 2
Band(s): 2.4GHz, 5GHz
Data rate: 300Mbps
MIMO configuration: 2x2:2 (2T2R)
IEEE 802.11 PHY Modes: a,b,g,n,ac
 
Bus 003: ID 0bda:8812 Realtek Semiconductor Corp. RTL8812AU 802.11a/b/g/n/ac WLAN Adapter

Wifi Module 5A
Manufacturer: Realtek
Type: chip
Number of busses: 1
Bus(es): USB 2.0
Number of bands: 2
Band(s): 2.4GHz, 5GHz
Data rate: AC600
MIMO configuration: 433 Mbps @ 5 GHz @ 1T1R / 150 Mbps @ 2.4 GHz @ 1T1R
IEEE 802.11 PHY Modes: a,b,g,n,ac
 
Bus 003 Device 003: ID 0bda:a811 Realtek Semiconductor Corp.

Configure Access Point

  • One forum member (@tam1111574) reported there is an issue with USB 3.0 port on the XU4 at http://forum.odroid.com/viewtopic.php?f=97&t=19285
  • All commands must be executed in super user mode
  • You should run apt update && apt full-upgrade before proceeding
  • In addition, you may need to run apt install libnl-3-dev libnl-genl-3-dev libssl-dev hostapd iptables git pkg-config vim build-essential

We will need to configure the wireless network interface and dnsmasq daemon. The access point configuration can be divided into the following tasks:

  • Setup network interface configuration
  • Setup DHCP server configuration
  • Setup iptables to forward the internet traffic from Ethernet to wireless lan.
  • Setup hostapd server or wpa_supplicant configuration.
  • Check service & WIFI configuration

Setup network interface configuration.

In order to configure the Wireless Access Point, you need to provide a static IP address for the Wireless network card. Check the wlan0 part of the following contents:

# vi /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d
 
auto lo
iface lo inet loopback
 
auto eth0
iface eth0 inet dhcp
 
auto wlan0
iface wlan0 inet static
      address 192.168.1.1
      netmask 255.255.255.0
Note that the predictable interface names shown as starts with wlan if you have an interface name.

If your wireless interface name is as shown below, add net.ifnames=0 as kernel parameter to kernel command line by editing the boot.ini:

# ifconfig
enx7cdd9052131e Link encap:Ethernet  HWaddr 7c:dd:90:52:13:1e
       UP BROADCAST MULTICAST  MTU:1500  Metric:1
       RX packets:0 errors:0 dropped:321 overruns:0 frame:0
       TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
       collisions:0 txqueuelen:1000
       RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
The local interface name issue gets resolved to have predictable name for wireless interface.
# ifconfig
wlan0   Link encap:Ethernet  HWaddr 7c:dd:90:52:13:1e
       UP BROADCAST MULTICAST  MTU:1500  Metric:1
       RX packets:0 errors:0 dropped:10 overruns:0 frame:0
       TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
       collisions:0 txqueuelen:1000
       RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
Note: The wlan0 IP address might be different from yours. Wireless interface name can be changed as it depends on the wireless cards you installed.

Setup DHCP server configuration for Access Point

Configure dnsmasq which is a lightweight DHCP and DNS server.

# apt install dnsmasq
Reading package lists... Done
Building dependency tree     
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded.
Need to get 16.2 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://ports.ubuntu.com/ubuntu-ports bionic/universe armhf dnsmasq all 2.79-1 [16.2 kB]
Fetched 16.2 kB in 1s (16.6 kB/s)
(Reading database ... 155718 files and directories currently installed.)
Preparing to unpack .../dnsmasq_2.79-1_all.deb ...
Unpacking dnsmasq (2.79-1) over (2.79-1) ...
Setting up dnsmasq (2.79-1) ...
Processing triggers for systemd (237-3ubuntu10.9) ...
If you faced “FAILED” message when starting up the dnsmasq.service like the below “port 53: Address already in use”, then perform the following:
... invoke-rc.d: initscript dnsmasq, action "start" failed...
  dnsmasq.service - dnsmasq - A lightweight DHCP and caching DNS server
  Loaded: loaded (/lib/systemd/system/dnsmasq.service; enabled; 
 vendor preset: enabled)
 Active: failed (Result: exit-code) since Mon 2018-12-10 01:59:06 UTC; 
 22ms ago
 Process: 2073 ExecStart=/etc/init.d/dnsmasq systemd-exec 
 (code=exited, status=2)
  Process: 2072 ExecStartPre=/usr/sbin/dnsmasq --test (code=exited, 
 status=0/SUCCESS)
  Dec 10 01:59:06 odroid systemd[1]: Starting dnsmasq - A lightweight 
 DHCP and caching DNS server...
  Dec 10 01:59:06 odroid dnsmasq[2072]: dnsmasq: syntax check OK.
  Dec 10 01:59:06 odroid dnsmasq[2073]: dnsmasq: failed to create 
 listening socket for port 53: Address already in use
  Dec 10 01:59:06 odroid dnsmasq[2073]: failed to create listening 
 socket for port 53: Address already in use
  Dec 10 01:59:06 odroid dnsmasq[2073]: FAILED to start up
  Dec 10 01:59:06 odroid systemd[1]: dnsmasq.service: Control process 
 exited, code=exited status=2
  Dec 10 01:59:06 odroid systemd[1]: dnsmasq.service: Failed with 
 result 'exit-code'.
  Dec 10 01:59:06 odroid systemd[1]: Failed to start dnsmasq - A 
 lightweight DHCP and caching DNS server.
 Processing triggers for systemd (237-3ubuntu10.9) ...
Stop the service that was listening on port 53:
# Check that systemd-resolve service is listening port 53 
  now(127.0.0.53:53)
# netstat -alnp | grep -w LISTEN
tcp    0   0 127.0.0.53:53   0.0.0.0:*   LISTEN    755/systemd-resolve
tcp    0   0 0.0.0.0:22      0.0.0.0:*   LISTEN    916/sshd          
tcp    0   0 127.0.0.1:631   0.0.0.0:*   LISTEN    2616/cupsd        
tcp6   0   0 :::22           :::*        LISTEN    916/sshd          
tcp6   0   0 ::1:631         :::*        LISTEN    2616/cupsd       

# To use the 53 port, disable & stop the systemd-resolved service
# systemctl disable systemd-resolved.service
Removed /etc/systemd/system/multi-user.target.wants/systemd-resolved.service.
Removed /etc/systemd/system/dbus-org.freedesktop.resolve1.service.
# systemctl stop systemd-resolved

# dnsmasq service enable & start
# systemctl enable dnsmasq
Synchronizing state of dnsmasq.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable dnsmasq

# systemctl start dnsmasq
# confirm dnsmasq service running
# netstat -alnp | grep -w LISTEN

tcp6   0   0 ::1:631         :::*        LISTEN    2616/cupsd  

tcp    0   0 0.0.0.0:53      0.0.0.0:*   LISTEN    6100/dnsmasq      
tcp    0   0 0.0.0.0:22      0.0.0.0:*   LISTEN    677/sshd            
tcp    0   0 127.0.0.1:631   0.0.0.0:*   LISTEN    2734/cupsd        
tcp6   0   0 :::53           :::*        LISTEN    6100/dnsmasq      
tcp6   0   0 :::22           :::*        LISTEN    677/sshd          
tcp6   0   0 ::1:631         :::*        LISTEN    2734/cupsd
Copy dnsmasq configuration file to get a backup and then make a new one.
# mv /etc/dnsmasq.conf /etc/dnsmasq.conf.org
# vi /etc/dnsmasq.conf
The dnsmasq.conf contents are like so:
domain-needed
bogus-priv
no-resolv
no-poll
server=/example.com/192.168.1.5
server=8.8.8.8
server=8.8.4.4
local=/example.com/
address=/doubleclick.net/127.0.0.1
no-hosts
#addn-hosts=/etc/dnsmasq.d/hosts.conf
expand-hosts
domain=example.com
dhcp-range=192.168.1.20,192.168.1.50,72h
dhcp-range=tftp,192.168.1.250,192.168.1.254
dhcp-option=option:router,192.168.1.1
dhcp-option=option:ntp-server,192.168.1.5
dhcp-option=19,0 # ip-forwarding off
dhcp-option=44,192.168.1.5 # set netbios-over-TCP/IP aka WINS
dhcp-option=45,192.168.1.5 # netbios datagram distribution server
dhcp-option=46,8         # netbios node type
Note that you can extend the dhcp-range or change the IP address in the configuration.

Setup iptables to forward the internet traffic from Ethernet to wireless LAN

Next, make port forwarding enabled automatically on boot up:

# vi /etc/sysctl.conf
Find the options below and change them:
net.ipv4.ip_forward=1
net.ipv6.conf.all.forwarding=1
Add the following contents to /etc/rc.local file in order to redirect internet traffic to wireless LAN:
# vi /etc/rc.local
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
sudo iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT
You will need to update the iptables rules depending on your wireless network interface. Reboot the system to get it to work:
# reboot

Access Point Installation – hostapd

hostapd is a user space daemon for access point and authentication servers. It implements IEEE 802.11 access point management, IEEE 802.1X/WPA/WPA2/EAP Authenticators, RADIUS client, EAP server, and RADIUS authentication server. Please find more information at https://wireless.wiki.kernel.org/en/users/documentation/hostapd.

Below are the ssteps to get the hostapd compilation. Download the hostapd source code and build with proper parameters:

Wifi Module 0, 4, 5, 5A
# wget https://w1.fi/releases/hostapd-2.6.tar.gz
# tar xvfz hostapd-2.6.tar.gz
# cd hostapd-2.6/hostapd
/hostapd-2.6/hostapd# cp defconfig .config
/hostapd-2.6/hostapd# echo CONFIG_LIBNL32=y >> .config
/hostapd-2.6/hostapd# echo CONFIG_IEEE80211N=y >> .config
/hostapd-2.6/hostapd# echo CONFIG_IEEE80211AC=y >> .config
/hostapd-2.6/hostapd# make
You should download a patch file if you use Wifi Module 3 to make hostapd work for Wifi Module 3 which does not support the standard nl80211 driver from hostapd on kernel 3.10, 3.14, 3.16.
Wifi Module 3
# git clone https://github.com/pritambaral/hostapd-rtl871xdrv.git
# wget https://w1.fi/releases/hostapd-2.6.tar.gz
# tar xvfz hostapd-2.6.tar.gz
# cd hostapd-2.6
/hostapd-2.6# patch -p1 < ../hostapd-rtl871xdrv/rtlxdrv.patch /hostapd-2.6# cd hostapd /hostapd-2.6/hostapd# cp defconfig .config /hostapd-2.6/hostapd# echo CONFIG_LIBNL32=y >> .config
/hostapd-2.6/hostapd# echo CONFIG_DRIVER_RTW=y >> .config
/hostapd-2.6/hostapd# make
Backup the current hostapd and replace the file with the configured one:
/hostapd-2.6/hostapd# mv /usr/sbin/hostapd /usr/sbin/hostapd.org
/hostapd-2.6/hostapd# cp hostapd /usr/sbin/
Verify that you have installed the latest version:
/hostapd-2.6/hostpad# cd ~
# hostapd
 
hostapd v2.6
User space daemon for IEEE 802.11 AP management,
IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator
Copyright (c) 2002-2016, Jouni Malinen <j@w1.fi> and contributors
Configure hostapd for Access Point use:
# vi /etc/default/hostapd
Find the options below and edit:
DAEMON_CONF="/etc/hostapd/hostapd.conf"
DAEMON_OPTS="-B"
You can update this DAEMON_OPTS to get the logs from hostapd daemon by editing the /etc/hostapd/hostapd.conf file:
# vi /etc/hostapd/hostapd.conf

The contents of the hostapd.conf files for 2.4 GHz configuration is as follows:
# HostAPD <2.4 Ghz configuration hostapd.conf file>
# Interface
interface=wlan0
# driver
driver=nl80211
# Logging
logger_syslog=-1
logger_syslog_level=3
logger_stdout=-1
logger_stdout_level=2
# CTRL-Interface
ctrl_interface=/var/run/hostapd
ctrl_interface_group=0
# WLAN
country_code=KR
ssid=OdroidAPn
hw_mode=g
channel=6
beacon_int=100
dtim_period=2
max_num_sta=255
rts_threshold=2347
fragm_threshold=2346
preamble=1
# WPA2
wpa=2                          # WPA2 only
wpa_passphrase=hardkernel
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
auth_algs=3                    # 1=wpa, 2=wep, 3=both
macaddr_acl=0
wmm_enabled=1
eap_reauth_period=360000
fragm_threshold=2346
rsn_preauth=1
rsn_preauth_interfaces=wlan0
wpa_group_rekey=600
wpa_ptk_rekey=600
wpa_gmk_rekey=86400
# N-WLAN
ieee80211n=1
ht_capab=[HT20+][SHORT-GI-20][DSSS_CCK-20]
require_ht=0
obss_interval=0
The contents of the hostapd.conf files for 2.4GHz configuration for WiFi Module 3 is as follows:
# interface
interface=wlan0
# driver
driver=rtl871xdrv
# CTRL-Interface
ctrl_interface=/var/run/hostapd
ctrl_interface_group=0
# SSID
ssid=OdroidAP
# WLAN
country_code=KR
hw_mode=g
channel=1
beacon_int=100
dtim_period=2
max_num_sta=255
rts_threshold=2347
fragm_threshold=2346
preamble=1
# Logging
logger_syslog=-1
logger_syslog_level=3
logger_stdout=-1
logger_stdout_level=2
# passphrase
wpa_passphrase=hardkernel
# WPA2
wpa=3
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
beacon_int=100
auth_algs=3                   # 1=wpa, 2=wep, 3=both
macaddr_acl=0
wmm_enabled=1
eap_reauth_period=360000000
rsn_preauth=1
rsn_preauth_interfaces=wlan0
wpa_group_rekey=600
wpa_ptk_rekey=600
wpa_gmk_rekey=86400
The contents of the hostapd.conf files for 5 GHz Realtek RTL8812AU chipset is as follows:
# HostAPD <5.0 Ghz configuration hostapd.conf file>
ctrl_interface=/var/run/hostapd
ctrl_interface_group=0
interface=wlan0
driver=nl80211
### IEEE 802.11
ssid=Odroid5Ghz
hw_mode=a
channel=36
max_num_sta=128
auth_algs=1
### DFS
country_code=KR
ieee80211d=1
ieee80211h=1
#ieee80211ac=1
### IEEE 802.11n
ieee80211n=1
ht_capab=[HT40+][SHORT-GI-20][SHORT-GI-40][DSSS_CCK-20]
### IEEE 802.11ac
#ieee80211ac=1
#vht_oper_chwidth=1
#vht_capab=[SHORT-GI-40][RXLDPC][TX-STBC-2BY1]
#vht_oper_centr_freq_seg0_idx=0
### IEEE 802.11i
wpa=2
wpa_key_mgmt=WPA-PSK
wpa_passphrase=hardkernel
rsn_pairwise=CCMP
### hostapd event logger
logger_syslog=-1
logger_syslog_level=2
logger_stdout=-1
logger_stdout_level=2
### WMM
wmm_enabled=1
uapsd_advertisement_enabled=1
wmm_ac_bk_cwmin=4
wmm_ac_bk_cwmax=10
wmm_ac_bk_aifs=7
wmm_ac_bk_txop_limit=0
wmm_ac_bk_acm=0
wmm_ac_be_aifs=3
wmm_ac_be_cwmin=4
wmm_ac_be_cwmax=10
wmm_ac_be_txop_limit=0
wmm_ac_be_acm=0
wmm_ac_vi_aifs=2
wmm_ac_vi_cwmin=3
wmm_ac_vi_cwmax=4
wmm_ac_vi_txop_limit=94
wmm_ac_vi_acm=0
wmm_ac_vo_aifs=2
wmm_ac_vo_cwmin=2
wmm_ac_vo_cwmax=3
wmm_ac_vo_txop_limit=47
wmm_ac_vo_acm=0
### TX queue parameters
tx_queue_data3_aifs=7
tx_queue_data3_cwmin=15
tx_queue_data3_cwmax=1023
tx_queue_data3_burst=0
tx_queue_data2_aifs=3
tx_queue_data2_cwmin=15
tx_queue_data2_cwmax=63
tx_queue_data2_burst=0
tx_queue_data1_aifs=1
tx_queue_data1_cwmin=7
tx_queue_data1_cwmax=15
tx_queue_data1_burst=3.0
tx_queue_data0_aifs=1
tx_queue_data0_cwmin=3
tx_queue_data0_cwmax=7
tx_queue_data0_burst=1.5
On the Wifi module 4 and Wifi module 5, Wifi module 5A, we need to tune these setting depending on the ht_capab. Replace the country_code, ssid, and wpa_passphrase as per your requirement. N-WLAN is optional and can be left out.

Check your hostpad & dnsmasq service status

The WiFi IP address must be the same of the set for /etc/network/interfaces. You have to allocate specific IP address you set into the /etc/network/interfaces file as a static method to wlan0 interface.

# Force allocation of IP address
# ifconfig wlan0 192.168.1.1
 
# Check IP address
# ifconfig wlan0
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
      inet 192.168.1.1  netmask 255.255.255.0  broadcast 192.168.1.255
      ether 40:a5:ef:f3:98:6a  txqueuelen 1000  (Ethernet)
      RX packets 122  bytes 13344 (13.3 KB)
      RX errors 0  dropped 1  overruns 0  frame 0
      TX packets 49  bytes 18722 (18.7 KB)
      TX errors 0  dropped 473 overruns 0  carrier 0  collisions 0
After you finish all of the setup steps, restart the services and check their statuses. Enter the following code to enable by default:
# update-rc.d hostapd enable
Restart the services:
# service hostapd restart
# service dnsmasq restart
If you get this message when starting hostapd service, “Failed to start hostapd.service: Unit hostapd.service is masked.”, unmask that service and try it again:

systemctl unmask hostapd.service
Check the services:
# service hostapd status
# service dnsmasq status
Check the active (running) status:
# hostapd
hostapd.service - LSB: Advanced IEEE 802.11 management daemon
   Loaded: loaded (/etc/init.d/hostapd; bad; vendor preset: enabled)
   Active: active (running) since Sun 2017-07-09 19:48:41 UTC; 31s ago
   Docs: man:systemd-sysv-generator(8)
  Process: 789 ExecStart=/etc/init.d/hostapd start (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/hostapd.service
         └─798 /usr/sbin/hostapd -B -P /run/hostapd.pid -B /etc/hostapd/hostapd-2.6.conf
 
Jul 09 19:48:41 odroid systemd[1]: Starting LSB: Advanced IEEE 802.11 management daemon...
Jul 09 19:48:41 odroid hostapd[789]:  * Starting advanced IEEE 802.11 management hostapd
Jul 09 19:48:41 odroid hostapd[789]:    ...done.
Jul 09 19:48:41 odroid systemd[1]: Started LSB: Advanced IEEE 802.11 management daemon.
 
# dnsmasq
dnsmasq.service - dnsmasq - A lightweight DHCP and caching DNS server
   Loaded: loaded (/lib/systemd/system/dnsmasq.service; enabled; vendor preset: enabled)
  Drop-In: /run/systemd/generator/dnsmasq.service.d
         └─50-dnsmasq-$named.conf, 50-insserv.conf-$named.conf
   Active: active (running) since Sun 2017-07-09 19:48:31 UTC; 4min 36s ago
  Process: 592 ExecStartPost=/etc/init.d/dnsmasq systemd-start-resolvconf (code=exited, status=0/SUCCESS)
  Process: 575 ExecStart=/etc/init.d/dnsmasq systemd-exec (code=exited, status=0/SUCCESS)
  Process: 554 ExecStartPre=/usr/sbin/dnsmasq --test (code=exited, status=0/SUCCESS)
 Main PID: 591 (dnsmasq)
   CGroup: /system.slice/dnsmasq.service
         └─591 /usr/sbin/dnsmasq -x /var/run/dnsmasq/dnsmasq.pid -u dnsmasq -r /var/run/dnsmasq/resolv.conf -7 /etc/dnsmasq.d,.dpkg-dist,.dpkg-old,
 
Jul 09 19:48:30 odroid dnsmasq[591]: DNS service limited to local subnets
Jul 09 19:48:30 odroid dnsmasq[591]: warning: ignoring resolv-file flag because no-resolv is set
Jul 09 19:48:30 odroid dnsmasq-dhcp[591]: DHCP, IP range 192.168.1.250 -- 192.168.1.254, lease time 1h
Jul 09 19:48:30 odroid dnsmasq-dhcp[591]: DHCP, IP range 192.168.1.20 -- 192.168.1.50, lease time 3d
Jul 09 19:48:30 odroid dnsmasq[591]: using local addresses only for domain example.com
Jul 09 19:48:30 odroid dnsmasq[591]: using nameserver 4.4.4.4#53
Jul 09 19:48:30 odroid dnsmasq[591]: using nameserver 8.8.8.8#53
Jul 09 19:48:30 odroid dnsmasq[591]: using nameserver 192.168.1.5#53 for domain example.com
Jul 09 19:48:30 odroid dnsmasq[591]: cleared cache
Jul 09 19:48:31 odroid systemd[1]: Started dnsmasq - A lightweight DHCP and caching DNS server.
lines 1-22/22 (END)

Access Point Installation – wpa_supplicant

The wpa_supplicant application is a user space application which works as a WPA supplicant and SME (to handle initiating MLME commands). Please refer to the link for further informations: https://wireless.wiki.kernel.org/en/users/documentation/wpa_supplicant.

Below are the steps to get the wpa_supplicant compilation. First, download the wpa_supplicant source code and build it:

# wget https://w1.fi/releases/wpa_supplicant-2.6.tar.gz
# tar xvfz wpa_supplicant-2.6.tar.gz
# cd wpa_supplicant-2.6/wpa_supplicant/
/wpa_supplicant-2.6/wpa_supplicant# cp defconfig .config
 
# Enable AP, P2P and WPS needed to configure wpa_supplicant in AP mode.
/wpa_supplicant-2.6/wpa_supplicant# echo CONFIG_P2P=y >> .config
/wpa_supplicant-2.6/wpa_supplicant# echo CONFIG_AP=y >> .config
/wpa_supplicant-2.6/wpa_supplicant# echo CONFIG_WPS=y >> .config
/wpa_supplicant-2.6/wpa_supplicant# echo CFLAGS +=-I/usr/include/libnl3/ >> .config
/wpa_supplicant-2.6/wpa_supplicant# echo CONFIG_LIBNL32=y >> .config
/wpa_supplicant-2.6/wpa_supplicant# make
Backup the current wpa_supplicant and replace the file with configured one:
/wpa_supplicant-2.6/wpa_supplicant# mv /sbin/wpa_supplicant /sbin/wpa_supplicant.org
/wpa_supplicant-2.6/wpa_supplicant# cp ./wpa_supplicant /sbin/
Verify that you have installed the latest version:
/wpa_supplicant-2.6/wpa_supplicant# cd ~
# wpa_supplicant -v
 
wpa_supplicant v2.6
Copyright (c) 2003-2016, Jouni Malinen <j@w1.fi> and contributors
Create a configuration file for wpa_supplicant to run in AP mode call wpa.conf:
# vi wpa.conf

The wpa.conf file contents is as follows:

network={
   ssid="odroid-WPA"
   mode=2
   key_mgmt=WPA-PSK
   psk="hardkernel"
   frequency=2437
 }
Reboot the system.
# reboot
Note that you can change the frequency range between 2.4 GHz and 5 GHz.
# ifconfig wlan0
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
      inet 192.168.1.1  netmask 255.255.255.0  broadcast 192.168.1.255
      ether 40:a5:ef:f3:98:6a  txqueuelen 1000  (Ethernet)
      RX packets 122  bytes 13344 (13.3 KB)
      RX errors 0  dropped 1  overruns 0  frame 0
      TX packets 49  bytes 18722 (18.7 KB)
      TX errors 0  dropped 16 overruns 0  carrier 0  collisions 0
This is an example of starting wpa_supplicant as Access Point:
# wpa_supplicant -Dnl80211 -iwlan0 -c ~/wpa.conf
Successfully initialized wpa_supplicant
Using interface wlan0 with hwaddr 7c:dd:90:52:13:1e and ssid "odroid-WPA"
wlan0: interface state UNINITIALIZED->ENABLED
wlan0: AP-ENABLED
wlan0: CTRL-EVENT-CONNECTED - Connection to 7c:dd:90:52:13:1e completed [id=0 id_str=]
Start Wpa_suplicant as a server

Append the following in the /etc/rc.local file:

sudo service network-manager stop
wpa_supplicant -B -Dnl80211 -iwlan0 -c /root/wap.conf
For comments, questions and suggestions, please visit the original article at https://wiki.odroid.com/accessory/connectivity/wifi/wireless_ap_mode.

Be the first to comment

Leave a Reply