You can easily configure the domain search list. The search list is normally determined from the local domain name; by default, it contains only the local domain name.
|Est. reading time||2 mintues|
Task: SETUP DNS SEARCH LIST FOR HOST-NAME LOOKUP
Open /etc/resolv.conf file, enter:
# vi /etc/resolv.conf
$ sudo vi /etc/resolv.conf
Now add search path as follows for sweet.home domain:
Save and close the file.
A note about modern Linux distro
You need to use the nmcli command as follows”
nmcli connection modify br0 ipv4.dns-search "sweet.home"
nmcli connection modify br0 ipv6.dns-search "sweet.home"
Ensure you replace br0 with your interface name and “sweet.home” with your actual search domain name.
Optional ntdots configuration
Please note that you may also need to use ndots:n option to sets a threshold for the number of dots which must appear in a name given to query before an initial absolute query will be made. The default for n is “1”, meaning that if there are any dots in a name, the name will be tried first as an absolute name before any search list elements are appended to it. For example set ndots to 2 as follows, to answer nslookup f1.mail query to get IP for f1.mail.in.test.com hostname:
## config file - /etc/resolv.conf ##
Save and close the file. Again replace sweet.home as per your domain name.
$ host f1 $ host mail $ dig smtp $ ping router
- The search list is currently limited to six domains with a total of 256 characters.
Help /etc/resolv.conf file overwritten by dhclient on a Linux based system
You may find that /etc/resolve.conf is being generated and overwritten by dhcp client, so any changes made to /etc/resolv.conf file will be subsequently overwritten. See how to fix this issue by reading the following tutorial:
🐧 4 comments so far... add one ↓
|Category||List of Unix and Linux commands|
|Disk space analyzers||df • ncdu • pydf|
|File Management||cat • cp • mkdir • tree|
|Firewall||Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04|
|Network Utilities||NetHogs • dig • host • ip • nmap|
|OpenVPN||CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04|
|Package Manager||apk • apt|
|Processes Management||bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time|
|Searching||grep • whereis • which|
|User Information||groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w|
|WireGuard VPN||Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04|