Libvirt hooks for setting up DNS with systemd resolved.
- Requires Python3
- This obviously requires that you use
systemd-resolved
and not other dns resolvers locally. This is mostly the case with Ubuntu 20.04, Fedora 34+ and Debian 10. - You will need libvirt up and running.
<domain name="$DOMAIN_NAME"/>
MUST be defined. Example xml for default network, with domaindefault.kvm
is shown below.<network> <name>default</name> <uuid>25009595-68aa-4888-9c74-e3db45818bed</uuid> <forward mode='nat'> <nat> <port start='1024' end='65535'/> </nat> </forward> <bridge name='virbr0' stp='on' delay='0'/> <mac address='52:54:00:74:d1:bf'/> <domain name='default.kvm'/> <ip address='192.168.122.1' netmask='255.255.255.0'> <dhcp> <range start='192.168.122.2' end='192.168.122.254'/> <host mac='52:54:00:DA:4A:4B' name='ansible' ip='192.168.122.129'/> </dhcp> </ip> </network>
Please note that changes in network configuration requires network to be destroyed and redefined.
Installing is simple as placing hook in /etc/libvirt/hooks/network.d
and ensure that it is executable.
sudo make install
resolvectl
should show you per link domains
resolvectl --no-pager domain
- Known public suffixes are disallowed from being configured as routing domains
- This is achieved via public suffix list at
/usr/share/publicsuffix/public_suffix_list.dat
This is already installed on most Desktop and server systems.
- If using Debian, Ubuntu, Linux Mint, Pop!_OS, Raspbian or other debian derivatives,
apt-get install publicsuffix
- If using Fedora, CentOS, RHEL, Amazon Linux 2022
dnf install publicsuffix-list
- If using ArchLinux, Manjaro or other Arch derivatives,
pacman -S publicsuffix-list
- If using OpenSUSE,
zypper install publicsuffix