= DNS on Linux = '''Domain Name Resolution''' ('''DNS''') on Linux is done in a very similar way to [[BSD/DNS|DNS on BSD]]. It is worth reiterating that [[Bind|DNS was invented for BSD]]. <> ---- == Name resolution == === Name Service Switch === The [[Linux/NsSwitchConf|Name Service Switch (NSS) configuration file]] (`/etc/nsswitch.conf`) defines the order of operations for various services, among them being name resolution. {{{ hosts: files dns }}} Consider instead this configuration, which makes use of libraries and services from the `systemd` project. This will enable some omissions from the hosts file. {{{ hosts: files mymachines myhostname dns }}} === Hosts === The [[Linux/Hosts|hosts file]] (`/etc/hosts`) is a list of addresses and names, especially for local hosts and machines. {{{ 127.0.0.1 localhost }}} === Resolver === The [[Linux/ResolvConf|resolver configuration file]] (`/etc/resolv.conf`) is a list of nameservers to query for name resolution. Changes are immediately effective. If the resolver file is being configured directly, then it should look like: {{{ nameserver 8.8.8.8 }}} Services that manipulate the resolver file include: * [[Linux/SystemdResolved|systemd-resolved(8)]] and it's userland utility `resolvectl(1)` * [[Linux/SystemdResolved#ResolveConf|systemd-resolveconf(8)]] * [[OpenResolv|openresolve]] with [[Linux/ResolvConfConf|resolveconf.conf(5)]] * [[Dhcpcd|dhcpcd(8)]] * [[NetworkManager|NetworkManager(8)]] === Utilities === * `drill(1)`, used as `drill NAME @SERVER TYPE` * [[Bind/Dig|dig(1)]] ---- == Multicast name resolution == '''Multicast domain name resolution''' ('''mDNS''') is an expansion of the DNS protocol. An mDNS broadcaster makes use of port 5353 and resolves names in the `.local` domain. Note that there is also partial/coincidental support for '''link-local multicast name resolution''' ('''LLMNR''') in many of the Linux implementations of mDNS. LLMNR is a similar but deliberately incompatible protocol (using port 5355) and also with a limited scope for features. ---- CategoryRicottone