LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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 02-19-2015, 12:07 AM   #1
babyPen
LQ Newbie
 
Registered: May 2014
Posts: 17

Rep: Reputation: Disabled
resolve configuratin


Hello Gurus,

I am trying to understand the concept of resolve conf and hope to get some understanding.
When reviewing a sample resolv.conf @
http://www.shellhacks.com/en/Setup-D...nf-in-Examples

stumbled on a scenario.

Lets say I have the following in my resolv.conf

less /etc/resolv.conf
search uncc.org uat.uncc.org sit.uncc.org uat2.uncc.org
intranet.uncc.org
nameserver 192.168.0.100

now if I run command, Note: There is no such thing called appserver
Quote:
ping appserver
My Questions:

1 ) How many lookups are being performed. And which domains are being searched ?

2 ) Will the look up go thru all the 5 domains listed against search directive ?

3) When both directives are provided "search" and "nameserver" will the look up happen on both directives and can both directives be used together ?

Help is much appreciated.
 
Old 02-19-2015, 04:35 AM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
Well, unless I'm mis-reading this http://man7.org/linux/man-pages/man5/resolv.conf.5.html it'll search each of the domains listed, using the dns server named

Don't forget to check /etc/nsswitch.conf for the hosts entry though ..
 
1 members found this post helpful.
Old 02-19-2015, 06:40 AM   #3
babyPen
LQ Newbie
 
Registered: May 2014
Posts: 17

Original Poster
Rep: Reputation: Disabled
Firstly, thank you Chrism01.

based on your response I am understanding that when I run command
Quote:
ping appserver
ping: unknown host appserver
so the number of look up resolver is performing is 5 correct ?
Why does it not look up against the nameserver ?

Additional Question:

When I ping, the first place it will look is at the local domain right ? Can you/someone explain me how the resolver work meaning when I run
Quote:
ping <name>
what is actually happening in the background. The route ping travels is what I would like to understand.

Last edited by babyPen; 02-19-2015 at 06:41 AM.
 
Old 02-19-2015, 09:26 AM   #4
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,275

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
Since the name is never resolved, no ping packets are ever actually sent. The ping command communicates with your DNS server on port 53 UDP. It asks the name server to resolve the name; when it cannot do so, it returns with an error.

The lookup is done once for each domain given in the search-domains option in /etc/resolv.conf. Order is important, since the first name to be resolved will be the one used. If none of the names resolve, you get the error you show above.
 
1 members found this post helpful.
Old 02-20-2015, 09:18 PM   #5
Fred Caro
Member
 
Registered: May 2007
Posts: 999

Rep: Reputation: 166Reputation: 166
But /etc/resolv.conf usually only contains the localhost. DNS is resovled elsewhere.

Fred.
 
Old 02-22-2015, 12:47 AM   #6
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,275

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
Generally /etc/resolv.conf will have the address of one or more name servers in it. Are you thinking of /etc/hosts?
 
Old 02-23-2015, 03:48 PM   #7
Fred Caro
Member
 
Registered: May 2007
Posts: 999

Rep: Reputation: 166Reputation: 166
No but /etc/resolv.conf can have nameserver listings, as in Debian but Mint has this:

Quote:
cat /etc/resolv.conf
# 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
Fred.
 
Old 02-24-2015, 08:41 AM   #8
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,275

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
Heh that's a werid looking resolv.conf ... every box I have (a mix of CentOS, Scientific Linux, Debian, and Ubuntu) populates /etc/resolv.conf with a full list of name servers -- this is the standard *nix way of doing things. Maybe Mint sets up some other process listening on port 53 of localhost to resolve name queries. Note that having a nameserver address of 127.0.1.1 is valid; IIRC that refers back to the localhost in Ubuntu/Mint-land, so that simply means that the local host will provide name resolution via some daemon listening on port 53 AFAICT.
 
Old 02-24-2015, 09:52 PM   #9
Fred Caro
Member
 
Registered: May 2007
Posts: 999

Rep: Reputation: 166Reputation: 166
I will have to dig out the docs on this but the Mint13 system that this relates to does keep dropping its dns setup and I have to run 'dpkg-reconfigure resolvconf'. The manuals tell you that there is a record of dns servers at /etc/resolv.conf but sometimes you get the above result(that quoted when running 'cat /etc/resolv.conf') on a given system.

regarding 'the docs' when running 'dpkg...' , when it gets to the end there is a message to the effect of this is unsatisfactory but this is the best we can do at the time.

Fred.
 
Old 02-26-2015, 05:52 AM   #10
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,600

Rep: Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241
Quote:
Originally Posted by Fred Caro View Post
No but /etc/resolv.conf can have nameserver listings, as in Debian but Mint has this:

nameserver 127.0.1.1

Fred.
This should only be present IF the local system is running a name server itself. This is usually done to allow a cache only server to be present - it helps reduce delays by saving the results of queries in a database for the next time you happen to refer to that host again.

Cacheing name servers don't have a local domain - but they do have all the rest of the capabilities of a general name server. That allows them to make external queries for unknown host name.
 
Old 02-26-2015, 08:49 AM   #11
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 12,541
Blog Entries: 23

Rep: Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943
Member Response

Hi,

Since cache door has been opened, here is a good article for Localhost DNS Cache setup;
Quote:
Is it weird to say that DNS is my favorite protocol? Because DNS is my favorite protocol. There's something about the simplicity of UDP packets combined with the power of a service that the entire Internet relies on that grabs my interest. Through the years, I've been impressed with just how few resources you need to run a modest DNS infrastructure for an internal network.
Recently, as one of my environments started to grow, I noticed that even though the DNS servers were keeping up with the load, the query logs were full of queries for the same hosts over and over within seconds of each other. You see, often a default Linux installation does not come with any sort of local DNS caching. That means that every time a hostname needs to be resolved to an IP, the external DNS server is hit no matter what TTL you set for that record.

This article explains how simple it is to set up a lightweight local DNS cache that does nothing more than forward DNS requests to your normal resolvers and honor the TTL of the records it gets back.
Hope this helps.
Have fun & enjoy!
 
Old 03-02-2015, 09:50 PM   #12
Fred Caro
Member
 
Registered: May 2007
Posts: 999

Rep: Reputation: 166Reputation: 166
Thanks, I'll have to look into that.

Fred.
 
Old 03-03-2015, 06:41 PM   #13
Fred Caro
Member
 
Registered: May 2007
Posts: 999

Rep: Reputation: 166Reputation: 166
It seems my Mint13 system has some elements of dnsmasq, mentioned in the full artical, but they are for a 2.6 kernel and I am running 3 and there is no populated configuration file.
However, after a kernel upgrade the resolv.conf file looks more conventional and dns is working without additional efforts but still contains a warning:
Quote:
# 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 194.168.4.100
nameserver 194.168.8.100
but 127, etc has been removed.

I think the problem started when I did a 'dist-upgrade' on Mint which is probably not a good idea.

Fred.
 
Old 03-04-2015, 07:33 AM   #14
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,600

Rep: Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241
Quote:
Originally Posted by Fred Caro View Post
It seems my Mint13 system has some elements of dnsmasq, mentioned in the full artical, but they are for a 2.6 kernel and I am running 3 and there is no populated configuration file.
However, after a kernel upgrade the resolv.conf file looks more conventional and dns is working without additional efforts but still contains a warning:


but 127, etc has been removed.

I think the problem started when I did a 'dist-upgrade' on Mint which is probably not a good idea.

Fred.
It partly depends on your distribution, and partly on how you configure things.

The "replaced" values are frequently done by DHCP, which can be configured to not "replace", but "append". It can also be configured to make no changes.

The other "replace" configuration usually is done by either NetworkManager or by startup scripts - such as that used by RH: /etc/sysconfig/network-scripts/ifcfg-<netword-device-name> when they include a DNS definitions (DNS1 and/or DNS2 entries).
 
1 members found this post helpful.
  


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
How I can resolve the error Postfix? warning: hostname does not resolve to address kanzer Linux - Server 1 03-22-2013 09:56 AM
cachingserver can resolve www.gmail.com, but can not resolve mail.com SeniorGoe Linux - Server 6 06-12-2010 02:10 PM
Unable to resolve ulr. /et/resolve.conf looks fine? TheBrick Linux - Networking 3 02-14-2008 05:13 AM
X configuratin horatiu_v Linux - Newbie 6 04-10-2006 05:50 AM
I need my LAN users to access the internet using automatic configuratin script on RH9 akohamen Linux - Networking 1 04-20-2004 04:09 PM


All times are GMT -5. The time now is 01:48 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