Wlan

From RobotinoWiki
Revision as of 09:48, 22 March 2013 by Verbeek (talk | contribs) (Robotino v3)

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 (support for 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)

hostapd configuration

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.27.1.100 to 172.26.1.200.

Configuration:

/etc/network/interfaces

#auto wlan0
iface wlan0 inet static
  address 172.26.1.1
  netmask 255.255.0.0
  #wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

/etc/udev/rules.d/99-wlan.rules

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", KERNEL=="wlan0", RUN+="/usr/bin/at -f /etc/init.d/start-wlan0-master.sh now",
SUBSYSTEM=="net", ACTION=="remove", DRIVERS=="?*", KERNEL=="wlan0", RUN+="/usr/bin/at -f /etc/init.d/stop-wlan0-master.sh now"

/etc/init.d/start-wlan0-master.sh

#!/bin/bash

LOG=/var/log/start-wlan0-master.log

echo "ifup wlan0" > $LOG
/sbin/ifup wlan0 2>>$LOG 1>>$LOG

sleep 2

echo "start hostapd" >> $LOG
/usr/sbin/hostapd -B /etc/hostapd.conf 2>>$LOG 1>>$LOG


sleep 2

echo "start dhcpd" >> $LOG
dhcpd -pf /var/run/dhcpd.pid wlan0 2>>$LOG 1>>$LOG


echo "Finished" >> $LOG

/etc/init.d/stop-wlan0-master.sh

#!/bin/bash

LOG=/var/log/stop-wlan0-master.log

echo "killall dhcpd" > $LOG
killall dhcpd 1>>$LOG 2>>$LOG

echo "killall hostapd" >> $LOG
killall hostapd 1>>$LOG 2>>$LOG

echo "Shutdown wlan0" >> $LOG
/sbin/ifdown wlan0 1>>$LOG 2>>$LOG

echo "Finished" >> $LOG

/lib/udev/rules.d/75-cd-aliases-generator.rules

SUBSYSTEMS=="usb", ATTRS{idVendor}=="057c", ATTRS{idProduct}=="84ff", ACTION=="add", OPTIONS+="ignore_device", GOTO="persistent_cd_end"

/lib/udev/rules.d/60-persistent-storage.rules

SUBSYSTEMS=="usb", ATTRS{idVendor}=="057c", ATTRS{idProduct}=="84ff", ACTION=="add", OPTIONS+="ignore_device", GOTO="persistent_storage_end"