Changes between Version 1 and Version 2 of Yocto/Wireless


Ignore:
Timestamp:
11/30/2017 06:13:39 PM (22 months ago)
Author:
Bobby Jones
Comment:

Replace AP configuration section with link to relevant section in wireless/wifi

Legend:

Unmodified
Added
Removed
Modified
  • Yocto/Wireless

    v1 v2  
    7575[=#wireless-ap]
    7676= Access Point configuration (AP) =
    77 The 'hostap-daemon' package provides the [http://wireless.kernel.org/en/users/Documentation/hostapd hostapd] application which configures the radio for AP mode using configuration from /etc/hostapd.conf.
    78 
    79 You will need to configure /etc/hostapd.conf to specify important details such as:
    80  * interface
    81  * driver type (the default is nl80211 which is used for all modern mac80211 drivers)
    82  * bridge config
    83  * ssid
    84  * channel
    85  * encryption
    86 
    87 The default /etc/hostapd.conf file contains detailed documentation and you can find more info [http://wireless.kernel.org/en/users/Documentation/hostapd here]
    88 
    89 A couple of example configurations:
    90  * a 802.11ac capable card using mac80211 configured for SSID=test-ssid, channel 1, wlan0 interface:
    91 {{{
    92 cat << EOF > /etc/hostapd.conf
    93 interface=wlan0               
    94                                
    95 logger_syslog=-1               
    96 logger_syslog_level=2         
    97 logger_stdout=-1               
    98 logger_stdout_level=2         
    99                                
    100 ctrl_interface=/var/run/hostapd
    101 ctrl_interface_group=0         
    102                                
    103 ssid=test-ssid               
    104                                
    105 # Spectrum Mode               
    106 hw_mode=a                     
    107                                
    108 # 0 for ACS                   
    109 channel=1                   
    110                                
    111 ## DFS                         
    112 #ieee80211d=1                 
    113 #ieee80211h=1                 
    114 #country_code=US               
    115 
    116 # wireless N                                                     
    117 ieee80211n=1                                                     
    118 ht_capab=[HT40+][SHORT-GI-40][TX-STBC][RX-STBC2][DSSS_CK-40][LDPC]
    119 require_ht=1                                                     
    120                                                                  
    121 # wireless ac                                                     
    122 ieee80211ac=1                                                     
    123 vht_capab=[SHORT-GI-80][HTC-VHT]                                 
    124 require_vht=1                                                     
    125 vht_oper_chwidth=1                                               
    126 # 5.210 GHz                                                       
    127 vht_oper_centr_freq_seg0_idx=36                                   
    128 # 5.795 GHz                                                       
    129 vht_oper_centr_freq_seg1_idx=161                                 
    130 
    131 EOF
    132 /etc/init.d/hostapd stop; sleep 1; /etc/init.d/hostapd start
    133 }}}
    134  * a 802.11g capable card using mac80211 (WLE300NX) configured for SSID=testssid, channel 11, wlan0 interface, WPA2 encryption with key=testpass:
    135 {{{
    136 cat << EOF > /etc/hostapd.conf
    137 interface=wlan0
    138 ssid=testssid
    139 channel=11
    140 # encryption
    141 wpa=2
    142 wpa_passphrase=testpass
    143 wpa_key_mgmt=WPA-PSK
    144 wpa_pairwise=TKIP
    145 rsn_pairwise=CCMP
    146 auth_algs=1
    147 EOF
    148 /etc/init.d/hostapd stop; sleep 1; /etc/init.d/hostapd start
    149 }}}
    150 
    151 Notes:
    152  * Once /etc/hostapd.conf is re-configured reboot or restart the hostapd app:
    153 {{{
    154 /etc/init.d/hostapd stop
    155 sleep 1
    156 /etc/init.d/hostapd start
    157 }}}
    158  * make sure /etc/network/interfaces is not configuring the wlan interface automatically
    159 
    160 
    161 == bridged Access Point ==
    162 A bridged Access Point is used to provide an a Wireless Access Point on a LAN that already has a DHCP server and creates a bridge between the LAN interface and the WIFI interface such that wireless client DHCP requests will be bridged to the LAN and answered from there.
    163 
    164 For this you need:
    165  * bridge-utils package
    166  * create a bridge between your wifi interface and your lan interface.  For example, assuming wlan0 and eth0:
    167 {{{
    168 # create a bride and add interfaces to it
    169 brctl addbr br0
    170 brctl addif br0 eth0
    171 brctl addif br0 wlan0
    172 # bring it up
    173 ifconfig br0 up
    174 # use DHCP to assign IP info
    175 udhcpc -i br0
    176 }}}
    177   * Note that you can use /etc/network/interfaces to bring up and configure the bridge, but if you are using a fairly limited ifup/ifdown (like busybox) you will probably need to create the bridge first (ie in an init script prior to networking coming up)
    178 
    179 
    180 == routed Access Point ==
    181 A routed Access Point is used when you want the wireless network to have its own DHCP server and network.  In this case traffic is routed across the LAN and WIFI interfaces.
    182 
    183 For this you need:
    184  * dnsmasq package (or another DHCP server of your choice)
    185  * the LAN interface (ie eth0) should have an IP configuration from the LAN segment
    186  * the WIFI interface (ie wlan0) should be assigned a static address on a private network
    187  * the dnsmasq server is configured to serve IP addresses on the wlan0 network.
    188 
    189 Modify the /etc/dnsmasq.conf file. To issue DHCP addresses out the wlan0 be sure the following lines are not commented out and or create them.
    190 
    191 {{{
    192 interface=wlan0
    193 }}}
    194 {{{
    195 dhcp-range=10.0.0.10,10.0.0.200,2h
    196 }}}
    197 
    198 Inside of /etc/network/interfaces, we see a config like so:
    199 {{{
    200 # Wireless interfaces
    201 auto wlan0
    202 iface wlan0 inet static
    203         address 10.0.0.1
    204         netmask 255.255.255.0
    205 
    206 }}}
    207 
    208 The /etc/hostapd.conf file would look like:
    209 {{{
    210 interface=wlan0
    211 ssid=GateworksDemo
    212 channel=11
    213 }}}
    214 
    215 = Troubleshooting =
    216 If you're using the above configuration and wireless isn't auto starting in client mode, it's more likely the fault of hostapd also being configured. To disable hostapd, edit /etc/hostapd.conf and remove the wireless interface you would like to use from the "interface" option. Below is a sed that will remove all wireless interfaces from hostapd. This method will allow you to have multiple wireless clients and ap's as you can configure the conf files as needed.
    217 {{{
    218 sed -i "s/"^interface=.*"/"interface="/" /etc/hostapd.conf
    219 }}}
     77For more information on access point configuration, see [wiki:wireless/wifi#AccessPointConfigurationAP wireless/wifi].