1
00:00:00,000 --> 00:00:13,660
Let's talk about DNS client configuration. So DNS is for name resolution. And DNS is the

2
00:00:13,660 --> 00:00:18,100
internet-based system that ensures that all hosts have a unique name and can be reached

3
00:00:18,100 --> 00:00:25,059
by it. To get the IP address that belongs to the name, the internet DNS server is contacted.

4
00:00:25,059 --> 00:00:30,900
Traditionally, the file etcresolve.conf on Linux has always taken care of the DNS name

5
00:00:30,900 --> 00:00:37,779
resolution. We call it the DNS resolver. The file etchost can be used to resolve hostnames

6
00:00:37,779 --> 00:00:43,660
on the local network without using DNS. So if you want to use a local host by name, put

7
00:00:43,660 --> 00:00:49,980
its name and IP address in etchosts. And if the hostname is defined in etchosts, it will

8
00:00:49,980 --> 00:00:58,580
have higher priority than DNS hostnames, which is by the way managed in the file etcnsswitch.conf.

9
00:00:58,580 --> 00:01:03,820
Now in most cases, you want to set up a DNS client. As mentioned, resolve.conf is the

10
00:01:03,820 --> 00:01:09,220
old standard. On network manager systems, the file can be written directly or is managed

11
00:01:09,220 --> 00:01:17,320
by network manager. On systemd networkd systems, like Ubuntu, a different approach is used.

12
00:01:17,320 --> 00:01:24,080
And that is where systemd resolved comes in. So systemd resolved is a systemd component

13
00:01:24,080 --> 00:01:30,120
that manages DNS name resolution. And it runs as a systemd service that communicates with

14
00:01:30,120 --> 00:01:36,120
the networking stack and makes sure that multiple DNS sources can be used and DNS records are

15
00:01:36,120 --> 00:01:44,480
cached. You can check the current status using systemctl status systemd resolved. And use

16
00:01:44,480 --> 00:01:51,320
the resolvectl status for information about the current DNS configuration. If ever you

17
00:01:51,320 --> 00:01:58,279
want to overwrite DNS configuration, you edit the file uselib systemd resolved.conf or better

18
00:01:58,279 --> 00:02:05,320
etcsystemd resolved.conf. And then you restart systemd resolved to pick up your edits and

19
00:02:05,320 --> 00:02:15,160
write the correct information to your etcresolved.conf. So first, systemctl status on systemd

20
00:02:15,160 --> 00:02:27,880
resolved is showing that systemd resolved is actively running. And that means that this is

21
00:02:27,880 --> 00:02:36,759
managing your DNS configuration. So let's do something funny. And let me use sudo vim on etc

22
00:02:36,800 --> 00:02:53,399
resolved.conf. And there, I'm going to change my configuration. Let me put a comment sign in front

23
00:02:53,399 --> 00:03:04,800
of it and I make it nameserver 8888. All right. Next, I'm going to use a sudo systemctl restart

24
00:03:05,320 --> 00:03:14,839
systemd resolved. And back to my resolve.conf. And as you can see, the nameserver 8888 has

25
00:03:14,839 --> 00:03:22,000
disappeared. And that is because if you want to overwrite your DNS configuration, well, actually

26
00:03:22,000 --> 00:03:31,160
it's saying it right here. And this is the file. So in fact, if I want to change my configuration,

27
00:03:31,440 --> 00:03:41,679
well, I need to be in uselib systemd resolved.conf. That is the input file that is actually being

28
00:03:41,679 --> 00:03:47,960
used. And hey, do you remember what is going on with these files in uselib? Uselib is supposed to

29
00:03:47,960 --> 00:03:56,520
be provided by packages. Do not edit it. Instead of editing this file, copy the file to etc systemd

30
00:03:56,520 --> 00:04:02,360
resolved.conf and edit that. And that will make sure that your edits find their way into the

31
00:04:02,360 --> 00:04:08,679
resolved.conf configuration. Confusing, huh? But you better be aware of it. Otherwise, it won't

32
00:04:08,679 --> 00:04:09,399
ever work.

