VAR-SOM-AM43 Wireless LAN AP: Difference between revisions
(Created page with "{{PageHeader|VAR-SOM-AM43 - WLAN Access Point}} {{DocImage|category1=VAR-SOM-AM43|category2=Yocto}} __toc__ = Configuring WIFI as access point = == Configuring hostapd.conf ==...") |
|||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
{{PageHeader|VAR-SOM-AM43 - WLAN Access Point}} {{DocImage|category1=VAR-SOM-AM43|category2=Yocto}} __toc__ | {{PageHeader|VAR-SOM-AM43 - WLAN Access Point}} {{DocImage|category1=VAR-SOM-AM43|category2=Yocto}} __toc__ | ||
= Configuring | = Configuring WLAN as access point = | ||
== Configuring hostapd.conf == | == Configuring hostapd.conf == | ||
First, we will back up the existing hostapd.conf file by invoking: | First, we will back up the existing hostapd.conf file by invoking: | ||
Line 97: | Line 97: | ||
Expected results: | Expected results: | ||
<pre> | <pre> | ||
root@ | root@varsomam43:~# hostapd -B /etc/hostapd.conf -P /var/run/hostapd.pid | ||
Configuration file: /etc/hostapd.conf | Configuration file: /etc/hostapd.conf | ||
rfkill: Cannot open RFKILL control device | rfkill: Cannot open RFKILL control device | ||
[ | [ 299.788240] wlcore: PHY firmware version: Rev 8.2.0.0.232 | ||
[ | [ 299.848324] wlcore: firmware booted (Rev 8.9.0.0.48) | ||
[ | [ 299.870434] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready | ||
wlan0: interface state UNINITIALIZED->COUNTRY_UPDATE[ | wlan0: interface state UNINITIALIZED->COUNTRY_UPDATE[ 299.879690] cfg80211: Calling CRDA for country: US | ||
root@ | root@varsomam43:~# [ 299.937209] cfg80211: Regulatory domain changed to country: US | ||
[ | [ 299.943264] cfg80211: DFS Master region: FCC | ||
[ | [ 299.947483] cfg80211: (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time) | ||
[ | [ 299.958044] cfg80211: (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 3000 mBm), (N/A) | ||
[ | [ 299.966366] cfg80211: (5170000 KHz - 5250000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 1700 mBm), (N/A) | ||
[ | [ 299.976874] cfg80211: (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2300 mBm), (0 s) | ||
[ | [ 299.986617] cfg80211: (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 3000 mBm), (N/A) | ||
[ | [ 299.995290] cfg80211: (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 4000 mBm), (N/A) | ||
[ | [ 300.017611] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready | ||
</pre> | </pre> |
Latest revision as of 14:03, 24 December 2015
Configuring WLAN as access point
Configuring hostapd.conf
First, we will back up the existing hostapd.conf file by invoking:
$ mv /etc/hostapd.conf /etc/hostapd.conf.orig
Create a new hostapd.conf with the following content:
$ vi /etc/hostapd.conf
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:
$ mv /etc/udhcpd.conf /etc/udhcpd.conf.orig
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
$ vi /etc/udhcpd.conf
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)
hostapd -B /etc/hostapd.conf -P /var/run/hostapd.pid
Expected results:
root@varsomam43:~# hostapd -B /etc/hostapd.conf -P /var/run/hostapd.pid Configuration file: /etc/hostapd.conf rfkill: Cannot open RFKILL control device [ 299.788240] wlcore: PHY firmware version: Rev 8.2.0.0.232 [ 299.848324] wlcore: firmware booted (Rev 8.9.0.0.48) [ 299.870434] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready wlan0: interface state UNINITIALIZED->COUNTRY_UPDATE[ 299.879690] cfg80211: Calling CRDA for country: US root@varsomam43:~# [ 299.937209] cfg80211: Regulatory domain changed to country: US [ 299.943264] cfg80211: DFS Master region: FCC [ 299.947483] cfg80211: (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time) [ 299.958044] cfg80211: (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 3000 mBm), (N/A) [ 299.966366] cfg80211: (5170000 KHz - 5250000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 1700 mBm), (N/A) [ 299.976874] cfg80211: (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2300 mBm), (0 s) [ 299.986617] cfg80211: (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 3000 mBm), (N/A) [ 299.995290] cfg80211: (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 4000 mBm), (N/A) [ 300.017611] 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"
$ ifconfig wlan0 10.4.30.34 netmask 255.255.255.0 up
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:
$ iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
Please see more details on http://processors.wiki.ti.com/index.php/WiLink8_WLAN_Demo:_Linux#AP_.28create_AP_with_no_security.29