LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 04-26-2010, 07:37 PM   #1
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
Skip DHCP request when interface is down


I am sure this is simple, but Google is full of users which cannot get a DHCP address So no matter what search term I use, I only see solutions which do not apply to this problem.

I am running Debian Squeeze on a netbook eeePC 1001P I have a wireless interface and a wired interface defined in /etc/network/interfaces:

Code:
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp
allow-hotplug eth0

auto wlan0
iface wlan0 inet dhcp
wireless-key s:XXXXX
wireless-essid  myessid
Both interfaces WORK! When I have plugged in a cable, eth0 acquires and gets an IP, when I am in reach of the WiFi, wlan0 gets an IP address.

Now when I want to use only wireless, and I have no LAN connected, this is what happens at boot:
Code:
ADDRCONF(NETDEV_UP): eth0: link is not ready
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 3
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 5
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 7
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 24
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 14
No DHCPOFFERS received
... etc
This is fine, however it takes forever (I think 60 seconds) before DHCP decides to time out. That is awkward. This is my wife's computer and I cannot tell her to intervene manually when she is either in Wifi range or on the LAN.

Why is dhclient called when it is detected that eth0 is not ready? How can I disable acquiring a DHCP address on an interface which is not ready?

My idea is that when a link is not ready, acquiring a DHCP address is skipped. How can I configure that? I have looked thru the ifup scripts, but nothing. Where do I see what is happening when the interface is auto eth0?

jlinkels
 
Old 04-27-2010, 02:43 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by jlinkels View Post
(..)it takes forever (I think 60 seconds) before DHCP decides to time out. That is awkward.
No it isn't awkward. But maybe shorter timeout settings can be added to the dhclient configuration file.


Quote:
Originally Posted by jlinkels View Post
How can I disable acquiring a DHCP address on an interface which is not ready?
Editing the script to include a little piece of code that checks device link state (mii-diag or whatever else available) before firing off dhclient else ifplugd or netplugd?
 
Old 04-27-2010, 06:50 AM   #3
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Original Poster
Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
Quote:
Originally Posted by unSpawn View Post
No it isn't awkward. But maybe shorter timeout settings can be added to the dhclient configuration file.
Well, if you have to wait for something while you are sure it is not gonna happen, the time is awkwardly long. Shortening the timeout in dhclient.conf I have tought about, but is not elegant. You don't want to make it too short so proper acquiring can take place, while on the other hand even 5 seconds timeout is long, bearing in mind that everything in the init process has been optimized to shave off tens of seconds.

Quote:
Originally Posted by unSpawn View Post
Editing the script to include a little piece of code that checks device link state (mii-diag or whatever else available) before firing off dhclient else ifplugd or netplugd?
Never heard of mii-diag, but it certainly looks promising. Thanks. And for ifplugd and netplugd, yes these seems to be the appropriate places but I had hoped for something so that I wouldn't have to re-invent the wheel.

jlinkels

Edit: I read through this: http://www.debian.org/doc/manuals/re...fplugd_package
before I posted this question. I must have been very tired not to recognize the solution offered here!

Last edited by jlinkels; 04-27-2010 at 06:57 AM.
 
Old 04-29-2010, 07:35 PM   #4
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Original Poster
Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
Well, it was easy and then again, not.

I found the information for what I wanted to do on this web site: http://www.howtoforge.com/whereami_i...fi_debian_etch

A few remarks on unexpected results or what was not fully clear from this web page.

- To detect wireless, the wlan detection in detect.conf:
Code:
testap  wlan0,<essid>,<wep-key>
worked best for me. Excluding the interface name defaults to eth0 for wireless which is not good. Excluding the essid but not the wep-key gave false positives.
- Even when wireless is detected, you might not be able to obtain a DHCP address on your laptop when the signal is too weak. When I was testing, my wireless quality was 23/70, but that was too low to obtain an address. Closer to the AP the wireless was working well. I didn't find a solution for that and left it that way.
- in the /etc/network/interfaces you must specify
Code:
iface eth0 inet dhcp
iface wlan0 inet dhcp
but you must not include
Code:
auto wlan0
auto eth0
as this brings up the interface and try to acquire a DHCP address at boot time.

jlinkels

Last edited by jlinkels; 04-29-2010 at 07:38 PM.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
DHCP ranges for Virtual Machines?? Skip every 16th address? jjinno Linux - Networking 3 03-23-2010 01:42 PM
ATT Uverse DHCP Not Assigning to Red Interface Interface on Smoothwall barleykorn Linux - Networking 2 02-14-2010 05:12 PM
A DHCP request for an usuable interface. pxumsgdxpcvjm Slackware 2 08-26-2007 04:20 PM
why DHCP client not sending own host name in DHCP request packet? sonika_singhi Linux - Networking 7 05-28-2005 05:18 AM
DHCP skip on boot zchoyt Linux - Newbie 5 08-31-2004 09:17 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 10:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration