[systemd-devel] systemd-resolved/NetworkManager resolv.conf handling
Thomas HUMMEL
thomas.hummel at pasteur.fr
Tue Nov 8 10:41:52 UTC 2022
On 11/7/22 18:35, Barry Scott wrote:
> I do not know enough about how that works.
I just tested something like this (as a proof of concept) :
f5.sh root:root/0700 in /etc/NetworkManager/dispatcher.d/
#!/bin/bash
usage()
{
local EXIT_VALUE=$1
echo "usage: "$SCRIPT_NAME" <interface> <action>"
exit $EXIT_VALUE
}
SCRIPT_NAME="$0"
INTERFACE=$1
ACTION=$2
F5_INTERFACE="tun0"
F5_NAMESERVER_1="x.x.x.x"
F5_NAMESERVER_2="x.x.x.x"
[ $# -eq 0 ] && usage 0
[ $# -ne 2 ] && usage 1
"$INTERFACE" != "$F5_INTERFACE" -o "$ACTION" != "up" ] && exit 0
[ "$INTERFACE" == "$F5_INTERFACE" -a "$ACTION" == "up" ] && echo
"$SCRIPT_NAME: adding $F5_INTERFACE nameservers to systemd-resolved
configuration"
/usr/bin/resolvectl dns $F5_INTERFACE $F5_NAMESERVER_1 $F5_NAMESERVER_2
|| { echo "Pb running resolvectl" ; usage 1 ; }
exit 0
--
Thomas HUMMEL
More information about the systemd-devel
mailing list