Managing Name Resolution - Paiet/Tech-Journal-for-Everything GitHub Wiki

  • Interface configurations
  • /etc/resolv.conf
  • systemd-resolved
  • Workstations
    • Typically only have one NIC
    • Better to configure DNS on the interface
  • Servers
    • May have multiple NICs
    • May have changing NICs (VMs)
    • Better to configure globally
    • Different for systemd and SysVinit
  • NetPlan
    • /etc/netplan/config.yaml
  • System Scripts
    • /etc/sysconfig/network-scripts/ifcfg-eth0
  • SysV Init
    • Configuring DNS
      • /etc/resolv.conf
      • search lab.itpro.tv
      • nameserver 8.8.8.8
      • nameserver 8.8.4.4
    • Check name resolution servers/order
      • order hosts,bind,nis
      • order bind,hosts,nis
    • Check local name resolution
      • /etc/hosts
  • Restart the network service
    • sudo /etc/init.d/networking restart
  • systemd-resolved
    • Probably already enabled
      • systemctl enable --now systemd-resolved
  • View DNS settings
    • resolvectl
    • Accepted configuration results
      • /run/systemd/resolve/stub-resolv.conf
      • /run/systemd/resolve/resolv.conf
  • Changing the global configuration
    • Edit the configuration file
      • sudoedit /etc/systemd/resolved.conf
      • sudoedit /etc/systemd/resolved.conf.d/dns.conf
    • Modify as needed
      • [Resolve]
      • DNS=4.2.2.1 4.2.2.2
      • Domains=~.
      • DNSSEC=yes
      • DNSOverTLS=yes
    • ~. is a catch all expression
      • Ensures global configuration is used
      • Leave off to prefer interface configurations
    • Restart systemd-resolved
      • sudo systemctl restart systemd-resolved
  • Global vs Interface configurations
    • Typically the interface will override the global settings
    • Depends on which interface has the default route
    • May be desirable
    • May cause inconsistencies