You are not logged in.

#1 2011-06-04 10:01:04

Lars Stokholm
Member
From: Denmark
Registered: 2009-03-17
Posts: 223

[Solved (sort of)] Netcfg/dhcpcd sometimes fail to make a connection

Sometimes Netcfg has trouble making a connection to my wireless network - is been a problem with two different routers and two different laptops, so I don't think it's a hardware issue.

I've done a little research (as much as I can) and I think I've found that dhcpcd is the culprit. I've piped the output of dhcpcd from /usr/lib/network/connections/ethernet and this is what it gives me when it fails:

dhcpcd[1329]: version 5.2.12 starting
dhcpcd[1329]: wlan0: using hwaddr 00:24:d7:98:de:b4
dhcpcd[1329]: wlan0: executing `/usr/lib/dhcpcd/dhcpcd-run-hooks', reason PREINIT
dhcpcd[1329]: wlan0: executing `/usr/lib/dhcpcd/dhcpcd-run-hooks', reason CARRIER
dhcpcd[1329]: wlan0: reading lease `/var/lib/dhcpcd/dhcpcd-wlan0.lease'
dhcpcd[1329]: wlan0: rebinding lease of 192.168.0.2
dhcpcd[1329]: wlan0: sending REQUEST (xid 0xca401306), next in 4.76 seconds
dhcpcd[1329]: wlan0: sending REQUEST (xid 0xca401306), next in 8.63 seconds
dhcpcd[1329]: timed out

After that dhcpcd isn't running. Running dhcpcd manually always gives me a connection:

[root@x201 ~]# dhcpcd -B
dhcpcd[23337]: version 5.2.12 starting
dhcpcd[23337]: wlan0: rebinding lease of 192.168.0.2
dhcpcd[23337]: eth0: waiting for carrier
dhcpcd[23337]: wlan0: broadcasting for a lease
dhcpcd[23337]: wlan0: offered 192.168.0.2 from 192.168.0.1
dhcpcd[23337]: wlan0: acknowledged 192.168.0.2 from 192.168.0.1
dhcpcd[23337]: wlan0: checking for 192.168.0.2
dhcpcd[23337]: wlan0: leased 192.168.0.2 for 86400 seconds

Here's my Netcfg profile:

CONNECTION='wireless'
INTERFACE='wlan0'
SECURITY='wpa'
ESSID='stokholm'
KEY='my_passphrase'
IP='dhcp'

What gives?

Last edited by Lars Stokholm (2011-06-05 16:07:49)

Offline

#2 2011-06-05 16:06:31

Lars Stokholm
Member
From: Denmark
Registered: 2009-03-17
Posts: 223

Re: [Solved (sort of)] Netcfg/dhcpcd sometimes fail to make a connection

Apparently the router sometimes takes a lot of time to offer a lease - so it seems at least:

Jun  5 17:56:44 localhost dhcpcd[1214]: version 5.2.12 starting
Jun  5 17:56:45 localhost dhcpcd[1214]: wlan0: rebinding lease of 192.168.0.2
Jun  5 17:56:55 localhost dhcpcd[1214]: wlan0: broadcasting for a lease
Jun  5 17:58:59 localhost dhcpcd[1214]: wlan0: offered 192.168.0.2 from 192.168.0.1
Jun  5 17:58:59 localhost dhcpcd[1214]: wlan0: acknowledged 192.168.0.2 from 192.168.0.1
Jun  5 17:59:00 localhost dhcpcd[1214]: wlan0: checking for 192.168.0.2
Jun  5 17:59:05 localhost dhcpcd[1214]: wlan0: leased 192.168.0.2 for 86400 seconds
Jun  5 17:59:06 localhost dhcpcd[1214]: forked to background, child pid 5224

Look at the times. Almost two minutes before an offer is recieved.

Increasing DHCP_TIMEOUT helps but I still don't understand why the offer is so late.

Offline

#3 2011-06-06 00:28:16

Mektub
Member
From: Lisbon /Portugal
Registered: 2008-01-02
Posts: 647

Re: [Solved (sort of)] Netcfg/dhcpcd sometimes fail to make a connection

Lars,

have you tried dhclient instead ?

put the line

DHCLIENT=yes

somewhere in your profile.

You must have dhclient installed.

Mektub


Follow me on twitter: https://twitter.com/johnbina

Offline

#4 2011-06-06 05:17:48

Lars Stokholm
Member
From: Denmark
Registered: 2009-03-17
Posts: 223

Re: [Solved (sort of)] Netcfg/dhcpcd sometimes fail to make a connection

Not yet, but I'll keep it in mind. Thanks.

Offline

#5 2011-09-04 16:27:05

cgarcia
Member
Registered: 2010-08-09
Posts: 39

Re: [Solved (sort of)] Netcfg/dhcpcd sometimes fail to make a connection

Sometimes dhcpcd repeatedly failed to get the IP (errors logged as  "rebinding lease of..." -> "reject NAK via..."). This was very annoying because forced me to setup sets of static IPs for these situations.

I discovered that manually erasing /var/lib/dhcpcd (with files from previous days) a successful IP negotiation was achieved. It seems that dhcpcd is broken in some way (or at least not robust enough). I have switched to dhclient with the proper setting (placing DHCLIENT=yes in the network profile). Maybe netcfg should remove the dhcpcd dependency and automatically use dhclient when installed.

Offline

#6 2012-06-08 18:32:22

deadshox
Member
Registered: 2009-08-25
Posts: 35

Re: [Solved (sort of)] Netcfg/dhcpcd sometimes fail to make a connection

Mektub wrote:

Lars,

have you tried dhclient instead ?

put the line

DHCLIENT=yes

somewhere in your profile.

You must have dhclient installed.

Mektub

Big thanks, that sloves the problem for me too. smile

Offline

#7 2012-06-08 18:34:09

Inxsible
Forum Fellow
From: Chicago
Registered: 2008-06-09
Posts: 9,183

Re: [Solved (sort of)] Netcfg/dhcpcd sometimes fail to make a connection

deadshox, please don't necrobump threads especially not for +1 type of post.


Forum Rules

There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !

Offline

Board footer

Powered by FluxBB