Free Hosting Online for WorkStations

< Previous | Contents | Next >

1.3.1. DNS Client Configuration‌


Traditionally, the file /etc/resolv.conf was a static configuration file that rarely needed to be changed or automatically changed via DCHP client hooks. Systemd-resolved handles name server configuration, and it should be interacted with through the systemd-resolve command. Netplan configures systemd-resolved to generate a list of nameservers and domains to put in /etc/resolv.conf, which is a symlink:


/etc/resolv.conf -> ../run/systemd/resolve/stub-resolv.conf


To configure the resolver, add the IP addresses of the nameservers that are appropriate for your network to the netplan configuration file. You can also add an optional DNS suffix search-lists to match your network domain names. The resulting file might look like the following:


network: version: 2



renderer: networkd ethernets:

enp0s25: addresses:

- 192.168.0.100/24

gateway4: 192.168.0.1 nameservers:

search: [mydomain, otherdomain] addresses: [1.1.1.1, 8.8.8.8, 4.4.4.4]


The search option can also be used with multiple domain names so that DNS queries will be appended in the order in which they are entered. For example, your network may have multiple sub-domains to search; a parent domain of example.com, and two sub-domains, sales.example.com and dev.example.com.


If you have multiple domains you wish to search, your configuration might look like the following:


network: version: 2

renderer: networkd ethernets:

enp0s25: addresses:

- 192.168.0.100/24

gateway4: 192.168.0.1 nameservers:

search: [example.com, sales.example.com, dev.example.com] addresses: [1.1.1.1, 8.8.8.8, 4.4.4.4]


If you try to ping a host with the name of server1, your system will automatically query DNS for its Fully Qualified Domain Name (FQDN) in the following order:

1. server1.example.com

2. server1.sales.example.com

3. server1.dev.example.com


Top OS Cloud Computing at OnWorks: