LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-04-2017, 02:40 PM   #1
fanoflq
Member
 
Registered: Nov 2015
Posts: 397

Rep: Reputation: Disabled
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:
Code:
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.1.1
search Home

Here is resolv.conf for CentOS 7:
Code:
# Generated by NetworkManager
nameserver 192.168.122.1
From man resolv.conf:
Quote:
....
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 (127.0.1.1 & 192.168.122.1)
in resolv.conf for the above
nameserver directive are local,
how do I locate these nameservers in local host?

From man resolv.conf:
Quote:
... ...
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.

Last edited by fanoflq; 04-04-2017 at 02:43 PM.
 
Old 04-04-2017, 08:20 PM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 19,549

Rep: Reputation: 3144Reputation: 3144Reputation: 3144Reputation: 3144Reputation: 3144Reputation: 3144Reputation: 3144Reputation: 3144Reputation: 3144Reputation: 3144Reputation: 3144
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 127.0.1.1. 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/

Last edited by michaelk; 04-04-2017 at 09:08 PM.
 
1 members found this post helpful.
Old 04-04-2017, 08:58 PM   #3
jefro
Moderator
 
Registered: Mar 2008
Posts: 19,514

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

Last edited by jefro; 04-04-2017 at 09:01 PM.
 
1 members found this post helpful.
Old 04-04-2017, 11:58 PM   #4
fanoflq
Member
 
Registered: Nov 2015
Posts: 397

Original Poster
Rep: Reputation: Disabled
So how do I remove "search Home" since resolv.conf
was generated by another utility?
 
Old 04-05-2017, 02:00 AM   #5
mddnix
Member
 
Registered: Mar 2013
Distribution: Redhat, Ubuntu
Posts: 537

Rep: Reputation: 149Reputation: 149
What's in /etc/network/interfaces file ?
 
Old 04-05-2017, 09:00 AM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 19,549

Rep: Reputation: 3144Reputation: 3144Reputation: 3144Reputation: 3144Reputation: 3144Reputation: 3144Reputation: 3144Reputation: 3144Reputation: 3144Reputation: 3144Reputation: 3144
The resolvconf script generates the contents of the resolv.conf file.
 
Old 04-05-2017, 12:39 PM   #7
fanoflq
Member
 
Registered: Nov 2015
Posts: 397

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by mddnix View Post
What's in /etc/network/interfaces file ?

Mint 18
Code:
                                                                 
$ cat  /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
CentOS7:
Code:
[root@centos7-1024ram-minimal ~]# cd /etc/network
-bash: cd: /etc/network: No such file or directory
[root@centos7-1024ram-minimal ~]# cat /etc/networks 
default 0.0.0.0
loopback 127.0.0.0
link-local 169.254.0.0
 
Old 04-05-2017, 04:46 PM   #8
jefro
Moderator
 
Registered: Mar 2008
Posts: 19,514

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


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
setup hostname from DNS/DHCP dynamically nicolasdiogo Linux - Networking 6 12-27-2012 04:52 PM
Link one library statically others dynamically (gcc, g++) czappa Programming 7 03-22-2012 09:47 AM
Hostname resolution diogosalazar Linux - Networking 1 03-16-2011 01:27 PM
How to make a linux machine with a static IP address dynamically add its hostname to jrwsod LinuxAnswers Discussion 1 02-15-2010 09:46 PM
Dynamically loaded modules and statically loaded modules in linux gauthamk Linux - Software 1 05-18-2008 05:28 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:49 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration