90 lines
2.0 KiB
ReStructuredText
90 lines
2.0 KiB
ReStructuredText
###
|
|
dns
|
|
###
|
|
|
|
:date: 2021-09-16 00:00
|
|
:modified: 2021-09-16 00:00
|
|
:tags: domainname
|
|
:category: documentation
|
|
:slug: dns
|
|
:authors: Ms.Leave-A-Mix
|
|
:summary: DNS Configuration tips
|
|
|
|
|
|
-------
|
|
LibVirt
|
|
-------
|
|
|
|
Libvirt uses dnsmasq as a DHCP server and a DNS server for the libvirt-network daemon, it is
|
|
configured by the network's XML, you can edit it live (without having to restart
|
|
it) or via an XML file. I use the live mode because I prefer to keep the network
|
|
up when adding a new virtual machine in the configuration.
|
|
|
|
Tip : Try your dns server with the nslookup command.
|
|
|
|
|
|
.. code-block:: xml
|
|
|
|
-- xml mode
|
|
<network>
|
|
...
|
|
<dns>
|
|
<forwarder addr='dns.ip.address'/>
|
|
<host ip='host.ip.address'>
|
|
<hostname>vmhostname</hostname>
|
|
</host>
|
|
</dns>
|
|
...
|
|
</network>
|
|
|
|
-- live mode
|
|
virsh net-update default add dns-host \
|
|
"<host ip='host.ip.address'> \
|
|
<hostname>vmhostname</hostname> \
|
|
</host>" \
|
|
--live --config
|
|
|
|
|
|
|
|
This DNS server is used by default on virtual machines that use default
|
|
configuration with DHCP.
|
|
|
|
You may want to use a dedicated server to handle the DNS requests, in this case
|
|
you just have to configure your operating system as described below with the
|
|
correct IP (here I use 192.168.42.1 which is the libvirt/dnsmasq server).
|
|
|
|
|
|
|
|
|
|
------
|
|
Debian
|
|
------
|
|
|
|
Bullseye
|
|
--------
|
|
|
|
On Debian Bullseye, the way to configure your DNS addresses depends on how your
|
|
network is configured. With a fresh install, you can simply edit the dhclient
|
|
configuration file and add the following option :
|
|
|
|
|
|
.. code-block:: dhcp.conf
|
|
|
|
# If you want to keep the DNS address provided by the DHCP server
|
|
prepend domain-name-servers 192.168.42.1;
|
|
|
|
# If you want to use only the local DNS server
|
|
supersede domain-name-servers 192.168.42.1;
|
|
|
|
|
|
Restart the network and normally, resolv.conf will contain the following lines :
|
|
|
|
.. code-block:: resolv.conf
|
|
|
|
nameserver 192.168.42.1
|
|
|
|
# If you choosed to "prepend", the DHCP provided name server is used
|
|
nameserver 213.186.33.99
|
|
|
|
|