Sponsored Content
Top Forums Shell Programming and Scripting WLAN receiving DHCP-IP Address doesn't work Post 302820745 by zitronenschwarz on Thursday 13th of June 2013 11:26:16 AM
Old 06-13-2013
Signal WLAN receiving DHCP-IP Address doesn't work

Hey guys,

I run my raspberry pi with a TP-Link Wlan-USB stick. The stick works out of the box with the pi-modded debian.

But eventhough the automatic connection to one of the saved WLAN-networks in the file /etc/wpa_supplicant/wpa_supplicant.conf works, my PI doesn't request or receive an IP-address (automatically).

I always have to login via ethernet and do a
Code:
sudo dhclient wlan0

manually.
Why?

I thought "well, whatever, no problem, I write a cronjob which runs this command every couple of minutes". But this doesn't solve the issue neither...

Please let me know what could be a better solution.

My script (not working when run as cronjob but manually it does):
Code:
#!/bin/bash

if [ `lsusb|grep WLAN|wc -l` -gt 0 ];
then
        if [ `iwconfig wlan0|head -n 1|tr -s " "|cut -d" " -f2` = "unassociated" ];
        then
                wpa_action wlan0 stop
                wpa_action wlan0 reload
                ifup wlan0
                #wpa_supplicant -i wlan0 -D wext -c /etc/wpa_supplicant/wpa_supplicant.conf -B
                #dhclient wlan0
        else
                if [ `iwconfig wlan0|head -n 1|tr -s " "|cut -d" " -f2` = "IEEE" ];
                then
                        if  [ `ifconfig wlan0|grep "inet addr"|tr -s " "|tr " " ":"|cut -d: -f 4|wc -m` = 0 ];
                        then
                                dhclient wlan0
                                for I in 1-4; do
                                        ping -c 1 google.com >/dev/null
                                done
                                if  [  ! `ifconfig wlan0|grep "inet addr"|tr -s " "|tr " " ":"|cut -d: -f 4|wc -m` -gt 10 ] && [ ! `ifconfig wlan0|grep "inet addr"|tr -s " "|tr " " ":"|cut -d: -f 4|wc -m` -lt 16 ];
                                then
                                         ifdown wlan0
                                fi
                        else
                                echo "`date`: WLAN0 - online `ifconfig wlan0|grep "inet addr"|tr -s " "|tr " " ":"|cut -d: -f 4`"
                        fi
                fi
        fi
fi

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Script doesn't work, but commands inside work

Howdie everyone... I have a shell script RemoveFiles.sh Inside this file, it only has two commands as below: rm -f ../../reportToday/temp/* rm -f ../../report/* My problem is that when i execute this script, nothing happened. Files remained unremoved. I don't see any error message as it... (2 Replies)
Discussion started by: cheongww
2 Replies

2. Shell Programming and Scripting

How to grep dhcp ip address

Hi, I have a script that my operators use as a login profile. As they need to export their display in order to access the GUI of the data protector program in HPUX machine. Anyone can advise how I can grep (eg. who -r) the dynamically assigned IP address and automatically put it as a variable... (4 Replies)
Discussion started by: chongkls77
4 Replies

3. Solaris

Unix terminal re-assigned with wrong IP address from window's DHCP

Hi all, I have this problem that puzzles me, i have setup all the right DHCP configuration in Windows Server. The reservation IP address in windows for this specific unix terminal. However, when i rebooted the unix terminal the IP which was already assigned for this box somehow change to a total... (0 Replies)
Discussion started by: tlee
0 Replies

4. IP Networking

dhcp configuration for MAC address

hi I need a dhcp congfigured to give some of my clients IP regarding their MAC addresses and rest should get any IP from same pool. I am not sure what to add dhcpd.conf to provide such a pool or group or class. I tried with this but seems not good enough. <<<<dhcpd.conf>>>> ... (2 Replies)
Discussion started by: ouzist
2 Replies

5. UNIX for Advanced & Expert Users

How to get DHCP address change event notification programmatically?

Hello Experts, I am working on a software that has network client-server architecture. I need to have a mechanism that notifies me upon change of dhcp address change locally or at remote machine. Windows have IP Helper APIs to get address change notification. Is there something similar in Unix?... (3 Replies)
Discussion started by: GajendraSharma
3 Replies

6. Debian

Question on the dhcp-server configuration for a fixed IP address.

Hi , when i configure my server with a fixed ip address in dhcpd.conf as below subnet 172.21.151.0 netmask 255.255.255.0 { range 172.21.151.66 172.21.151.66; } host switch { hardware ethernet 00:05:30:02:DB:31; fixed-address 172.21.151.66; } when i start dhcpd server , it... (2 Replies)
Discussion started by: Gopi Krishna P
2 Replies

7. UNIX for Advanced & Expert Users

Doubt on fixed ip address assinged by dhcp server?

we can assign a dynamic and fixed ip address for a dhcp_client through dhcp server , if it is dynamic ip address , it would be having lease time and renews after half of the leasetime gets over. would the same funda applies for fixed ip address to .. i dont think so ... please confirm on the... (3 Replies)
Discussion started by: Gopi Krishna P
3 Replies

8. Red Hat

DHCP Server address

Where can you find your DHCP Server address? I checked all of the files that this mentioned with no luck. Quick HOWTO : Ch08 : Configuring the DHCP Server - Linux Home Networking (6 Replies)
Discussion started by: cokedude
6 Replies

9. Red Hat

Purpose of Static IP address through DHCP

Hi All, Could you please explain the purpose of assigning the static IP by using the DHCP Concept. Like by using the clients MAC address we assign the static IP Address. Waiting for your reply. Thanks in Advance. (6 Replies)
Discussion started by: Sharath Kumar
6 Replies

10. IP Networking

Get DHCP relay interfaces IP address using DHCP

Hi All , please view the set up below: ------------------------------------------------------------------- | DHCP Server |-----------| ROUTER & |-----------| Clients | | 192.168.99.1 | - -<eth1>| DHCP-RELAY|<eth2>-- | 192.168.88.X | ... (2 Replies)
Discussion started by: gdangoor
2 Replies
WPI(4)							   BSD Kernel Interfaces Manual 						    WPI(4)

NAME
wpi -- Intel 3945ABG Wireless LAN IEEE 802.11 driver SYNOPSIS
To compile this driver into the kernel, place the following lines in your kernel configuration file: device wpi device wpifw device pci device wlan device wlan_amrr device firmware Alternatively, to load the driver as a module at boot time, place the following line in loader.conf(5): if_wpi_load="YES" DESCRIPTION
The wpi driver provides support for the Intel 3945ABG Wireless network adapter wpi supports station, adhoc, and monitor mode operation. Only one virtual interface may be configured at any time. For more information on configuring this device, see ifconfig(8). This driver requires the firmware built with the wpifw module to work. FILES
/usr/share/doc/legal/intel_wpi/LICENSE wpi firmware license EXAMPLES
Join an existing BSS network (i.e., connect to an access point): ifconfig wlan0 create wlandev wpi0 inet 192.168.0.20 netmask 0xffffff00 Join a specific BSS network with network name ``my_net'': ifconfig wlan0 create wlandev wpi0 ssid my_net up Join a specific BSS network with 64-bit WEP encryption: ifconfig wlan0 create wlandev wpi0 ssid my_net wepmode on wepkey 0x1234567890 weptxkey 1 up Join a specific BSS network with 128-bit WEP encryption: ifconfig wlan0 create wlandev wpi0 wlanmode adhoc ssid my_net wepmode on wepkey 0x01020304050607080910111213 weptxkey 1 DIAGNOSTICS
wpi%d: could not load firmware image '%s' The driver failed to load the firmware image using the firmware(9) subsystem. Verify the wpifw firmware module is installed. wpi%d: fatal firmware error An unknown error has occurred in the uploaded firmware, you may have to unload/reload the driver to continue. wpi%d: Radio transmitter is switched off The hardware switch controlling the radio is currently turned off. Data transmission is not possi- ble in this state. BUGS
Not all the error messages are documented here. Background scanning is not currently supported. SEE ALSO
wpifw(4), pci(4), wlan(4), wlan_ccmp(4), wlan_tkip(4), wlan_wep(4), ifconfig(8), wpa_supplicant(8). AUTHORS
The original wpi driver was written for OpenBSD by Damien Bergamini <damien.bergamini@free.fr>. Benjamin Close <benjsc@FreeBSD.org> ported wpi to FreeBSD. BSD
October 5, 2008 BSD
All times are GMT -4. The time now is 10:40 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy