Configuring WIFI as access point (supported on WL18xx only)¶
Configuring hostapd.conf¶
First, we will back up the existing hostapd.conf file by invoking:
Create a new hostapd.conf with the following content:
Copy/paste the following configuration file into /etc/hostapd.conf and save it:
interface=wlan0
driver=nl80211
channel=1
hw_mode=g
preamble=1
dtim_period=2
beacon_int=100
logger_syslog=-1
logger_syslog_level=2
logger_stdout=-1
logger_stdout_level=2
ctrl_interface=/var/run/hostapd
ctrl_interface_group=0
supported_rates=10 20 55 110 60 90 120 180 240 360 480 540
basic_rates=10 20 55 110
ssid=SoftAP_Role
max_num_sta=5
macaddr_acl=0
auth_algs=3
ieee80211d=0
uapsd_advertisement_enabled=1
wep_rekey_period=0
own_ip_addr=127.0.0.1
wpa_group_rekey=0
wpa_strict_rekey=0
wpa_gmk_rekey=0
wpa_ptk_rekey=0
#ap_table_max_size=255
#ap_table_expiration_time=60
eap_server=1
disassoc_low_ack=1
ap_max_inactivity=4294967295
country_code=US
For AP on 5GHz set to these values:
channel=36
hw_mode=a
basic_rates=60 120 240
Explanation:
1) interface - in that case will be wlan0, since wlan0 will take the role of AP
2) channel - should be the same as the commericial AP channel that the station (wlan0)is connected too (since AP and Station need to be in the same channel)
3) hw_mode=g - to support 2.4GHz, a - to support 5GHz
4) ieee80211n=1 - optional to support 802.11n band ssid - the AP SSID
5) basic_rates=10 20 55 110 (11B rates for 2.4GHz) , 60 120 240 (11G rates for 5GHz as not allowed to use 11B in 5GHz)
Configuring udhcpd.conf¶
First, we will back up the existing udhcpd.conf file by invoking:
Create a new udhcpd.conf with the following content: - opt router: is the Router IP address and have to be the same as was defined by ifconfig command, in that example it is 10.4.30.34
Copy/paste the following configuration file into /etc/udhcpd.conf and save it:
# Sample udhcpd configuration file (/etc/udhcpd.conf)
# The start and end of the IP lease block
start 10.4.30.40 #default: 192.168.0.20
end 10.4.30.48 #default: 192.168.0.254
# The interface that udhcpd will use
interface wlan0 #default: eth0
#Examles
opt dns 8.8.8.8 8.8.4.4 # public google dns servers
option subnet 255.255.255.0
opt router 10.4.30.34
option lease 864000 # 10 days of
operate WLAN as AP (Run hostapd)¶
Expected results:
root@varsomam33:~# hostapd -B /etc/hostapd.conf -P /var/run/hostapd.pid
Configuration file: /etc/hostapd.conf
rfkill: Cannot open RFKILL control device
[ 137.215567] wlcore: PHY firmware version: Rev 8.2.0.0.232
[ 137.266947] wlcore: firmware booted (Rev 8.9.0.0.48)
[ 137.293599] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
wlan0: interface state UNINITIALIZED->COUNTRY_UPDATE[ 137.304404] cfg80211: Calling CRDA for country: US
root@varsomam33:~# [ 137.372193] cfg80211: Regulatory domain changed to country: US
[ 137.378114] cfg80211: DFS Master region: FCC
[ 137.383328] cfg80211: (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[ 137.393336] cfg80211: (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 3000 mBm), (N/A)
[ 137.402341] cfg80211: (5170000 KHz - 5250000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 1700 mBm), (N/A)
[ 137.412024] cfg80211: (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2300 mBm), (0 s)
[ 137.422169] cfg80211: (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 3000 mBm), (N/A)
[ 137.430304] cfg80211: (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 4000 mBm), (N/A)
[ 137.461606] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
Assign IP address to the wlan port, note that it has to be the same one as defined in the "udhcpd.conf" file in field "opt router"
Add NAT and DHCP server capability to the AP:
echo 1 > /proc/sys/net/ipv4/ip_forward
udhcpd /etc/udhcpd.conf
iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
Enable NAT for internet sharing¶
Assumption: Internet connection is available on port eth0 and we want to share it with wlan0 incoming access point connections.
We type the following to enable internet sharing, in this case:
Please see more details on http://processors.wiki.ti.com/index.php/WiLink8_WLAN_Demo:_Linux#AP_.28create_AP_with_no_security.29