[sf-lug] Getting wireless working

Ken Shaffer kenshaffer80 at gmail.com
Mon Jan 4 13:02:23 PST 2010


Here's the old RedHat ifup-wireless script below.  There used to be a config
file per interface to set the variables.
Ken
--------------------
#!/bin/bash
# Network Interface Configuration System
# Copyright (c) 1996-2002 Red Hat, Inc. all rights reserved.
#
# Based on PCMCIA wireless script by (David Hinds/Jean Tourrilhes)
#
# This software may be freely redistributed under the terms of the GNU
# public license.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# Configure wireless network device options.  See iwconfig(8) for more info.
# Valid variables:
#    MODE: Ad-Hoc, Managed, etc.
#    ESSID: Name of the wireless network
#    NWID: Name of this machine on the network.  Hostname is default
#    FREQ: Frequency to operate on.  See CHANNEL
#    CHANNEL: Numbered frequency to operate on.  See FREQ
#    SENS: Sensitivity threshold for packet rejection.
#    RATE: Transfer rate.  Usually one of Auto, 11, 5, 2, or 1.
#    KEY: Encryption key for WEP.
#    RTS: Explicit RTS handshake.  Usually not specified (auto)
#    FRAG: Fragmentation threshold to split packets.  Usually not specified.
#    SPYIPS: List of IP addresses to "spy" on for link performance stats.
#    IWCONFIG: Extra parameters to pass directly to IWCONFIG
#    SECURITYMODE: Security mode, e.g: 'open' or 'restricted'
#    IWPRIV: Extra parameters to pass directly to IWPRIV

# Only meant to be called from ifup.

# Mode need to be first : some settings apply only in a specific mode !
if [ -n "$MODE" ] ; then
    /sbin/iwconfig $DEVICE mode $MODE
fi
# This is a bit hackish, but should do the job right...
if [ -n "$ESSID" -o -n "$MODE" ] ; then
    NICKNAME=`/bin/hostname`
    /sbin/iwconfig $DEVICE nick "$NICKNAME" >/dev/null 2>&1
fi
# Regular stuff...
if [ -n "$NWID" ] ; then
    /sbin/iwconfig $DEVICE nwid $NWID
fi
if [ -n "$FREQ" -a "$MODE" != "Managed" ] ; then
    /sbin/iwconfig $DEVICE freq $FREQ
elif [ -n "$CHANNEL" -a "$MODE" != "Managed" ] ; then
    /sbin/iwconfig $DEVICE channel $CHANNEL
fi
if [ -n "$SENS" ] ; then
    /sbin/iwconfig $DEVICE sens $SENS
fi
if [ -n "$RATE" ] ; then
    /sbin/iwconfig $DEVICE rate "$RATE"
fi
if [ -n "$KEY" -o -n "$KEY1" -o -n "$KEY2" -o -n "$KEY3" -o -n "$KEY4" ] ;
then
    [ -n "$KEY1" ] && /sbin/iwconfig $DEVICE key [1] $KEY1
    [ -n "$KEY2" ] && /sbin/iwconfig $DEVICE key [2] $KEY2
    [ -n "$KEY3" ] && /sbin/iwconfig $DEVICE key [3] $KEY3
    [ -n "$KEY4" ] && /sbin/iwconfig $DEVICE key [4] $KEY4
    [ -n "$DEFAULTKEY" ] && /sbin/iwconfig $DEVICE key [${DEFAULTKEY}]
    [ -n "$KEY" ] && /sbin/iwconfig $DEVICE key $KEY
else
    echo no keys
    #/sbin/iwconfig $DEVICE key off
fi
if [ -n "$SECURITYMODE" ]; then
    /sbin/iwconfig $DEVICE enc $SECURITYMODE
fi
if [ -n "$RTS" ] ; then
    /sbin/iwconfig $DEVICE rts $RTS
fi
if [ -n "$FRAG" ] ; then
    /sbin/iwconfig $DEVICE frag $FRAG
fi

# More specific parameters passed directly to IWCONFIG
if [ -n "$IWCONFIG" ] ; then
    /sbin/iwconfig $DEVICE $IWCONFIG
fi

if [ -n "$SPYIPS" ] ; then
    for IP in $SPYIPS; do
    /sbin/iwspy $DEVICE + $IP
    done
fi
if [ -n "$IWPRIV" ] ; then
    /sbin/iwpriv $DEVICE $IWPRIV
fi

# ESSID need to be last : most device re-perform the scanning/discovery
# when this is set, and things like encryption keys are better be
# defined if we want to discover the right set of APs/nodes.
if [ -n "$ESSID" ] ; then
    /sbin/iwconfig $DEVICE essid "$ESSID"
else
    # use any essid
    /sbin/iwconfig $DEVICE essid any >/dev/null 2>&1
fi

if [ "$WPA" = "yes" -a -x /sbin/wpa_supplicant ]; then
  /sbin/wpa_supplicant -Bw -Dwext -c/home/kshaf/Desktop/wpa_supplicant.conf
-i $DEVICE
fi


>> _______________________________________________
>> sf-lug mailing list
>> sf-lug at linuxmafia.com
>> http://linuxmafia.com/mailman/listinfo/sf-lug
>> Information about SF-LUG is at http://www.sf-lug.org/
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://linuxmafia.com/pipermail/sf-lug/attachments/20100104/6788d9f1/attachment.html>


More information about the sf-lug mailing list