-   Linux - Newbie (
-   -   About configuring hostname resolution statically or dynamically (

fanoflq 04-04-2017 01:40 PM

About configuring hostname resolution statically or dynamically
Static hostname resolution configuration is done in /etc/hosts.

It looks like dynamic hostname resolution configuration is done using
resolv.conf file. But from what I know, this file is generated
by another utility (See below).

So to do dynamic hostname resolution configuration, I can use nmtui or nmcli utility to add DNS ip address.

Local host use DNS for IP address lookup when local host cannot find
IP specified in /etc/hosts.

Here is resolv.conf for Linux Mint 18:

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
search Home

Here is resolv.conf for CentOS 7:

# Generated by NetworkManager

From man resolv.conf:

nameserver Name server IP address
Internet address of a name server that
the resolver should query, either an IPv4 address
(in dot notation), or an IPv6 address in
colon (and possibly dot) notation as per RFC 2373.
... ...
Q1: Since the addresses ( &
in resolv.conf for the above
nameserver directive are local,
how do I locate these nameservers in local host?

From man resolv.conf:

... ...
search Search list for host-name lookup.
The search list is normally determined from the
local domain name; by default, it contains
only the local domain name. This may be
changed by listing the desired domain search
path following the search keyword with spaces
or tabs separating the names. Resolver queries
having fewer than ndots dots (default is 1)
in them will be attempted using each component of
the search path in turn until a match is found.
... ...
Q2: About directive "search Home" in resolv.conf,
what is it looking for in Home directory?
There are only files and directories in Home.
What did I missed?

Thank you.

michaelk 04-04-2017 07:20 PM

CentOS 7
If your system is configured for DHCP then it will usually get the DNS name server from the the DHCP server which is normally the router in a home system. Via NetworkManager you can use other DNS name servers not provided by the DHCP server as well as enter everything manually including disabling NM completely.

Mint 18
dnsmasq is installed and running which uses the computer for a local DNS caching server which is why you see You can also provide a search list which is usually the local domain name. I assume you used Home for a domain name when you installed Mint. AFAIK if you use mysite in the web browser it will automatically try http://mysite.home/

jefro 04-04-2017 07:58 PM

It would not search /home. I'd think that someone/somehow placed a "name" as home. Like in computer name or domain name.

fanoflq 04-04-2017 10:58 PM

So how do I remove "search Home" since resolv.conf
was generated by another utility?

mddnix 04-05-2017 01:00 AM

What's in /etc/network/interfaces file ?

michaelk 04-05-2017 08:00 AM

The resolvconf script generates the contents of the resolv.conf file.

fanoflq 04-05-2017 11:39 AM


Originally Posted by mddnix (Post 5692793)
What's in /etc/network/interfaces file ?

Mint 18

$ cat  /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback


[root@centos7-1024ram-minimal ~]# cd /etc/network
-bash: cd: /etc/network: No such file or directory
[root@centos7-1024ram-minimal ~]# cat /etc/networks

jefro 04-05-2017 03:46 PM

I might as well ask this. What is result of command "hostname" ? no quotes.

All times are GMT -5. The time now is 01:13 AM.