[driverloader] an idea to resolve the DHCP problem
alex.oger at free.fr
alex.oger at free.fr
Wed Jun 2 23:26:22 EDT 2004
hello everybody
i've resolved the DHCP problem on my laptop (like lots of people using
driverloader, static IPs are working well but DHCP client couldn't receive an IP)
so, i've modified the ifup-wireless script on my mdk 9.2 (i think many distros
have this script). now, when U plug the card, 50 to 60 later U have an IP
delivered by the DHCP server.
I 've just added 6 lines at the end of the script
first i force a static ip on the card (like 192.168.0.Z)
second i ping an ip for 40 times in the range of the card (like 192.168.0.230)
(the IP don't have to exist, it must be just in the same subnet)
after i put a ifconfig thedevice down
i put a ifconfig $DEVICE $IPADDR $NETMASK (parameters from the ifcfg-ethX file
in case of an static IP config)
and finally a ifconfig $DEVICE up
(the dhclient command will be execute automatically after)
with this script both static and dhcp IPs are working.
an example of ifcfg-ethx config file (i had a parameter SECUMODE for encryption
mode, this parameter is used by the ifup-wireless script)
DEVICE=eth1
ONBOOT=yes
MII_NOT_SUPPORTED=yes
BOOTPROTO='DHCP'
IPADDR=192.168.1.4
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
WIRELESS=yes
ESSID='hhhhhhh'
RATE=54
CHANNEL=4
MODE=Managed
KEY='s:hhhhhhhhh'
SECUMODE=open
note the BOOTPROTO is in DHCP but i don't remove the static config it's used by
the ifup-wireless script
and now the ifup-wireless script
#!/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
# IWPRIV: Extra parameters to pass directly to IWPRIV
# Only meant to be called from ifup
#rajout perso
ifconfig $DEVICE down
sleep 2
# Mode need to be first : some settings apply only in a specific mode !
if [ -n "$MODE" ] ; then
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`
iwconfig $DEVICE nick "$NICKNAME" >/dev/null 2>&1
fi
# Regular stuff...
if [ -n "$NWID" ] ; then
iwconfig $DEVICE nwid $NWID
fi
if [ -n "$FREQ" -a "$MODE" != "Managed" ] ; then
iwconfig $DEVICE freq $FREQ
elif [ -n "$CHANNEL" -a "$MODE" != "Managed" ] ; then
iwconfig $DEVICE channel $CHANNEL
fi
if [ -n "$SENS" ] ; then
iwconfig $DEVICE sens $SENS
fi
if [ -n "$RATE" ] ; then
iwconfig $DEVICE rate $RATE
fi
if [ -n "$RTS" ] ; then
iwconfig $DEVICE rts $RTS
fi
if [ -n "$FRAG" ] ; then
iwconfig $DEVICE frag $FRAG
fi
if [ -n "$KEY" ] ; then
iwconfig $DEVICE key "$KEY" $SECUMODE
else
iwconfig $DEVICE key off
fi
# More specific parameters passed directly to IWCONFIG
if [ -n "$IWCONFIG" ] ; then
iwconfig $DEVICE $IWCONFIG
fi
if [ -n "$SPYIPS" ] ; then
for IP in $SPYIPS; do
iwspy $DEVICE + $IP
done
fi
if [ -n "$IWPRIV" ] ; then
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
iwconfig $DEVICE essid "$ESSID"
else
# use any essid
iwconfig $DEVICE essid any
fi
sleep 5
#a little ugly but it works...
ifconfig $DEVICE up
ifconfig $DEVICE 192.168.0.230 netmask 255.255.255.0
ping -c 40 192.168.0.1 > /dev/null
ifconfig $DEVICE down
ifconfig $DEVICE $IPADDR $NETMASK
ifconfig $DEVICE up
# script end
:-))
i wrote another script using xdialog for creating ifcfg-ethx config files (i
don't trust in drakeconnect ......)
bye
More information about the driverloader
mailing list