Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 6 Jul 2011 21:47:45 +0200
From:      "deeptech71@gmail.com" <deeptech71@gmail.com>
To:        freebsd-hackers@freebsd.org, freebsd-current@freebsd.org
Subject:   Re: what is the RIGHT(TM) way to configure background DHCP?
Message-ID:  <CAF6hryR%2B-ugO28%2BxVhg15XpuQRny_aAeh2m%2BQ3HP16aS8-PwyA@mail.gmail.com>
In-Reply-To: <44k4byunz2.fsf@lowell-desk.lan>
References:  <BANLkTikO7-7vKByU6RPADpV0KmGcR24mPg@mail.gmail.com> <CAF6hryQd%2B=QwkJnVSKp9OyTGLFHkwWuD4aYJBkHh53_pcURqOg@mail.gmail.com> <44k4byunz2.fsf@lowell-desk.lan>

next in thread | previous in thread | raw e-mail | index | archive | help
(i intend the discussion to take place primarily on the
freebsd-hackers list, i'm CCing the freebsd-current list for a reason
stated below.)

(original first post:
http://lists.freebsd.org/pipermail/freebsd-questions/2011-June/231301.html)

On Mon, Jul 4, 2011 at 4:20 PM, Lowell Gilbert <Lowell@be-well.ilk.org> wrote:
> You might want to try rewording your question, because it didn't make
> any sense the first time.

very well. though the question should have made perfect sense the first time.

> [All of your examples were commented out, so
> it was no surprise that they didn't work.]

i chose to use # characters to separate rc.conf snippets from the
other sentences i wrote. though perhaps #s were an unfortunate choice,
because a # has a comment-begins-here meaning in rc.conf. in any case,
"attempt 1" and "attempt 2" didn't work, but "attempt 3" did work, and
that rules out the use of # for comments in rc.conf. now i will use
"===== rc.conf snippet begins =====" and "===== rc.conf snippet ends
=====" instead of # characters.

> I considered trying to use my chrystal ball to guess that you needed
> "SYNCDHCP" in your interface config, but you had obviously read the
> manual for rc.conf(5), so that seemed unlikely...

and "SYNCDHCP" makes things even worse. (i have no idea what
"SYNCDHCP" is supposed to do, but in my experience:) "SYNCDHCP" makes
the boot process wait until DHCP server replies before proceeding.
"SYNCDHCP" is actually almost the same as "DHCP", except that
"SYNCDHCP" waits indefinitely, while "DHCP" waits for at most
defaultroute_delay, and also, "DHCP" gets "Starting network: lo0 sk0.
<insert_bogus_interface_info_here>" printed *before* the IP address
assignment process starts, while "SYNCDHCP" gets "Starting network:
lo0 sk0. <insert_current_interface_info_here>" printed *after* the IP
address assignment process finishes.

so here is the question rephrased:

the boot process of my FreeBSD machines takes a relatively long time.
it spends 30 seconds idling at some point, because my network
interface (sk0) is supposed to have an IP address assigned via DHCP,
and the DHCP server on my LAN takes an extremely long time (~40
seconds) to reply to IP address requests. this is unacceptable for me;
i want the FreeBSD boot process to finish 30 seconds earlier, even if
i won't get the chance to use the network for ~40 seconds after the
booting has finished.

this was the actual case when my rc.conf had the following options
related to network interfaces:
===== rc.conf snippet begins =====
ifconfig_sk0="DHCP"
===== rc.conf snippet ends =====

it took me 3 rc.conf configuration attempts to find a configuration in
which the boot process does not idle for 30 seconds.

the following was the first attempt:
===== rc.conf snippet begins =====
background_dhclient="YES"
background_dhclient_sk0="YES"
===== rc.conf snippet ends =====
with this configuration, the DHCP client isn't even started. ie., the
boot process does not idle at all (that's good!), but the network
interface will never receive an IP address automatically (that's very
bad!).

here is the second attempt:
===== rc.conf snippet begins =====
ifconfig_sk0="DHCP"
background_dhclient="YES"
background_dhclient_sk0="YES"
===== rc.conf snippet ends =====
with this configuration, the DHCP client is started, but the boot
process still idles for 30 seconds at some point (as if the
background_dhclient and background_dhclient_<if> variables had no
effect).

the final attempt is:
===== rc.conf snippet begins =====
ifconfig_sk0="DHCP"
defaultroute_delay="0"
===== rc.conf snippet ends =====
this configuration works, ie., during the boot process, there is no
idling related to waiting for a DHCP server to reply. but this
configuration looks hacky.

so what is the RIGHT(TM) way to configure the boot process not to idle
much in case of a slow DHCP server, and why?

i ask this question partially because there is an rc.conf option
background_dhclient (also, background_dhclient_<if>), which doesn't
seem to do anything, though it should, since it exists (either that,
or the option should be removed). (there has been a recent discussion
on the freebsd-current list about rc.d parallelization; [reason for
CCing:] could recent rc.d changes have made the background_dhclient
option useless?)

i'd like to have an in-depth explanation on what effect should any
combination of the following options should have on the boot process:
defaultroute_delay="0", background_dhclient="YES",
synchronous_dhclient="YES". (for example, using both
background_dhclient="YES" and synchronous_dhclient="YES" seems stupid;
i need a clarification if that's not the case.) what's the explanation
if there is more than 1 network card (all of which are to have IP
addresses assigned via DHCP)?



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAF6hryR%2B-ugO28%2BxVhg15XpuQRny_aAeh2m%2BQ3HP16aS8-PwyA>