Difference between revisions of "Wlan"

From RobotinoWiki
(/etc/hostapd.conf)
(TP-Link WN722N v2)
(27 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
==Robotino v1 and v2==
 
==Robotino v1 and v2==
Robotino up to version 2 is equipped with an internal access point. This internal AP can be configured as client or master.
+
Robotino up to version 2 is equipped with an [[Allnet_ap|internal access point]]. This internal AP can be configured as client or master.
  
 
==Robotino v3==
 
==Robotino v3==
 
The next generation Robotino will use an USB WLAN stick to either connect to an access point in client mode or provide a access point external clients can connect to in master mode. Various WLAN USB adapters are supported. The following list shows the USB sticks tested to work in both client and master mode:
 
The next generation Robotino will use an USB WLAN stick to either connect to an access point in client mode or provide a access point external clients can connect to in master mode. Various WLAN USB adapters are supported. The following list shows the USB sticks tested to work in both client and master mode:
* AVM Fritz!WLAN USB Stick N (support for a/b/g/n)
+
* AVM Fritz!WLAN USB Stick N (supports a/b/g/n)
 +
* TP-Link TL-WDN4800 (PCIe-adapter, supports a/b/g/n)
 
The following adapters are known to work at least in client mode:
 
The following adapters are known to work at least in client mode:
 
* Alfa AWUS036EW USB WLAN Stick (support for b/g)
 
* Alfa AWUS036EW USB WLAN Stick (support for b/g)
 
* Alfa AWUS036H USB WLAN (support for b/g)
 
* Alfa AWUS036H USB WLAN (support for b/g)
  
===hostapd configuration===
+
===WLAN master===
The WLAN master on Robotino is run by [http://linuxwireless.org/en/users/Documentation/hostapd hostapd]. A german how-to on setting up a WLAN router using hostapd can be found [http://wiki.ubuntuusers.de/WLAN_Router here].
+
The WLAN master on Robotino is run by [http://linuxwireless.org/en/users/Documentation/hostapd hostapd]. A german how-to on setting up a WLAN router using hostapd can be found [http://wiki.ubuntuusers.de/WLAN_Router here]. Additionally a [http://wiki.ubuntuusers.de/ISC-DHCPD DHCP server] is running assigning IP addresses to clients connecting to Robotino's access point.
===/etc/default/hostapd===
+
 
 +
When running as WLAN master Robotino has the fixed IP address 172.26.1.1 with netmask 255.255.0.0. The DHCP server assigns addresses in the range 172.26.1.100 to 172.26.1.200.
 +
 
 +
Configuration:
 +
*[http://svn.openrobotino.org/config/trunk/files/etc/hostapd.conf.default /etc/hostapd.conf]
 +
*[http://svn.openrobotino.org/config/trunk/files/etc/default/isc-dhcp-server.default /etc/default/isc-dhcp-server]
 +
*[http://svn.openrobotino.org/config/trunk/files/etc/dhcp/dhcpd.conf.default /etc/dhcp/dhcpd.conf]
 +
*[http://svn.openrobotino.org/config/trunk/files/etc/network/interfaces.default /etc/network/interfaces]
 +
*[http://svn.openrobotino.org/config/trunk/files/etc/udev/rules.d/99-wlan.rules /etc/udev/rules.d/99-wlan.rules]
 +
*[http://svn.openrobotino.org/config/trunk/files/usr/local/bin/start-wlan0-master.sh usr/local/bin/start-wlan0-master.sh]
 +
*[http://svn.openrobotino.org/config/trunk/files/usr/local/bin/stop-wlan0-master.sh usr/local/bin/stop-wlan0-master.sh]
 +
 
 +
====5GHz WLAN====
 +
If your network adapter supports 5GHz WLAN you can setup your system to use this frequency by manually editing /etc/hostapd.conf
 
<pre>
 
<pre>
DAEMON_CONF="/etc/hostapd.conf"  # the configuration file to use
+
hw_mode=a
RUN_DAEMON=yes                    # start hostapd at system boot
+
channel=44
 
</pre>
 
</pre>
 
+
After saving your changes restart the wlan interface
===/etc/hostapd.conf===
 
 
<pre>
 
<pre>
interface=wlan0
+
ifdown wlan0
 +
ifup wlan0
 +
</pre>
  
# Driver interface type (hostap/wired/madwifi/test/none/nl80211/bsd);
+
===WLAN client===
# default: hostap). nl80211 is used with all Linux mac80211 drivers.
+
In client mode the WLAN interface of Robotino connects to an external accesspoint. Robotino can be assigned a fixed IP address or can obtain an address from an external DHCP server.
# Use driver=none if building hostapd as a standalone RADIUS server that does
 
# not control any wireless/wired driver.
 
driver=nl80211
 
  
# SSID to be used in IEEE 802.11 management frames
+
Configuration:
ssid=Robotino3AP
+
*[http://svn.openrobotino.org/daemons/trunk/scripts/etc/wpa_supplicant/wpa_supplicant.conf.default /etc/wpa_supplicant/wpa_supplicant.conf]
 +
*/etc/network/interfaces will contain the line ''wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf''
  
# Channel number (IEEE 802.11)
+
====Hint====
# (default: 0, i.e., not set)
+
Remember that eth0:10 is preconfigured to 192.168.1.244. If this is in conflict to your settings for eth0 you might want to disable eth0:10 in /etc/network/interfaces.
# Please note that some drivers (e.g., madwifi) do not use this value from
 
# hostapd and the channel will need to be configuration separately with
 
# iwconfig.
 
channel=6
 
  
# visible ESSID
+
==TP-Link WN722N v2==
ignore_broadcast_ssid=0
+
<pre>
 
+
git clone https://github.com/jeremyb31/rtl8188eu
# Country code (ISO/IEC 3166-1). Used to set regulatory domain.
+
cd rtl8188eu
# Set as needed to indicate country in which device is operating.
 
# This can limit available channels and transmit power.
 
country_code=DE
 
 
 
# Enable IEEE 802.11d. This advertises the country_code and the set of allowed
 
# channels and transmit power levels based on the regulatory limits. The
 
# country_code setting must be configured with the correct country for
 
# IEEE 802.11d functions.
 
# (default: 0 = disabled)
 
ieee80211d=1
 
 
 
# Operation mode (a = IEEE 802.11a, b = IEEE 802.11b, g = IEEE 802.11g,
 
# Default: IEEE 802.11b
 
hw_mode=g
 
 
 
# ieee80211n: Whether IEEE 802.11n (HT) is enabled
 
# 0 = disabled (default)
 
# 1 = enabled
 
# Note: You will also need to enable WMM for full HT functionality.
 
# ieee80211n=1
 
 
 
# Beacon interval in kus (1.024 ms) (default: 100; range 15..65535)
 
beacon_int=100
 
 
 
# DTIM (delivery trafic information message) period (range 1..255):
 
# number of beacons between DTIMs (1 = every beacon includes DTIM element)
 
# (default: 2)
 
dtim_period=2
 
 
 
# Station MAC address -based authentication
 
# Please note that this kind of access control requires a driver that uses
 
# hostapd to take care of management frame processing and as such, this can be
 
# used with driver=hostap or driver=nl80211, but not with driver=madwifi.
 
# 0 = accept unless in deny list
 
# 1 = deny unless in accept list
 
# 2 = use external RADIUS server (accept/deny lists are searched first)
 
macaddr_acl=0
 
 
 
# Maximum number of stations allowed in station table. New stations will be
 
# rejected after the station table is full. IEEE 802.11 has a limit of 2007
 
# different association IDs, so this number should not be larger than that.
 
# (default: 2007)
 
max_num_sta=255
 
 
 
# RTS/CTS threshold; 2347 = disabled (default); range 0..2347
 
# If this field is not included in hostapd.conf, hostapd will not control
 
# RTS threshold and 'iwconfig wlan# rts <val>' can be used to set it.
 
rts_threshold=2347
 
 
 
# Fragmentation threshold; 2346 = disabled (default); range 256..2346
 
# If this field is not included in hostapd.conf, hostapd will not control
 
# fragmentation threshold and 'iwconfig wlan# frag <val>' can be used to set
 
# it.
 
fragm_threshold=2346
 
 
 
# hostapd event logger configuration
 
#
 
# Two output method: syslog and stdout (only usable if not forking to
 
# background).
 
#
 
# Module bitfield (ORed bitfield of modules that will be logged; -1 = all
 
# modules):
 
# bit 0 (1) = IEEE 802.11
 
# bit 1 (2) = IEEE 802.1X
 
# bit 2 (4) = RADIUS
 
# bit 3 (8) = WPA
 
# bit 4 (16) = driver interface
 
# bit 5 (32) = IAPP
 
# bit 6 (64) = MLME
 
#
 
# Levels (minimum value for logged events):
 
#  0 = verbose debugging
 
#  1 = debugging
 
#  2 = informational messages
 
#  3 = notification
 
#  4 = warning
 
#
 
logger_syslog=-1
 
logger_syslog_level=2
 
logger_stdout=-1
 
logger_stdout_level=2
 
 
 
# Dump file for state information (on SIGUSR1)
 
dump_file=/tmp/hostapd.dump
 
 
 
# Interface for separate control program. If this is specified, hostapd
 
# will create this directory and a UNIX domain socket for listening to requests
 
# from external programs (CLI/GUI, etc.) for status information and
 
# configuration. The socket file will be named based on the interface name, so
 
# multiple hostapd processes/interfaces can be run at the same time if more
 
# than one interface is used.
 
# /var/run/hostapd is the recommended directory for sockets and by default,
 
# hostapd_cli will use it when trying to connect with hostapd.
 
ctrl_interface=/var/run/hostapd
 
 
 
# Access control for the control interface can be configured by setting the
 
# directory to allow only members of a group to use sockets. This way, it is
 
# possible to run hostapd as root (since it needs to change network
 
# configuration and open raw sockets) and still allow GUI/CLI components to be
 
# run as non-root users. However, since the control interface can be used to
 
# change the network configuration, this access needs to be protected in many
 
# cases. By default, hostapd is configured to use gid 0 (root). If you
 
# want to allow non-root users to use the contron interface, add a new group
 
# and change this value to match with that group. Add users that should have
 
# control interface access to this group.
 
#
 
# This variable can be a group name or gid.
 
#ctrl_interface_group=wheel
 
ctrl_interface_group=0
 
 
 
# IEEE 802.11 specifies two authentication algorithms. hostapd can be
 
# configured to allow both of these or only one. Open system authentication
 
# should be used with IEEE 802.1X.
 
# Bit fields of allowed authentication algorithms:
 
# bit 0 = Open System Authentication
 
# bit 1 = Shared Key Authentication (requires WEP)
 
auth_algs=3
 
 
 
# Default WMM parameters (IEEE 802.11 draft; 11-03-0504-03-000e):
 
# for 802.11a or 802.11g networks
 
# These parameters are sent to WMM clients when they associate.
 
# The parameters will be used by WMM clients for frames transmitted to the
 
# access point.
 
#
 
# note - txop_limit is in units of 32microseconds
 
# note - acm is admission control mandatory flag. 0 = admission control not
 
# required, 1 = mandatory
 
# note - here cwMin and cmMax are in exponent form. the actual cw value used
 
# will be (2^n)-1 where n is the value given here
 
#
 
wmm_enabled=0
 
 
 
# Enable WPA. Setting this variable configures the AP to require WPA (either
 
# WPA-PSK or WPA-RADIUS/EAP based on other configuration). For WPA-PSK, either
 
# wpa_psk or wpa_passphrase must be set and wpa_key_mgmt must include WPA-PSK.
 
# For WPA-RADIUS/EAP, ieee8021x must be set (but without dynamic WEP keys),
 
# RADIUS authentication server must be configured, and WPA-EAP must be included
 
# in wpa_key_mgmt.
 
# This field is a bit field that can be used to enable WPA (IEEE 802.11i/D3.0)
 
# and/or WPA2 (full IEEE 802.11i/RSN):
 
# bit0 = WPA
 
# bit1 = IEEE 802.11i/RSN (WPA2) (dot11RSNAEnabled)
 
wpa=2
 
 
 
# Enable IEEE 802.11i/RSN/WPA2 pre-authentication. This is used to speed up
 
# roaming be pre-authenticating IEEE 802.1X/EAP part of the full RSN
 
# authentication and key handshake before actually associating with a new AP.
 
# (dot11RSNAPreauthenticationEnabled)
 
rsn_preauth=1
 
  
# Space separated list of interfaces from which pre-authentication frames are
+
Edit os_dep/usb_intf.c and add the following line
# accepted (e.g., 'eth0' or 'eth0 wlan0wds0'. This list should include all
+
{USB_DEVICE(0x2357, 0x010c)}, /* TP-Link WN722N v2 */
# interface that are used for connections to other APs. This could include
 
# wired interfaces and WDS links. The normal wireless data interface towards
 
# associated stations (e.g., wlan0) should not be added, since
 
# pre-authentication is only used with APs other than the currently associated
 
# one.
 
rsn_preauth_interfaces=wlan0
 
  
# Set of accepted key management algorithms (WPA-PSK, WPA-EAP, or both). The
+
make
# entries are separated with a space. WPA-PSK-SHA256 and WPA-EAP-SHA256 can be
+
make install
# added to enable SHA256-based stronger algorithms.
 
# (dot11RSNAConfigAuthenticationSuitesTable)
 
wpa_key_mgmt=WPA-PSK
 
  
# Set of accepted cipher suites (encryption algorithms) for pairwise keys
+
****************************
# (unicast packets). This is a space separated list of algorithms:
+
Actions of make install:
# CCMP = AES in Counter mode with CBC-MAC [RFC 3610, IEEE 802.11i/D7.0]
+
install -p -m 644 8188eu.ko  /lib/modules/4.4.0-34-generic/kernel/drivers/net/wireless
# TKIP = Temporal Key Integrity Protocol [IEEE 802.11i/D7.0]
+
cp rtl8188eufw.bin /lib/firmware/.
# Group cipher suite (encryption algorithm for broadcast and multicast frames)
+
/sbin/depmod -a 4.4.0-34-generic
# is automatically selected based on this configuration. If only CCMP is
+
mkdir -p /lib/firmware/rtlwifi
# allowed as the pairwise cipher, group cipher will also be CCMP. Otherwise,
+
cp rtl8188eufw.bin /lib/firmware/rtlwifi/.
# TKIP will be used as the group cipher.
+
****************************
# (dot11RSNAConfigPairwiseCiphersTable)
 
# Pairwise cipher for WPA (v1) (default: TKIP)
 
#wpa_pairwise=TKIP CCMP
 
# Pairwise cipher for RSN/WPA2 (default: use wpa_pairwise value)
 
rsn_pairwise=CCMP
 
  
# Time interval for rekeying GTK (broadcast/multicast encryption keys) in
+
echo 8188eu >> /etc/modules
# seconds. (dot11RSNAConfigGroupRekeyTime)
 
wpa_group_rekey=600
 
wpa_ptk_rekey=600
 
wpa_gmk_rekey=86400
 
 
 
# WPA pre-shared keys for WPA-PSK. This can be either entered as a 256-bit
 
# secret in hex format (64 hex digits), wpa_psk, or as an ASCII passphrase
 
# (8..63 characters) that will be converted to PSK. This conversion uses SSID
 
# so the PSK changes when ASCII passphrase is used and the SSID is changed.
 
# wpa_psk (dot11RSNAConfigPSKValue)
 
# wpa_passphrase (dot11RSNAConfigPSKPassPhrase)
 
wpa_passphrase=robotino3ap
 
</pre>
 
 
 
===/etc/network/interfaces===
 
<pre>
 
auto wlan0
 
iface wlan0 inet static
 
address 172.26.1.1
 
netmask 255.255.0.0
 
broadcast 172.26.255.255
 
 
</pre>
 
</pre>

Revision as of 09:05, 3 May 2017

Robotino v1 and v2

Robotino up to version 2 is equipped with an internal access point. This internal AP can be configured as client or master.

Robotino v3

The next generation Robotino will use an USB WLAN stick to either connect to an access point in client mode or provide a access point external clients can connect to in master mode. Various WLAN USB adapters are supported. The following list shows the USB sticks tested to work in both client and master mode:

  • AVM Fritz!WLAN USB Stick N (supports a/b/g/n)
  • TP-Link TL-WDN4800 (PCIe-adapter, supports a/b/g/n)

The following adapters are known to work at least in client mode:

  • Alfa AWUS036EW USB WLAN Stick (support for b/g)
  • Alfa AWUS036H USB WLAN (support for b/g)

WLAN master

The WLAN master on Robotino is run by hostapd. A german how-to on setting up a WLAN router using hostapd can be found here. Additionally a DHCP server is running assigning IP addresses to clients connecting to Robotino's access point.

When running as WLAN master Robotino has the fixed IP address 172.26.1.1 with netmask 255.255.0.0. The DHCP server assigns addresses in the range 172.26.1.100 to 172.26.1.200.

Configuration:

5GHz WLAN

If your network adapter supports 5GHz WLAN you can setup your system to use this frequency by manually editing /etc/hostapd.conf

hw_mode=a
channel=44

After saving your changes restart the wlan interface

ifdown wlan0
ifup wlan0

WLAN client

In client mode the WLAN interface of Robotino connects to an external accesspoint. Robotino can be assigned a fixed IP address or can obtain an address from an external DHCP server.

Configuration:

Hint

Remember that eth0:10 is preconfigured to 192.168.1.244. If this is in conflict to your settings for eth0 you might want to disable eth0:10 in /etc/network/interfaces.

TP-Link WN722N v2

git clone https://github.com/jeremyb31/rtl8188eu
cd rtl8188eu

Edit os_dep/usb_intf.c and add the following line
{USB_DEVICE(0x2357, 0x010c)}, /* TP-Link WN722N v2 */

make
make install

****************************
Actions of make install:
install -p -m 644 8188eu.ko  /lib/modules/4.4.0-34-generic/kernel/drivers/net/wireless
cp rtl8188eufw.bin /lib/firmware/.
/sbin/depmod -a 4.4.0-34-generic
mkdir -p /lib/firmware/rtlwifi
cp rtl8188eufw.bin /lib/firmware/rtlwifi/.
****************************

echo 8188eu >> /etc/modules