[systemd-devel] RFC on NetworkManager -> networkd data forwarding script
Alexander Kurtz
alexander at kurtz.be
Thu Oct 29 09:51:04 PDT 2015
Hi,
I really like networkd, but still prefer NetworkManager for WiFi and
WWAN. I've therefore written the attached [0] script for forwarding
the current Domain, DNS and NTP server to networkd, so it can in turn
forward it to other parts of systemd (like resolved or timesyncd).
Although this works surprisingly well in practice, I still somehow have
a bad feeling about this. What do you guys think about this setup? Will
this suddenly break one day and eat all my data or am still on solid
ground here? Is there a better alternative?
Best regards
Alexander Kurtz
[0] /etc/NetworkManager/dispatcher.d/systemd-networkd:
#!/bin/sh -e
if
([ "${2}" = 'up' ] || [ "${2}" = 'vpn-up' ] || [ "${2}" = 'dhcp4-change' ] || [ "${2}" = 'dhcp6-change' ]) &&
([ "${IP4_DOMAINS}" ] || [ "${IP6_DOMAINS}" ] || [ "${IP4_NAMESERVERS}" ] || [ "${IP6_NAMESERVERS}" ] || [ "${DHCP4_NTP_SERVERS}" ] || [ "${DHCP6_NTP_SERVERS}" ])
then
if ! [ -d '/run/systemd/network' ]; then
mkdir '/run/systemd/network'
fi
{
echo "[Match]"
echo "Name=${1}"
echo ""
echo "[Network]"
for domain in ${IP4_DOMAINS} ${IP6_DOMAINS}; do
echo "Domains=${domain}"
done
for dns in ${IP4_NAMESERVERS} ${IP6_NAMESERVERS}; do
echo "DNS=${dns}"
done
for ntp in ${DHCP4_NTP_SERVERS} ${DHCP6_NTP_SERVERS}; do
echo "NTP=${ntp}"
done
echo "IPv6PrivacyExtensions=kernel"
echo "IPForward=kernel"
} > "/run/systemd/network/99-NetworkManager-${1}.network"
systemctl restart systemd-networkd
elif
([ "${2}" = 'down' ] || [ "${2}" = 'vpn-down' ]) &&
([ -f "/run/systemd/network/99-NetworkManager-${1}.network" ])
then
rm "/run/systemd/network/99-NetworkManager-${1}.network"
systemctl restart systemd-networkd
fi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20151029/1373d1ee/attachment.sig>
More information about the systemd-devel
mailing list