Fail to retrieve IP address with DHCP on start-up

Live forum: http://rt2x00.serialmonkey.com/viewtopic.php?t=4919

Strider

28-07-2008 11:41:08

Hello,

since i installed my USB wireless adapter I've the problem that my adapter does not receive an IP address on startup via DHCP. However, when I shutdown the start up the interface via 'ifdown/ifup' in a terminal window, it does receive an IP address (after some seconds) and I'm connected. Using dhclient on the interface won't help and does

My software set-up
Unix kernel 2.6.24-19
OS Ubuntu Hardy 8.04
rt73 driver rt73-cvs-2008072805 (I made a fresh download today but that didn't fix the problem)

My hardware set-up
D-link wireless USB adapter WL-G122 ver. C1 wireless connected (using WPAPSK) to a D-link router DI-524 who is connected to a cable modem. The router is configured as DHCP server.

Output from system log

[codemqc1h8xo]Jul 28 12:27:49 yoda dhclient: Internet Systems Consortium DHCP Client V3.0.6
Jul 28 12:27:49 yoda dhclient: Copyright 2004-2007 Internet Systems Consortium.
Jul 28 12:27:49 yoda dhclient: All rights reserved.
Jul 28 12:27:49 yoda dhclient: For info, please visit http://www.isc.org/sw/dhcp/
Jul 28 12:27:49 yoda dhclient:
Jul 28 12:27:50 yoda dhclient: Listening on LPF/wlan0/00:1c:f0:91:38:1a
Jul 28 12:27:50 yoda dhclient: Sending on LPF/wlan0/00:1c:f0:91:38:1a
Jul 28 12:27:50 yoda dhclient: Sending on Socket/fallback
Jul 28 12:27:51 yoda dhclient: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 4
Jul 28 12:27:55 yoda dhclient: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 11
Jul 28 12:28:06 yoda dhclient: DHCPREQUEST of <null address> on wlan0 to 192.168.0.1 port 67
Jul 28 12:28:06 yoda dhclient: send_packet: Network is unreachable
Jul 28 12:28:06 yoda dhclient: send_packet: please consult README file regarding broadcast address.
Jul 28 12:28:06 yoda dhclient: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 11
Jul 28 12:28:13 yoda dhclient: DHCPREQUEST of <null address> on wlan0 to 255.255.255.255 port 67
Jul 28 12:28:17 yoda dhclient: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 5
Jul 28 12:28:27 yoda dhclient: DHCPREQUEST of <null address> on wlan0 to 255.255.255.255 port 67
Jul 28 12:28:33 yoda dhclient: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 3
Jul 28 12:28:35 yoda dhclient: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 6
Jul 28 12:28:42 yoda dhclient: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 13
Jul 28 12:28:55 yoda dhclient: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 9
Jul 28 12:29:04 yoda dhclient: No DHCPOFFERS received.
Jul 28 12:29:04 yoda dhclient: No working leases in persistent database - sleeping.
Jul 28 12:29:40 yoda hcid[5658]: Default passkey agent (:1.19, /org/bluez/passkey) registered
Jul 28 12:29:40 yoda hcid[5658]: Default authorization agent (:1.19, /org/bluez/auth) registered
[/codemqc1h8xo]

Output iwconfig

[codemqc1h8xo]lo no wireless extensions.

eth0 no wireless extensions.

wlan0 RT73 WLAN ESSID:"My home network" Nickname:"My home network"
Mode:Managed Frequency=2.437 GHz Access Point: 00:1B:11:86:AE:B0
Bit Rate=24 Mb/s
RTS thr:off Fragment thr:off
Link Quality=65/100 Signal level:-74 dBm Noise level:-107 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0

[/codemqc1h8xo]

Help is much appreciated (I'm getting really tired to start up things manually cry ).
Thank you,

Spy84464

28-07-2008 19:32:01

Hello,
Is the system configured to bring the interface up on boot? If "ifup" works, then it should just work.
Please post the content of your "/etc/network/interfaces" file.

Regards,
Romain

Strider

28-07-2008 20:23:55

Romain,

I understand where you're getting but I do have the system configured to bring up at boot time. Here is my /etc/network/interfaces

[code1p7o7gy0]auto lo
iface lo inet loopback


auto wlan0
iface wlan0 inet dhcp
pre-up ifconfig wlan0 up
pre-up iwconfig wlan0 mode managed
pre-up iwconfig wlan0 channel 6
pre-up iwconfig wlan0 essid "My home network"
pre-up iwpriv wlan0 set AuthMode=WPAPSK
pre-up iwpriv wlan0 set EncrypType=TKIP
pre-up iwpriv wlan0 set WPAPSK="My key"
# dhclient wlan0
[/code1p7o7gy0]

I know the dhclient line is put in comment but uncommenting it does not change anything (I assume the fact I specifiy 'iface wlan0 inet dhcp' automatically calls dhclient).
Is there something I should change to the configuration of dhclient ? I havent' done any config on it but when I was using my network wired dchcp worked out of the box.

Regards,

Spy84464

29-07-2008 17:32:01

Perhaps it's the fact that the interface is brought down then up again after having been configured that helps.
Try to add a "pre-up ifconfig wlan0 down" stanza at the end of the file, just to simulate a kind of "ifdown/ifup" cycle.
I know that doesn't make a lot of sense, but this kind of weirdness is common with the legacy drivers (hence the development of rt2x00 ;)).

Strider

30-07-2008 22:31:48

Romain,

I changed my /etc/network/interfaces to the following
[code39nrq5ay]auto lo
iface lo inet loopback


auto wlan0
iface wlan0 inet dhcp
pre-up iwconfig wlan0 essid "My home network"
pre-up iwconfig wlan0 mode managed
pre-up iwconfig wlan0 channel 6
pre-up iwpriv wlan0 set AuthMode=WPAPSK
pre-up iwpriv wlan0 set EncrypType=TKIP
pre-up iwpriv wlan0 set WPAPSK="Bond_007"
pre-up ifconfig wlan0 down
[/code39nrq5ay]

However, it still does not work. I also tried bringing the interface down & up in the line just after iface, but that didn't help either.

Then I came accross this thread
[url39nrq5ay]http://ubuntuforums.org/showpost.php?p=5468482&postcount=1172[/url39nrq5ay]

I did as mentioned but rutilt prompt me for a root password at startup. Also I have to configure for each user using this computer (bummer ...). Is there a way to start-up rutilt at boot time (with the -e option maybe) ? If I use rutilt, should I strip down my /etc/network/interfaces file to a strict minimum (just, say, only define the interface wlan0 and don't include iwpriv commands) ?

Regards,

Spy84464

31-07-2008 17:31:03

RutilT asks a password when it's not run as root, but if it is executed through /etc/network/interfaces, that should be no problem.
The "-e" option is indeed what you need, and no additional parameter is required, so you can reduce your "/etc/network/interfaces" to the minimum
[code104syj6m]auto wlan0
iface wlan0 inet static
post-up rutilt -dep profile_name[/code104syj6m]
Notice "static", RutilT should start dhclient on its own.

The profiles file will be searched in root's home directory (~root/.config/rutilt/ precisely), so you won't need to configure things for every users.

Vern

31-07-2008 20:36:39

Strider

Wrt. the first version of /etc/network/interfaces you posted you might try making the essid the last pre-up command you do. The reason is that that is what kicks off the scan looking for APs to join up to, using the key data, etc. it currently has.

Thanks,

Strider

01-08-2008 07:17:38

Romain,

in the mean while I did some digging in other posts on this forum and adapted my etc/network/interfaces as follows

[code2e7sycwz]auto lo
iface lo inet loopback


auto wlan0
#iface wlan0 inet dhcp
# pre-up iwconfig wlan0 essid "My home network"
# pre-up iwconfig wlan0 mode managed
# pre-up iwconfig wlan0 channel 6
# pre-up ifconfig wlan0 down
# pre-up iwpriv wlan0 set AuthMode=WPAPSK
# pre-up iwpriv wlan0 set EncrypType=TKIP
# pre-up iwpriv wlan0 set WPAPSK="Bond_007"
# pre-up rutilt wlan0 -dep "My wireless"
iface wlan0 inet manual
pre-up ifconfig wlan0 up
pre-up iwconfig wlan0 essid "My home network"
up HOME=/root rutilt wlan0 -dep "My wireless"

[/code2e7sycwz]

This indeed does not require a root password but the sad thing is that I'm off where I started I still don't get an IP address at start-up. This is my syslog

[code2e7sycwz]Aug 1 08:51:35 yoda dhclient: Internet Systems Consortium DHCP Client V3.0.6
Aug 1 08:51:35 yoda dhclient: Copyright 2004-2007 Internet Systems Consortium.
Aug 1 08:51:35 yoda dhclient: All rights reserved.
Aug 1 08:51:35 yoda dhclient: For info, please visit http://www.isc.org/sw/dhcp/
Aug 1 08:51:35 yoda dhclient:
Aug 1 08:51:36 yoda dhclient: Listening on LPF/wlan0/00:1c:f0:91:38:1a
Aug 1 08:51:36 yoda dhclient: Sending on LPF/wlan0/00:1c:f0:91:38:1a
Aug 1 08:51:36 yoda dhclient: Sending on Socket/fallback
Aug 1 08:51:38 yoda dhclient: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 5
Aug 1 08:51:43 yoda dhclient: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 14
Aug 1 08:51:57 yoda dhclient: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 12
Aug 1 08:51:58 yoda dhclient: DHCPREQUEST of <null address> on wlan0 to 192.168.0.1 port 67
Aug 1 08:51:58 yoda dhclient: send_packet: Network is unreachable
Aug 1 08:51:58 yoda dhclient: send_packet: please consult README file regarding broadcast address.
Aug 1 08:52:06 yoda dhclient: DHCPREQUEST of <null address> on wlan0 to 255.255.255.255 port 67
Aug 1 08:52:14 yoda dhclient: DHCPREQUEST of <null address> on wlan0 to 255.255.255.255 port 67
Aug 1 08:52:23 yoda dhclient: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 4
Aug 1 08:52:27 yoda dhclient: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 10
Aug 1 08:52:37 yoda dhclient: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 8
Aug 1 08:52:45 yoda dhclient: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 9
Aug 1 08:52:54 yoda dhclient: No DHCPOFFERS received.
Aug 1 08:52:54 yoda dhclient: No working leases in persistent database - sleeping.[/code2e7sycwz]

If I then use RutilT in Gnome to start up my connection by applying the profile "My wireless" that I defined (and called earlier in /etc/network/interfaces), I immediately get a connection ... FYI here is what is then recorded in the syslog
[code2e7sycwz]Aug 1 08:54:57 yoda dhclient: There is already a pid file /var/run/dhclient.pid with pid 6273
Aug 1 08:54:57 yoda dhclient: removed stale PID file
Aug 1 08:54:57 yoda dhclient: Internet Systems Consortium DHCP Client V3.0.6
Aug 1 08:54:57 yoda dhclient: Copyright 2004-2007 Internet Systems Consortium.
Aug 1 08:54:57 yoda dhclient: All rights reserved.
Aug 1 08:54:57 yoda dhclient: For info, please visit http://www.isc.org/sw/dhcp/
Aug 1 08:54:57 yoda dhclient:
Aug 1 08:54:58 yoda dhclient: Listening on LPF/wlan0/00:1c:f0:91:38:1a
Aug 1 08:54:58 yoda dhclient: Sending on LPF/wlan0/00:1c:f0:91:38:1a
Aug 1 08:54:58 yoda dhclient: Sending on Socket/fallback
Aug 1 08:54:59 yoda dhclient: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 4
Aug 1 08:55:00 yoda dhclient: DHCPOFFER of 192.168.0.110 from 192.168.0.1
Aug 1 08:55:00 yoda dhclient: DHCPREQUEST of 192.168.0.110 on wlan0 to 255.255.255.255 port 67
Aug 1 08:55:00 yoda dhclient: DHCPACK of 192.168.0.110 from 192.168.0.1
Aug 1 08:55:00 yoda dhclient: bound to 192.168.0.110 -- renewal in 497885 seconds.[/code2e7sycwz]

Some other things I'm gonna try
- use of the interfaces command as you posted (although I think this is little different). By the way, did you notice I had to use the 'HOME=/root' option when I invoke RutilT ? Otherwhise you get error (I found this in the other post mentioned earlier)
- try ou what Vern suggested
- last solution tweak init.d so that I does startup wlan0 at first and at the end do a restart of the interface. This will require some research ...

I'll keep you posted

Spy84464

01-08-2008 21:48:19

By the way, did you notice I had to use the 'HOME=/root' option when I invoke RutilT ? Otherwhise you get error (I found this in the other post mentioned earlier)[/quote3jk57490]
I thought I had fixed that, thanks for the head-up.
Instead of tweaking init.d, adding the relevant lines in "/etc/rc.local" may just work, I assume that script is executed last (I may be wrong).

Strider

03-08-2008 21:11:03

Romain,

1) I'm using v 0.16 as distributed by Ubuntu, maybe you fixed it in 0.17 ?
2) /etc/rc.local script indeed solved all my problems ! In this post I explained everything
[url148dswbb]http://ubuntuforums.org/showpost.php?p=5517482&postcount=12[/url148dswbb] (I'm samwisgg in that forum 8) ). By the way you might be glad to know that I used RutilT all the way ... (in the /etc/network/interfaces file and as a program to start up in the system tray).

Regards,

jaak

04-08-2008 19:32:47

I've had the same problem (Ubuntu 8.04), but what I did instead of mess with rc.local or restart networking was just to add an essid configuration line to interfaces, eg

[list2v1b9iue]iface wlan0 inet manual
[list2v1b9iue][b2v1b9iue]wireless-essid your_profile_essid[/b2v1b9iue]
pre-down dhclient -r wlan0
post-down ifconfig wlan0 down
post-up sudo rutilt wlan0 -dep your_profile[/listu2v1b9iue]
[/listu2v1b9iue]

Make sure the essid is the same as you're using in your rutilt profile, otherwise it exhibits the problem. (You could also use [b2v1b9iue]post-up iwconfig wlan0 essid your_profile_essid[/b2v1b9iue] before the line calling rutilt.) So far it's worked every time.

Spy84464

04-08-2008 20:37:50

Good to hear you sorted that out. )
v0.17 is hardly different than v0.16, just a few headers changed to make the program compilable again with recent gcc releases.
I'll include a fix in the next version, which I hope, should come next week.

Strider

04-08-2008 20:58:13

Jaak,

was is exactly the meaning of the line 'post down ifconfig wlan0 down' ?

Regards

jaak

04-08-2008 23:52:55

Strider,

Since the method is marked as manual (iface wlan0 inet manual), you have to bring the interface up or down by hand.

However, /etc/network/if-pre-up.d/wireless-tools automatically brings the interface up anyway, but the corresponding /etc/network/if-post-down.d/wireless-tools doesn't bring it down. I don't really know the reason behind this (probably a fix for some wireless interfaces that can't be configured if they are down).

The 'post-down ifconfig wlan0 down' takes the interface offline, I just have it for completeness.

Spy84464

25-08-2008 21:59:51

Hello guys,
If one of you is still around, can you confirm me that 'HOME=/root' is no longer needed in the startup script with the just-released RutilT v0.18?

Thank you for your help,
Romain