Next Previous Contents

5. Beispieldateien

5.1 wpasupplicant unter Ubuntu 6.06

Die hier gegebenen Beispieldateien stammen aus Ubuntu 5.10 und wurden z.T. angepaßt.

/etc/wpasupplicant.conf

# Minimal /etc/wpa_supplicant.conf for two access points
# one encrypted and another one open.
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
eapol_version=1
ap_scan=1
fast_reauth=1
### Associate with an open access point
network={
        ssid="WIDEOPEN"
        key_mgmt=NONE
}
network={
        ssid="WEPCRYPT"
        key_mgmt=NONE
        wep_key0=1234567890ABCDEF1234567890
        priority=5      # If we have a choice, choose this network
        scan_ssid=1     # If e.g. ESSID-Broadcast is disabled
}

/etc/default/wpasupplicant

# WARNING! Make sure you have a configuration file!
ENABLED=1
# Useful flags:
#  -D <driver>          Wireless drive, typically optional.
#  -i <ifname>          Interface
#  -c <config file>     Configuration file
#  -d                   Debugging (-dd for more)
#  -w                   Wait for interface to come up
# See the manual page wpa_supplicant(1) for more options and information.
OPTIONS="-i wlan0 -D hostap -c /etc/wpa_supplicant.conf -w"

/etc/init.d/wpasupplicant

#!/bin/sh
# Buyer beware! This is really only useful if you have a
# MiniPCI or other permanent wireless device.
# However, the wpa_supplicant daemon will start, and sit waiting
# for the name interface to come up. Therefore, if you want to use
# this with pcmcia or other nonsense, it may be best to ifrename
# your wireless interface if it has an "ethX" name that is variable.
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/sbin/wpa_supplicant
PIDFILE="/var/run/wpasupplicant.pid"
CONFIG="/etc/wpa_supplicant.conf"
PNAME="wpa_supplicant"
# insane defaults
OPTIONS="-Bw" # daemonize and wait for interface
ENABLED=1
[ -f /etc/default/wpasupplicant ] && . /etc/default/wpasupplicant
if [ "$ENABLED" = "0" ]; then
        echo "wpasupplicant: disabled, see /etc/default/wpasupplicant"
        exit 0;
fi
[ -f $CONFIG ] || ( echo "No configuration file found, not starting."; \
        exit 1; )
[ -f $DAEMON ] || exit 0
set -e
case "$1" in
        start)
                echo -n "Starting wpa_supplicant: "
                start-stop-daemon --start --name $PNAME \
                        --oknodo --startas $DAEMON -- -B $OPTIONS
                echo "done."
                ;;
        stop)
                echo -n "Stopping wpa_supplicant: "
                start-stop-daemon --stop --name $PNAME \
                        --oknodo
                echo "done."
                if [ -f $PIDFILE ]; then
                        rm -f $PIDFILE;
                fi
                ;;
        reload|force-reload)
                echo -n "Reloading wpa_supplicant: "
                start-stop-daemon --stop --signal HUP \
                        --name $PNAME
                echo "done."
                ;;
        restart)
                echo -n "Restarting wpa_supplicant: "
                start-stop-daemon --stop --name $PNAME \
                        --retry 5 --oknodo
                if [ -f $PIDFILE ]; then
                        rm -f $PIDFILE;
                fi
                start-stop-daemon --start --name $PNAME \
                        --oknodo --startas $DAEMON -- -B $OPTIONS
                echo "done."
                ;;
        *)
                echo "Usage: wpa_supplicant {start|stop|restart|reload|force-reload}" >&2
                exit 1
                ;;
esac
exit 0


Next Previous Contents