Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 06-24-2008, 10:45 AM   #1
Registered: Feb 2003
Location: Orangeville
Distribution: Fedora
Posts: 482

Rep: Reputation: 31
Verify /etc/hosts usage and round robin in /etc/hosts

A while back my ISP threatened to shut me down because I was doing a DOS attack on their DNS.

Turns out that my various computers doing various monitoring scripts put a really high resolution rate on a single address. So to solve the problem I added started adding my more frequent dns pings in the /etc/hosts file.

So I have two questions:

Is there a way for me to verify which programs use the /etc/hosts? I noticed dig doesn't. Does ping? What about the hosts command?

Also there is one site which has a round robin on 4 IP's. My DNS cache and hosts currently can only cache one of the 4. Is there a way of specifying all 4 in the /etc/hosts file and have it used in a round robin fashion?
Old 06-24-2008, 01:20 PM   #2
Senior Member
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,438
Blog Entries: 1

Rep: Reputation: 66
Regarding for the first part of your question: Is there a way for me to verify which programs use the /etc/hosts?

As far as I known, all programs ask to "the resolver", a libc group of functions (gethostbyname, gethostbyaddress, etc, see man 3 GETHOSTBYNAME ) to resolve a string in an address and other related operations.

This group of functions may use several sources like /etc files, dns, nis, nis++, ldap, etc.
The main configuration file is /etc/nsswitch.conf. For the hosts related questions, mine is configured as follow:
hosts:      nisplus dns files
So, if the address was not resolved by NIS, then the resolver asks for DNS, and then looking at /etc/hosts.
Yours may be different.

The second part: multiple IPs for the same name; This is quite common and the DNS is aware about multiple answers.
For instance, a dig on returns 4 answers and all are cached. You don't need to take additional steps.
;; ANSWER SECTION:		335701	IN	CNAME	148	IN	A	148	IN	A	148	IN	A	148	IN	A


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
can't restrict sshd access through hosts.allow and hosts.deny but was working earlier farhan Linux - Security 4 04-18-2008 08:41 AM
Hosts.allow... Can't verify hostname. landev Linux - Security 9 11-29-2007 02:29 PM
/etc/hosts.allow can't verify allowed hostname - what do I do? Dragons Master Linux - Security 3 05-05-2006 07:05 AM
/etc/hosts.deny/hosts.allow have no effect on sshd access bganesh Linux - Security 4 05-04-2006 09:06 PM
Adding shell commands to hosts.deny and hosts.allow ridertech Linux - Security 3 12-29-2003 04:52 PM > Forums > Linux Forums > Linux - Software

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

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