1 00:00:00,000 --> 00:00:13,600 Let's talk about DNS client configuration. So, DNS is for name resolution. And DNS is 2 00:00:13,600 --> 00:00:18,080 the internet-based system that ensures that all hosts have a unique name and can be reached 3 00:00:18,080 --> 00:00:25,040 by it. To get the IP address that belongs to the name, the internet DNS server is contacted. 4 00:00:25,040 --> 00:00:30,639 Traditionally, the file etcresolve.conf on Linux has always taken care of the DNS 5 00:00:30,639 --> 00:00:37,439 name resolution. We call it the DNS resolver. The file etchost can be used to resolve host 6 00:00:37,439 --> 00:00:43,360 names on the local network without using DNS. So, if you want to use a local host by name, 7 00:00:43,360 --> 00:00:49,599 put its name and IP address in etchosts. And if the host name is defined in etchost, 8 00:00:49,599 --> 00:00:54,720 it will have higher priority than DNS host names, which is, by the way, managed in the 9 00:00:54,720 --> 00:01:02,560 file etcnsswhich.conf. Now, in most cases, you want to set up a DNS client. As mentioned, 10 00:01:02,560 --> 00:01:08,400 resolve.conf is the old standard. On network manager systems, the file can be written directly 11 00:01:08,400 --> 00:01:15,199 or is managed by network manager. On systemd networkd systems, like Ubuntu, a different 12 00:01:15,199 --> 00:01:22,480 approach is used. And that is where systemd resolved comes in. So, systemd resolved is a 13 00:01:22,480 --> 00:01:29,199 systemd component that manages DNS name resolution. And it runs as a systemd service that 14 00:01:29,199 --> 00:01:34,720 communicates with the networking stack and makes sure that multiple DNS sources can be used 15 00:01:34,720 --> 00:01:42,320 and DNS records are cached. You can check the current status using systemctl status systemd 16 00:01:42,400 --> 00:01:49,599 resolved. And use resolvectl status for information about the current DNS configuration. 17 00:01:50,639 --> 00:01:57,760 If ever you want to overwrite DNS configuration, you edit the file uselib systemd resolve.conf 18 00:01:57,760 --> 00:02:05,120 or better etcsystemd resolve.conf. And then you restart systemd resolved to pick up your edits 19 00:02:05,120 --> 00:02:09,440 and write the correct information to your etcresolve.conf. 20 00:02:10,880 --> 00:02:16,960 So, first, systemctl status on systemd resolved 21 00:02:21,360 --> 00:02:28,479 d is showing that systemd resolved is actively running. And that means that this is managing 22 00:02:28,479 --> 00:02:38,240 your DNS configuration. So, let's do something funny. And let me use sudo vim on etcresolve.conf. 23 00:02:46,399 --> 00:02:50,559 And there I'm going to change my configuration. Let me put a 24 00:02:51,520 --> 00:03:00,479 comment sign in front of it. And I make it nameserver 8888. All right. Next, I'm going to 25 00:03:00,479 --> 00:03:11,279 use a sudo systemctl restart systemd resolved. And back to my resolve.conf. And as you can see, 26 00:03:11,279 --> 00:03:20,320 the nameserver 8888 has disappeared. And that is because if you want to overwrite your DNS configuration, 27 00:03:21,119 --> 00:03:29,839 well, actually, it's saying it right here. And this is the file. So, in fact, if I want to change 28 00:03:29,839 --> 00:03:40,479 my configuration, well, I need to be in uselib systemd resolve.conf. That is the input file 29 00:03:40,479 --> 00:03:46,559 that is actually being used. And, hey, do you remember what is going on with these files in uselib? 30 00:03:46,559 --> 00:03:53,839 Uselib is supposed to be provided by packages. Do not edit it. Instead of editing this file, 31 00:03:53,839 --> 00:04:00,880 copy the file to etcsystemd resolve.conf and edit that. And that will make sure that your edits 32 00:04:00,880 --> 00:04:07,600 find their way into the resolve.conf configuration. Confusing, huh? But you better be aware of it. 33 00:04:07,600 --> 00:04:09,119 Otherwise, it won't ever work.