We're no longer updating This wiki!!

This is an old revision of the document!


Wireless Access Point

This application note is applicable to the C1/XU4/C2 Ubuntu/Linux Platforms.

One user (tam1111574) reported there was an issue with USB 3.0 port on the XU4.
http://forum.odroid.com/viewtopic.php?f=97&t=19285

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.

Odroid Wireless Cards

All most all the wireless card have capability of configuration as Access Point.

# iwlist 

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

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

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

Please find more information on https://wireless.wiki.kernel.org/en/users/documentation/hostapd

Wifi Module 4

Manufacturer: Ralink
Part name: RT5572
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

Configure Access Point

Configure Wireless network interface and Dnsmasq demon.

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

# cat /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: wlan0 ipaddress should be different from your router.

Note: wireless interface name can change depend on wireless cards.

Configure DHCP server required for Access Point.

We configure dnsmasq light weight dhcp and dns server.

sudo apt-get install --reinstall dnsmasq
$ sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig
$ sudo nano /etc/dnsmasq.conf
domain-needed
bogus-priv
no-resolv
no-poll
server=/example.com/192.168.1.5
server=8.8.8.8
server=4.4.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: Reconfigure dnsmasq: You can extend the dhcp-range or change the ipaddress in the configuration.

Configuration for Wifi Module 0

HostAP demon configration for Ralink RT5370 module only.

Pre software requirement for building hostapd.

sudo apt-get install libnl-3-dev libnl-genl-3-dev libssl-dev hostapd iptables

Hostapd Configuration file for Access Point

sudo nano /etc/default/hostapd

DAEMON_CONF="/etc/hostapd/hostapd.conf"

DAEMON_OPTS="-B"

Note: You can update this DAEMON_OPTS to get the logs from Hostapd demon.

cat /etc/hostapd/hostapd.conf
interface=wlan0
driver=nl80211
ssid=ODROID_AP
hw_mode=g
channel=6
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=hardkernel
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

Configuration for Wifi Module 3

HostAP demon configration for Realtek RTL8192CU module only.

Pre software requirement for building hostapd.

sudo apt-get install libnl-3-dev libnl-genl-3-dev libssl-dev hostapd iptables git-core pkg-config

Download the latest hostapd source code and patch for RTL8192CU.

Steps to get the hostapd compilation.

Note: Realtek RTL8192CU do not support the standard nl80211 driver of hostapd.

$ 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
$ patch -p1 < ../hostapd-rtl871xdrv/rtlxdrv.patch
$ cd hostapd
$ cp defconfig .config
$ echo CONFIG_LIBNL32=y >> .config
$ echo CONFIG_DRIVER_RTW=y >> .config
$ 
$ make

Backup the hostapd demon. Replace the demon with configured one.

$ sudo cp /usr/sbin/hostapd /usr/sbin/hostapd.back
$ sudo cp hostapd /usr/sbin/hostapd

Verify that you have installed the latest version

$ /usr/sbin/hostapd -v
hostapd v2.6 for Realtek rtl871xdrv
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

Hostapd Configuration file for Access Point

sudo nano /etc/default/hostapd

DAEMON_CONF="/etc/hostapd/hostapd.conf"

DAEMON_OPTS="-B"

Note: You can update this DAEMON_OPTS to get the logs from Hostapd demon.

sudo nano /etc/hostapd/hostapd.conf
# 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

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

Configuration for Wifi Module 4

HostAP demon configuration for Ralink Technology, Corp. RT5572 Wireless Adapter.

Pre software requirement for building hostapd.

sudo apt-get install libnl-3-dev libnl-genl-3-dev libssl-dev hostapd iptables

Download the latest hostapd source code

Steps to get the hostapd compilation.

Note: Ralink Technology, Corp. RT5572 Wireless Adapter do not support the standard nl80211 driver of hostapd.

$ wget https://w1.fi/releases/hostapd-2.6.tar.gz
$ tar xvfz hostapd-2.6.tar.gz
$ cd hostapd-2.6
$ cd hostapd
$ cp defconfig .config
$ echo CONFIG_LIBNL32=y >> .config
$ echo CONFIG_IEEE80211N=y >> .config
$ make

Backup the hostapd demon. Replace the demon with configured one.

$ cp /usr/sbin/hostapd /usr/sbin/hostapd.back
$ cp hostapd /usr/sbin/hostapd

Verify that you have installed the latest version

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

Hostapd Configuration file for Access Point

sudo nano /etc/default/hostapd

DAEMON_CONF="/etc/hostapd/hostapd.conf"

DAEMON_OPTS="-B"

Note: You can update this DAEMON_OPTS to get the logs from Hostapd demon.

cat /etc/hostapd/hostapd.conf
# HostAPD

# 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][TX-STBC]
require_ht=0
obss_interval=0

Note: Depending on the ht_capab with the Wifi module4 and Wifi moudule5 we need to tune these setting.

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

Note: Depend on the wireless interface you need to update the configuration file.

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

Setting for forwarding Internet over WIFI from eth0

Next, have port forwarding enabled automatically on boot up.

sudo nano /etc/sysctl.conf
net.ipv4.ip_forward=1
net.ipv6.conf.all.forwarding=1

Access Internet over WIFI.

sudo nano /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: Depend on the wireless network interface name update the iptables rules.

Enable hostapd service on every boot.

sudo update-rc.d hostapd enable

Confirmatioon of Hostapd service is running

$ service hostapd restart
 * Stopping advanced IEEE 802.11 management hostapd                                                                                                    [ OK ]
 * Starting advanced IEEE 802.11 management hostapd                                                                                                    [ OK ]

$ service hostapd status
 * hostapd is running
en/xu4_wlan_ap.1497333614.txt.gz · Last modified: 2017/06/13 14:30 by moon.linux
CC Attribution-Share Alike 3.0 Unported
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0