LPIC-1 109.4: Client-side DNS
Who writes /etc/resolv.conf, /etc/hosts against DNS, and a search
domain.
Before you start
The lab saves the network configuration (NetworkManager's profiles on the RHEL family; netplan and systemd-resolved's settings on Ubuntu) so reset can put it back. Task 2 needs the VM to resolve names on the internet.
Tasks
- Read
/etc/nsswitch.conf, and check whether/etc/resolv.confis a link withls -l. Which program writes it? Write its name to/root/lab-answers/1. - Add
example.orgas a search domain (through NetworkManager or systemd-resolved, sinceresolv.confis generated), persistently, and look up the short namewww:getent hosts wwwmust findwww.example.org. - Add
192.168.1.250 fake.example.orgto/etc/hosts. Comparegetent hosts fake.example.orgwithdig fake.example.org, and work out why they differ. Write the addressgetentprints to/root/lab-answers/3, then remove the line from/etc/hosts.
Hints
ls -l /etc/resolv.conf; the comment at the top of the file.nmcli connection modify ... ipv4.dns-search, thennmcli device reapply; orDomains=in a drop-in in/etc/systemd/resolved.conf.d/, orsearch:undernameservers:in netplan.resolvectl statusandcat /etc/resolv.confshow it.digis inbind-utilson the RHEL family andbind9-dnsutilson Ubuntu. Which of the two reads/etc/hosts?