overriding hostname in wicked-dhcp?
This isn't specific to OpenSUSE, so I'm open to being told to look
elsewhere.
My goal: if the DHCP server does not provide a hostname, I want to
synthesize one from the IPv4 address I'm getting.
Using the classic ISC DHCP client (dhclient), this is easy; you
create an exit-hook script, and that script has access to all of
the details of the lease, so I can selectively override the processing
of the lease; e.g.:
case "$reason" in
BOUND|RENEW|REBIND|REBOOT)
if [ -z "$new_host_name" ]; then
new_host_name=${new_ip_address//./-}
hostnamectl set-hostname $new_host_name
fi
;;
esac
Easy-peasy. (Yes, an enter-hook might be a better place, but you
get the gist.)
However, OpenSUSE uses wicked to manage DHCP configuration. I know
it has a scripting mechanism, but I can't quickly find a way to
accomplish the above in wicked.
Any pointers? Or suggestions to other forums where this question
is more appropriate?
--
Brian Reichert
On 17.02.2023 18:16, Brian Reichert wrote:
This isn't specific to OpenSUSE, so I'm open to being told to look elsewhere.
Well, wicked is most certainly specific to openSUSE.
My goal: if the DHCP server does not provide a hostname, I want to synthesize one from the IPv4 address I'm getting.
Using the classic ISC DHCP client (dhclient), this is easy; you create an exit-hook script, and that script has access to all of the details of the lease, so I can selectively override the processing of the lease; e.g.:
case "$reason" in BOUND|RENEW|REBIND|REBOOT)
if [ -z "$new_host_name" ]; then
new_host_name=${new_ip_address//./-} hostnamectl set-hostname $new_host_name
fi
;; esac
Easy-peasy. (Yes, an enter-hook might be a better place, but you get the gist.)
However, OpenSUSE uses wicked to manage DHCP configuration. I know it has a scripting mechanism, but I can't quickly find a way to accomplish the above in wicked.
Even if it is possible with wicked, there is no documentation and wicked is deprecated and not even installed in current Tumbleweed. At which point you may look at NetworkManager and dispatcher script.
Any pointers? Or suggestions to other forums where this question is more appropriate?
On Fri, Feb 17, 2023 at 08:03:37PM +0300, Andrei Borzenkov wrote:
On 17.02.2023 18:16, Brian Reichert wrote:
This isn't specific to OpenSUSE, so I'm open to being told to look elsewhere.
Well, wicked is most certainly specific to openSUSE.
I must admit, I'm really on a SLES12 host, but none of the related
forums are responsive, so I asked here.
Regrettably, it has wicked installed.
So, I'll look elsewhere for pointers; thanks for the feedback!
--
Brian Reichert
participants (2)
-
Andrei Borzenkov
-
Brian Reichert