[[PageOutline]] = Goal = This page will attempt to guide a user through setting up a wireless connection (both as an AP and as a STA) [=#wireless] = Wireless Info = Our product uses the compat-wireless driver set which provides the most recent drivers from [http://wireless.kernel.org/ linux-wireless] backwards-compatible with older kernel versions. The following packages are required or at least recommended for wireless: * iw (recommended) - the [http://wireless.kernel.org/en/users/Documentation/iw iw] tool for interfacing with modern mac80211 based wireless drivers * wireless-tools (deprecated) - the old toolset for interfacing with legacy wireless drivers (somewhat backwards compatible) * hostap-daemon - (required for AP mode) the [http://hostap.epitest.fi/hostapd/ hostapd] background daemon app required for AP configuration * wpa-supplicant - (required for client (STA) mode with encryption) the [http://hostap.epitest.fi/wpa_supplicant/ wpa-supplicant] daemon/app required for client (STA) configuration when using encryption See also: * [wiki:wireless#WirelessConfigurationStandardLinux Standard Linux Wireless Configuration Commands] [=#wireless-sta] = client configuration (STA) = == Using wpa_passphrase/wpa_supplicant == In order to connect to a network with WPA encryption, you must use the wpa_supplicant application. First you must generate a configuration file which is often made easy with the {{{wpa_passphrase}}} application. Then, you must use {{{wpa_supplicant}}} to connect to the network and finally you can configure an IP address (static or dynamic if the AP is running DHCP). The netbase package provides tools such as ifup/ifdown and a config file /etc/network/interfaces that can configure network on startup. Example: 1. edit /etc/network/interfaces and edit/add the following to configure wlan0 on boot wpa_supplicant: {{{ # Wireless interfaces auto wlan0 iface wlan0 inet dhcp wireless_mode managed wireless_essid any #wpa-driver wext wpa-driver nl80211 # New software makes use of nl80211 over wext! wpa-conf /etc/wpa_supplicant.conf }}} * this causes the network interface to be automatically configured on boot (auto wlan), use dhcp for IP address configuration, and run in client mode using wpa supplicant to manage the authentication/encryption keys 1. configure wpa_supplicant to connect to SSID 'testssid' with no key management. {{{ network={ scan_ssid=1 ssid="testssid" key_mgmt=NONE } }}} Or with key management: {{{ network={ scan_ssid=1 ssid="MYSSID" proto=WPA key_mgmt=WPA-PSK psk="MYWPAPASSCODE" } }}} You can also generate the wpa_supplicant.conf file using a tool called {{{wpa_passphrase}}}. Below is an example usage: {{{ root@ventana:~# wpa_passphrase MYSSID MYWPAPASSCODE network={ ssid="MYSSID" #psk="MYWPAPASSCODE" psk=82207641ae13124ee6dc8fd2642605ac52a17405263b0b3203ee5cdb826d700d } root@ventana:~# wpa_passphrase MYSSID MYWPAPASSCODE > /etc/wpa_supplicant.conf }}} 1. To start manually: {{{ killall wpa_supplicant wpa_supplicant -i wlan0 -c /etc/wpa_supplicant.conf -B }}} * To start automatically: Just reboot! The {{{/etc/network/interfaces}}} file we touched above will configure wlan0 to automatically come up with the given options. If you have issues with this, please see the [#Troubleshooting] section below. [=#wireless-ap] = Access Point configuration (AP) = 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. You will need to configure /etc/hostapd.conf to specify important details such as: * interface * driver type (the default is nl80211 which is used for all modern mac80211 drivers) * bridge config * ssid * channel * encryption The default /etc/hostapd.conf file contains detailed documentation and you can find more info [http://wireless.kernel.org/en/users/Documentation/hostapd here] A couple of example configurations: * a 802.11ac capable card using mac80211 configured for SSID=test-ssid, channel 1, wlan0 interface: {{{ cat << EOF > /etc/hostapd.conf interface=wlan0 logger_syslog=-1 logger_syslog_level=2 logger_stdout=-1 logger_stdout_level=2 ctrl_interface=/var/run/hostapd ctrl_interface_group=0 ssid=test-ssid # Spectrum Mode hw_mode=a # 0 for ACS channel=1 ## DFS #ieee80211d=1 #ieee80211h=1 #country_code=US # wireless N ieee80211n=1 ht_capab=[HT40+][SHORT-GI-40][TX-STBC][RX-STBC2][DSSS_CK-40][LDPC] require_ht=1 # wireless ac ieee80211ac=1 vht_capab=[SHORT-GI-80][HTC-VHT] require_vht=1 vht_oper_chwidth=1 # 5.210 GHz vht_oper_centr_freq_seg0_idx=36 # 5.795 GHz vht_oper_centr_freq_seg1_idx=161 EOF /etc/init.d/hostapd stop; sleep 1; /etc/init.d/hostapd start }}} * a 802.11g capable card using mac80211 (WLE300NX) configured for SSID=testssid, channel 11, wlan0 interface, WPA2 encryption with key=testpass: {{{ cat << EOF > /etc/hostapd.conf interface=wlan0 ssid=testssid channel=11 # encryption wpa=2 wpa_passphrase=testpass wpa_key_mgmt=WPA-PSK wpa_pairwise=TKIP rsn_pairwise=CCMP auth_algs=1 EOF /etc/init.d/hostapd stop; sleep 1; /etc/init.d/hostapd start }}} Notes: * Once /etc/hostapd.conf is re-configured reboot or restart the hostapd app: {{{ /etc/init.d/hostapd stop sleep 1 /etc/init.d/hostapd start }}} * make sure /etc/network/interfaces is not configuring the wlan interface automatically == bridged Access Point == 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. For this you need: * bridge-utils package * create a bridge between your wifi interface and your lan interface. For example, assuming wlan0 and eth0: {{{ # create a bride and add interfaces to it brctl addbr br0 brctl addif br0 eth0 brctl addif br0 wlan0 # bring it up ifconfig br0 up # use DHCP to assign IP info udhcpc -i br0 }}} * 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) == routed Access Point == 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. For this you need: * dnsmasq package (or another DHCP server of your choice) * the LAN interface (ie eth0) should have an IP configuration from the LAN segment * the WIFI interface (ie wlan0) should be assigned a static address on a private network * the dnsmasq server is configured to serve IP addresses on the wlan0 network. 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. {{{ interface=wlan0 }}} {{{ dhcp-range=10.0.0.10,10.0.0.200,2h }}} Inside of /etc/network/interfaces, we see a config like so: {{{ # Wireless interfaces auto wlan0 iface wlan0 inet static address 10.0.0.1 netmask 255.255.255.0 }}} The /etc/hostapd.conf file would look like: {{{ interface=wlan0 ssid=GateworksDemo channel=11 }}} = Troubleshooting = 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. {{{ sed -i "s/"^interface=.*"/"interface="/" /etc/hostapd.conf }}}