Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Nov 2021 17:27:16 +0100
From:      Stefan Haller <stefan+freebsd@stha.de>
To:        freebsd-questions@freebsd.org
Subject:   ifconfig - access pltime/vltime for IPv6 address
Message-ID:  <YaZQ5PeU2nYA3Gnt@stha.de>

next in thread | raw e-mail | index | archive | help
Hi everyone!

Is it possible to read out the values for pltime (preferred lifetime) or
vltime (valid lifetime) for an IPv6 address configured on an interface
with normal system tools (ifconfig)?

According to ifconfig(8) one can set both lifetimes. There doesn't seem
to be a way to obtain the current values though. The man page is
actually somewhat vague about the whole topic (Is it a relative or absolute
value? Is it a value in seconds?).

My precise problem is as follows: The router provided by my ISP is
announcing its /64 prefix with relatively long lifetimes. However, the
router is restarting automatically if it detects connectivity problems
or firmware/configuration updates. Usually the IPv6 prefix changes after
the router reboots. My FreeBSD box is therefore accumulating multiple
IPv6 addresses, most of them being invalid while still waiting for
lifetime expiry. Sometimes this results in connectivity problems
(Wireguard is using wrong source address).

I wrote a script that drops all IPv6 addresses if this case is detected.
After a few seconds the latest prefix is reconfigured due to a NDP
router advertisement. However, I would prefer a more robust solution
that drops all prefixes except the one with the highest vltime value.

Maybe someone has an idea how I could achieve this. Thanks in advance!

Best regards,
Stefan Haller



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?YaZQ5PeU2nYA3Gnt>