Date: Mon, 9 Jun 2025 11:00:40 -0400 From: Paul Procacci <pprocacci@gmail.com> To: Andriy Gapon <avg@freebsd.org> Cc: net@freebsd.org Subject: Re: dhclient vs aliases Message-ID: <CAFbbPugUCzfjyHU3=3x-Nryv=vZX3bV_o7MRwt44-HKmbJZsjA@mail.gmail.com> In-Reply-To: <895899af-e416-476f-8655-529b28726a01@freebsd.org> References: <d7284489-c4ef-4d06-8a27-87c497bc879c@FreeBSD.org> <CAFbbPui05DiO2WQf16extfKy866B54g9pk18xgR-q2y3v_=_OA@mail.gmail.com> <895899af-e416-476f-8655-529b28726a01@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Jun 9, 2025 at 10:40 AM Andriy Gapon <avg@freebsd.org> wrote: > > On 09/06/2025 17:26, Paul Procacci wrote: > > Re: https://forums.freebsd.org/threads/dhclient-trashing-alias-ip-address-upon-reconnect.58729/ > > > > You can use a dhclient.conf(5) entry like this to guarantee that the > > alias is re-applied every time the interface gets a new address from > > DHCP (or the old lease is re-applied): > > > > Code: > > > > alias { > > interface "em0"; > > fixed-address 10.0.0.3; > > option subnet-mask 255.255.255.0; > > } > > Thank you! > This should work, but it kind of kills a "single source of truth" for jail > configurations. > > So, it seems that there is a quirk regarding jail+aliases and DHCP. > > > On Mon, Jun 9, 2025 at 10:20 AM Andriy Gapon <avg@freebsd.org> wrote: > >> > >> > >> Apologies if this is a FAQ and maybe it has always been like that but I've just > >> noticed this. > >> > >> A switch needed to be rebooted, so on a FreeBSD host a link went down and then > >> up on an interface connected to the switch. > >> Apparently triggered by those events, dhclient decided to renew the interface's > >> IP address. Afterwards, all alias IP addresses on that interface were cleared. > >> Just in case, the new IP address was exactly the same as the old IP address > >> (it's "hardwired" in the DHCP server configuration). > >> > >> This was unhelpful because the host runs a number of jails with a simple IP > >> configuration via aliases. > -- > Andriy Gapon I haven't personally tested this, but does something akin to the following work? ifconfig_em0_alias0="DHCP" ifconfig_em0_alias1="DHCP" Assuming you're using dhcp addressing for single source of truths then give this a whirl perhaps. ~Paul -- __________________ :(){ :|:& };:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAFbbPugUCzfjyHU3=3x-Nryv=vZX3bV_o7MRwt44-HKmbJZsjA>
