[Voyage-linux] Does the DHCP client ever retry?

Solomon Asare (spam-protected)
Sun Sep 6 17:06:32 HKT 2009


Hi All,
1. I thought the interface coming up is when you are rebooting / starting / ifconfig ethx up / etc., and not when a cable is plugged into the ethernet.

2. testing for the presence of an ip address or a default gateway may be a better test for a successful dhcp lease than reaching a host on the Internet. The failure could be due to reasons other than a failed dhcp lease. You could use something like:
route -n |grep -c ^0.0.0.0
This should give you 1 if your default gateway is set, otherwise 0. A simple setup is envisaged here. You can modify it to meet your requirements.

Rgds,
solomon.
 

--- On Sat, 5/9/09, Gustin Johnson <gustin at echostar.ca> wrote:

> From: Gustin Johnson <gustin at echostar.ca>
> Subject: Re: [Voyage-linux] Does the DHCP client ever retry?
> To: "Tom Billiet" <mouse256 at gmail.com>
> Cc: "'voyage'" <voyage-linux at voyage.hk>
> Date: Saturday, 5 September, 2009, 7:32 PM
> Tom Billiet wrote:
> > Hi,
> > 
> > I'm not very familiar with this either, but if I'm not
> mistaken all the
> > scripts in /etc/network/if-up.d/ are executed if an
> interface comes up
> > (cable being connected). So adding a script for dhcp
> should do the trick.
> > 
> How I have dealt with this in the past is to have a script
> that tests
> for network connectivity, if there is connectivity  it
> does nothing, if
> there test fails it bounced the interface (ifdown ethX
> && ifup ethX).
> 
> The function I use is dead simple to build in bash:
> 
> 
> CheckNet ()
> {
>   ping -c 1 $HOST  >& /dev/null ; #
> Checking connectivity
> }
> 
> You may want to use hping to specify the interface...
> 
> CheckNet ()
> {
>   hping3 -I ethX -c 1 $HOST  >& /dev/null
> ; # Checking connectivity
> }
> 
> $HOST is something that I define and is a host that I know
> will be up.
> 
> Google works great for an ICMP echo request test.
> 
> 
> The above goes into a script that is run by cron every 5
> minutes or so.
> 
> Hope this helps,
> __
> G
> 
> > Regards,
> > Tom
> > 
> > Robert Rawlins - Think Blue wrote:
> >> Yeah Jon this is something I'd be keen to
> understand as well. I have
> >> clients
> >> that get booted without a network connection and
> then when we need to
> >> perform maintenance we connect it to the network
> however at present we
> >> have
> >> to reboot the system as the system doesn't attempt
> to lease an IP when
> >> the
> >> cable is connected.
> >>
> >> I'd be interested to get this working.
> >>
> >> Rob
> >>
> >> -----Original Message-----
> >> From:
> >> voyage-linux-bounces+robert.rawlins=thinkbluemedia.co.uk at list.voyage.hk
> >> [mailto:voyage-linux-bounces+robert.rawlins=thinkbluemedia.co.uk at list.voyage
> >>
> >> .hk] On Behalf Of Jon Trauntvein
> >> Sent: 04 September 2009 22:37
> >> To: voyage
> >> Subject: [Voyage-linux] Does the DHCP client ever
> retry?
> >>
> >> I have been testing the case where the computer
> boots without having a
> >> valid network connection which is restored at some
> point afterward.  I
> >> have noticed in this case that, after several
> retries, the DHCP client
> >> gives up while booting is taking place.  This
> is expected.  The
> >> problem is that I don't see it ever attempt to
> reconfigure again.  Is
> >> there a way to make this happen?
> >>
> 
> 
> -----Inline Attachment Follows-----
> 
> _______________________________________________
> Voyage-linux mailing list
> Voyage-linux at list.voyage.hk
> http://list.voyage.hk/mailman/listinfo/voyage-linux
> 




More information about the Voyage-linux mailing list