experchange > programmer

Kenny McCormack (01-01-20, 12:19 AM)
Here's the situation: Every once in a while (maybe twice a year), I get
into a situation where my router forgets all the hostnames of the machines
that are getting their IP addresses from the router. When this happens, I
need to go to each machine and "renew" the IP lease, so that the router can
then "know" the machine name.

Doing this on Linux is easy. One Windows, not so easy, but doable.
In Linux, you use either dhclient or dhcpcd. With dhcpcd, you use either
the -N or -n option. With dhclient, you have to run it twice - once with
-r (to bring down the existing daemon) and then again with -v (to establish
a new one).

But how about on OSX? What's the equivalent daemon to Linux's dhclient or
dhcpcd? Or is there a way to do this using the admin GUI?

Note that a brute force way to do it is to unplug and re-plug the ethernet
cable, but I'd rather avoid that if possible, since it might break existing
network connections. Incidentally, Linux is pretty good about not breaking
connections just because the ethernet cable is momentarily unplugged.

However, OSX is pretty, shall, we say, anal about disconnecting things
right away, if it senses the connection is gone. So, particularly on a Mac
client machine, unplugging the ethernet cord is something you want to avoid
if at all possible.
Paul (01-01-20, 06:11 AM)
Kenny McCormack wrote:
[..]
> right away, if it senses the connection is gone. So, particularly on a Mac
> client machine, unplugging the ethernet cord is something you want to avoid
> if at all possible.


For renewing a lease, there's a GUI and a command line way.

The only thing articles like this don't do, is
guarantee this is invariant with OS release number.

They could easily move the deck chairs, between releases.



Paul
Kenny McCormack (01-01-20, 08:53 AM)
In article <quh662$43k$1>, Paul <nospam> wrote:
>Kenny McCormack wrote:
>For renewing a lease, there's a GUI and a command line way.
>The only thing articles like this don't do, is
>guarantee this is invariant with OS release number.
>They could easily move the deck chairs, between releases.
>


OK, thanks.

As it turns out, by the time I got around to reading your response and
trying to test it, the situation had already rectified itself - that is,
the router now shows the right host name. I kind of expected this to
happen; in the past, this sort of thing has usually taken care of itself
just by waiting for long enough (generally overnight). This exercise was
in the category of "I want it now, daddy!" (*), but I was pretty sure that
just leaving it alone for a while would take care of the problem.

That all said, thanks for the info; I am sure it will come in handy some
day. BTW, I have used the Network thingie in System Preferences before, a
long time ago, but it looked familiar once I read the linked article.

Of the 3 methods presented, the third one - the "scutil" method - actually
looked the nicest.

(*) "https://www.youtube.com/watch?v=TRTkCHE1sS4"
boltar (01-01-20, 11:05 AM)
On Tue, 31 Dec 2019 22:19:31 -0000 (UTC)
gazelle (Kenny McCormack) wrote:
>network connections. Incidentally, Linux is pretty good about not breaking
>connections just because the ethernet cable is momentarily unplugged.


IIRC correctly thats a kernel config option whether to respond to the
ethernet cable being removed.
William Ahern (01-02-20, 08:09 AM)
Kenny McCormack <gazelle> wrote:
[..]
> right away, if it senses the connection is gone. So, particularly on a Mac
> client machine, unplugging the ethernet cord is something you want to avoid
> if at all possible.


Have you tried simply lowering the DHCP lease renewal timeout? I often use
15 or 30 minutes (as opposed to the common default of 24 hours), which means
if the DHCP service loses state[1] the network automatically recovers
relatively quickly (i.e. less than 15 minutes of head scratching, about the
time it would take to begin suspecting that DHCP broke and multiple systems
are assigned the same IP).

The problem with low lease times is that if the DHCP service is
intermittently unavailable some DHCP clients might cause trouble rather than
quietly continuing with the existing lease. The risk of encountering such a
scenario increases the shorter the renewal interval. DHCP leases include
both a renewal timeout and an expiration timeout; the latter should be much
longer than the former, but even if so it's possible buggy DHCP clients
don't do the right thing.

[1] DHCP daemons usually persist state on disk, so it should be rare for
state to be lost. Other than lowering lease renewal intervals, perhaps your
time would be better spent figuring out why your DHCP daemon chokes. FWIW, I
use a PC Engines APU2 for DHCP (home, office, etc) and place both the WiFi
and ISP routers in bridge mode. That way I can control most of the service
stack. I'm not sure how common it is to be able to configure ISP gateways to
bridge, especially for residential services, but I've always been able to do
it.
Similar Threads