accessory:connectivity:wifi:wireless_ap_mode

Wireless Access Point

  • This application note is applicable to our Ubuntu/Linux Platforms.

Almost all the wireless cards have the capability of configuration as to be Access Point.

target
root@odroid:~# sudo iw list

If there is “AP” in the list of “Supported interface modes”, your device will support the Access Point mode.

target
...
 Supported interface modes:
                 * IBSS
                 * managed
                 * AP
                 * AP/VLAN
                 * WDS
                 * monitor
                 * mesh point
...

Refer to the below contents of informations of each wireless interface.

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
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
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
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
Manufacturer: Realtek
Part name: RTL8811AU
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.
Manufacturer: Realtek
Part name: RTL8821CU
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:c820 Realtek Semiconductor Corp.

There're some tools available on the Internet for configuring wireless AP mode.

So, at this moment it is recommended to use those tools rather than configuring all the things out by yourself unless there're some settings or flags you have to set.

Please look into this great tool.

  • Operation confirmed on Odroid boards: create_ap
HostAP Mode Compatibility List
Wifi module name
(USB VID:PID)
ODROID-C1 ODROID-C2 ODROID-XU3/4 ODROID-N2
Ubuntu 16.04
v2.2-3.10.y
Ubuntu 18.04
v3.0-3.10.y
Ubuntu 16.04
v2.4-3.14.y
Ubuntu 18.04
v3.0-3.16.y
Ubuntu 16.04
20170731-3.10.y
Ubuntu 16.04
20171212-4.14.y
Ubuntu 18.04
20181203-4.14.y
Ubuntu 18.04.2
20190217-4.9.y
0 - Ralink RT5370N
(0x148F:0x5370)
confirm confirm confirm confirm confirm confirm confirm confirm
3 - Realtak RTL8188CUS
(0x0BDA:0x8176)
confirm
Dedicated hostapd
confirm
Dedicated hostapd
confirm
Dedicated hostapd
confirm confirm confirm
Dedicated hostapd
confirm confirm
4 - Ralink RT5572N
(0x148F:0x5572)
confirm confirm confirm confirm confirm confirm confirm confirm
5 - Realtak RTL8812AU
(0x0BDA:0x8812)
confirm confirm confirm confirm confirm
Dedicated hostapd
confirm
Dedicated hostapd
confirm confirm
5A - Realtak RTL8811AU
(0x0BDA:0xa811)
confirm confirm confirm confirm not working confirm confirm confirm
wpa_supplicant Mode Compatibility List
Wifi module name
(USB VID:PID)
ODROID-C1 ODROID-C2 ODROID-XU3/4 ODROID-N2
Ubuntu 16.04
v2.2-3.10.y
Ubuntu 18.04
v3.0-3.10.y
Ubuntu 16.04
v2.4-3.14.y
Ubuntu 18.04
v3.0-3.16.y
Ubuntu 16.04
20170731-3.10.y
Ubuntu 16.04
20171212-4.14.y
Ubuntu 18.04
20181203-4.14.y
Ubuntu 18.04.1
20190217-4.9.y
0 - Ralink RT5370N
(0x148F:0x5370)
confirm confirm confirm confirm confirm confirm not working not working
3 - Realtak RTL8188CUS
(0x0BDA:0x8176)
not working not working not working not working not working not working not working not working
4 - Ralink RT5572N
(0x148F:0x5572)
confirm confirm confirm confirm confirm confirm not working not working
5 - Realtak RTL8812AU
(0x0BDA:0x8812)
not working not working confirm confirm not working confirm not working not working
5A - Realtak RTL8811AU
(0x0BDA:0xa811)
not working not working confirm confirm not working not working not working not working
  • All commands must be executed in super user mode.
  • You should do apt update && apt full-upgrade before proceed.
  • It may need to do apt install libnl-3-dev libnl-genl-3-dev libssl-dev hostapd iptables git pkg-config vim build-essential to work with.

Configure wireless network interface and dnsmasq daemon.

Configure access point 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

In order to configure Wireless Access Point you need to provide static IP address to Wireless network card.

Check wlan0 part of the following contents that you should put.

target
root@odroid:~# 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: The predictable interface names shown as starts with wlan suppose you have an interface name.

If your wireless interface name shows like the below's,

target
root@odroid:~# 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)

Add net.ifnames=0 as kernel parameter to kernel command line by editing the boot.ini. The local interface name issue gets resolved to have predictable name for wireless interface.

target
root@odroid:~# 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: wlan0 IP address might be different from yours.

Note: Wireless interface name can be changed as it depends on the wireless cards you installed.

Configure dnsmasq which is a light weight DHCP and DNS server.

target
root@odroid:~# 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”,
    target
    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 listening port 53.
    target
    # Check that systemd-resolve service is listening port 53 now(127.0.0.53:53)
    root@odroid:~# 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
    root@odroid:~# 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.
    root@odroid:~# systemctl stop systemd-resolved
     
    # dnsmasq service enable & start
    root@odroid:~# 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
     
    root@odroid:~# systemctl start dnsmasq
    # confirm dnsmasq service running
    root@odroid:~# netstat -alnp | grep -w LISTEN
    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.

target
root@odroid:~# mv /etc/dnsmasq.conf /etc/dnsmasq.conf.org
root@odroid:~# vi /etc/dnsmasq.conf
dnsmasq.conf
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: You can extend the dhcp-range or change the IP address in the configuration.

Next, make port forwarding enabled automatically on boot up.

target
root@odroid:~# vi /etc/sysctl.conf

Find the options below and change as 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.

target
root@odroid:~# 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

Note: Update the iptables rules depending on your wireless network interface.

Reboot the system to get work.

target
root@odroid:~# reboot

Step 4-1: Setup Hostapd server configuration

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 on https://wireless.wiki.kernel.org/en/users/documentation/hostapd


Steps to get the hostapd compilation. Download the hostapd source code and build with proper parameters.

Wifi Module 0, 4, 5, 5A
target
root@odroid:~# wget https://w1.fi/releases/hostapd-2.6.tar.gz
root@odroid:~# tar xvfz hostapd-2.6.tar.gz
root@odroid:~# cd hostapd-2.6/hostapd
root@odroid:~/hostapd-2.6/hostapd# cp defconfig .config
root@odroid:~/hostapd-2.6/hostapd# echo CONFIG_LIBNL32=y >> .config
root@odroid:~/hostapd-2.6/hostapd# echo CONFIG_IEEE80211N=y >> .config
root@odroid:~/hostapd-2.6/hostapd# echo CONFIG_IEEE80211AC=y >> .config
root@odroid:~/hostapd-2.6/hostapd# make
Wifi Module 3

You should download a patch file if you use Wifi Module 3 to make hostapd works for Wifi Module 3 which do not support the standard nl80211 driver from hostapd on kernel 3.10, 3.14, 3.16.

target
root@odroid:~# git clone https://github.com/pritambaral/hostapd-rtl871xdrv.git 
root@odroid:~# wget https://w1.fi/releases/hostapd-2.6.tar.gz
root@odroid:~# tar xvfz hostapd-2.6.tar.gz
root@odroid:~# cd hostapd-2.6
root@odroid:~/hostapd-2.6# patch -p1 < ../hostapd-rtl871xdrv/rtlxdrv.patch
root@odroid:~/hostapd-2.6# cd hostapd
root@odroid:~/hostapd-2.6/hostapd# cp defconfig .config
root@odroid:~/hostapd-2.6/hostapd# echo CONFIG_LIBNL32=y >> .config
root@odroid:~/hostapd-2.6/hostapd# echo CONFIG_DRIVER_RTW=y >> .config
root@odroid:~/hostapd-2.6/hostapd# make

Backup the current hostapd. Replace the file with the configured one.

target
root@odroid:~/hostapd-2.6/hostapd# mv /usr/sbin/hostapd /usr/sbin/hostapd.org
root@odroid:~/hostapd-2.6/hostapd# cp hostapd /usr/sbin/

Verify that you have installed the latest version.

target
root@odroid:~/hostapd-2.6/hostpad# cd ~
root@odroid:~# 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
target
root@odroid:~# vi /etc/default/hostapd

Find the options below and edit.

DAEMON_CONF="/etc/hostapd/hostapd.conf"
DAEMON_OPTS="-B"

Note: You can update this DAEMON_OPTS to get the logs from hostapd daemon.

Edit /etc/hostapd/hostapd.conf file.

target
root@odroid:~# vi /etc/hostapd/hostapd.conf

  • If you have trouble with this settings with Wifi module 3, check out the below list.
    • You should build your rtl871xdrv patched hostapd and copy that results to /usr/sbin directory.
    • Don't forget to comment the codes out in N-WLAN categories.
    • rtl8192cu, rtl_usb, rtl8192c_common, rtlwifi modules should be loaded.
    • Or if it still doesn't work and/or if you use kernel version under 4.4, you can try to follow the previous guide: https://wiki.odroid.com/accessory/connectivity/wifi/wlan_ap
    • Also you can try to use a pre-built script: https://github.com/oblique/create_ap
Hostapd configuration for __2.4 Ghz__ configuration
hostapd.conf
# 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
 
##### If you use Wifi module 3 (RTL8188CUS), you have to comment all the below contents out #####
# N-WLAN
ieee80211n=1
ht_capab=[HT20+][SHORT-GI-20][DSSS_CCK-20]
require_ht=0
obss_interval=0
Hostapd configuration for __5 Ghz__ Realtek RTL8812AU chipset
hostapd.conf
# 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

Note: On the Wifi module 4 and Wifi moudule 5, Wifi module 5A, we need to tune these setting depending on the ht_capab.

Note: Replace the country_code, ssid, and wpa_passphrase as per your requirement.

Note: N-WLAN is optional that can be dropped out.

Step 4-2: Check your hostpad & dnsmasq service status

  • 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.

target
# Force allocation of IP address
root@odroid:~# ifconfig wlan0 192.168.1.1
 
# Check IP address
root@odroid:~# 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.

target
root@odroid:~# update-rc.d hostapd enable

Restart the services.

target
root@odroid:~# service hostapd restart
root@odroid:~# 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 out again.
    systemctl unmask hostapd.service

Check the services.

target
root@odroid:~# service hostapd status
root@odroid:~# service dnsmasq status

Check active (running) status as shown as the followings.

target
# 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)

Step 4-1: Setup wpa_supplicant configuration

wpa_supplicant 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

Steps to get the wpa_supplicant compilation. Download the wpa_supplicant source code and build.

target
root@odroid:~# wget https://w1.fi/releases/wpa_supplicant-2.6.tar.gz
root@odroid:~# tar xvfz wpa_supplicant-2.6.tar.gz
root@odroid:~# cd wpa_supplicant-2.6/wpa_supplicant/
root@odroid:~/wpa_supplicant-2.6/wpa_supplicant# cp defconfig .config
 
# Enable AP, P2P and WPS needed to configure wpa_supplicant in AP mode.
root@odroid:~/wpa_supplicant-2.6/wpa_supplicant# echo CONFIG_P2P=y >> .config
root@odroid:~/wpa_supplicant-2.6/wpa_supplicant# echo CONFIG_AP=y >> .config
root@odroid:~/wpa_supplicant-2.6/wpa_supplicant# echo CONFIG_WPS=y >> .config
root@odroid:~/wpa_supplicant-2.6/wpa_supplicant# echo CFLAGS +=-I/usr/include/libnl3/ >> .config
root@odroid:~/wpa_supplicant-2.6/wpa_supplicant# echo CONFIG_LIBNL32=y >> .config
root@odroid:~/wpa_supplicant-2.6/wpa_supplicant# make

Backup the current wpa_supplicant. Replace the file with configured one.

target
root@odroid:~/wpa_supplicant-2.6/wpa_supplicant# mv /sbin/wpa_supplicant /sbin/wpa_supplicant.org
root@odroid:~/wpa_supplicant-2.6/wpa_supplicant# cp ./wpa_supplicant /sbin/

Verify that you have installed the latest version.

target
root@odroid:~/wpa_supplicant-2.6/wpa_supplicant# cd ~
root@odroid:~# wpa_supplicant -v
 
wpa_supplicant v2.6
Copyright (c) 2003-2016, Jouni Malinen <j@w1.fi> and contributors

Create a config file for wpa_supplicant to run in AP mode. We're going to create that names wpa.conf.

target
root@odroid:~# vi wpa.conf
wpa.conf
network={
     ssid="odroid-WPA"
     mode=2
     key_mgmt=WPA-PSK
     psk="hardkernel"
     frequency=2437
 }

Reboot the system.

target
root@odroid:~# reboot

Note: You can change the frequency range between 2.4 GHz and 5 GHz.

Confirm them.

target
root@odroid:~# 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.

target
root@odroid:~# 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 /etc/rc.local file

target
sudo service network-manager stop
wpa_supplicant -B -Dnl80211 -iwlan0 -c /root/wap.conf
  • accessory/connectivity/wifi/wireless_ap_mode.txt
  • Last modified: 2021/03/31 11:34
  • by joshua