LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices


Reply
 
Search this Thread
Old 06-24-2008, 09:45 AM   #1
MikeyCarter
Member
 
Registered: Feb 2003
Location: Orangeville
Distribution: Fedora
Posts: 457

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, 12:20 PM   #2
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,393
Blog Entries: 1

Rep: Reputation: 64
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:
Code:
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 www.google.com returns 4 answers and all are cached. You don't need to take additional steps.
Code:
;; ANSWER SECTION:
www.google.com.		335701	IN	CNAME	www.l.google.com.
www.l.google.com.	148	IN	A	72.14.205.99
www.l.google.com.	148	IN	A	72.14.205.103
www.l.google.com.	148	IN	A	72.14.205.104
www.l.google.com.	148	IN	A	72.14.205.147
 
  


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


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