<p>What is important to note about that example is that ping, like most applications that do network lookups, will only do the lookup once at the beginning. For that reason my example required that I put single ping calls in a loop.</p>
<div class="gmail_quote">On Nov 4, 2011 5:48 PM, "Richard Bronosky" <<a href="mailto:Richard@bronosky.com">Richard@bronosky.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
As with must things on Linux, the answer is "It depends on how your<br>
system is configured." This is pretty easily tested on any system<br>
though.<br>
~$ sudo date # this is to prime my sudo password timeout<br>
Password:<br>
Fri Nov 4 17:47:12 EDT 2011<br>
~$ host <a href="http://google.com" target="_blank">google.com</a><br>
<a href="http://google.com" target="_blank">google.com</a> has address 74.125.159.106<br>
~$ host <a href="http://bronosky.com" target="_blank">bronosky.com</a><br>
<a href="http://bronosky.com" target="_blank">bronosky.com</a> has address 174.143.204.116<br>
~$ (sleep 5; sudo tee -a /etc/hosts <<< "174.143.204.116 <a href="http://google.com" target="_blank">google.com</a>")<br>
& (while true; do ping -q -c 1 <a href="http://google.com" target="_blank">google.com</a> | head -1; sleep 1; done)<br>
[1] 4874<br>
PING <a href="http://google.com" target="_blank">google.com</a> (74.125.159.106): 56 data bytes<br>
PING <a href="http://google.com" target="_blank">google.com</a> (74.125.159.106): 56 data bytes<br>
PING <a href="http://google.com" target="_blank">google.com</a> (74.125.159.106): 56 data bytes<br>
PING <a href="http://google.com" target="_blank">google.com</a> (74.125.159.106): 56 data bytes<br>
PING <a href="http://google.com" target="_blank">google.com</a> (74.125.159.106): 56 data bytes<br>
174.143.204.116 <a href="http://google.com" target="_blank">google.com</a><br>
PING <a href="http://google.com" target="_blank">google.com</a> (174.143.204.116): 56 data bytes<br>
PING <a href="http://google.com" target="_blank">google.com</a> (174.143.204.116): 56 data bytes<br>
PING <a href="http://google.com" target="_blank">google.com</a> (174.143.204.116): 56 data bytes<br>
PING <a href="http://google.com" target="_blank">google.com</a> (174.143.204.116): 56 data bytes<br>
PING <a href="http://google.com" target="_blank">google.com</a> (174.143.204.116): 56 data bytes<br>
^C<br>
[1]+ Done ( sleep 5; sudo tee -a /etc/hosts <<<<br>
"174.143.204.116 <a href="http://google.com" target="_blank">google.com</a>" )<br>
<br>
Is that quick enough for you?<br>
<br>
<br>
On Fri, Nov 4, 2011 at 8:30 AM, leam hall <<a href="mailto:leamhall@gmail.com">leamhall@gmail.com</a>> wrote:<br>
> I use it as it is turned on everywhere I've worked. I've not seen any data<br>
> that suggests it is a problem, but I'd be happy to see some facts.<br>
><br>
> Leam<br>
><br>
> On Fri, Nov 4, 2011 at 8:24 AM, Chesser.Damon <<a href="mailto:Damon.Chesser@suntrust.com">Damon.Chesser@suntrust.com</a>><br>
> wrote:<br>
>><br>
>> Thanks for the reply, that is how I thought it worked also. As for nscd,<br>
>> someone on this list said “Don’t. Use. It.”<br>
>><br>
>><br>
>><br>
>> Any other opinions on it?<br>
>><br>
>><br>
>><br>
>> <a href="mailto:Damon@damtek.com">Damon@damtek.com</a><br>
>><br>
>><br>
>><br>
>> From: <a href="mailto:ale-bounces@ale.org">ale-bounces@ale.org</a> [mailto:<a href="mailto:ale-bounces@ale.org">ale-bounces@ale.org</a>] On Behalf Of leam<br>
>> hall<br>
>> Sent: Friday, November 04, 2011 8:17 AM<br>
>> To: Atlanta Linux Enthusiasts<br>
>> Subject: Re: [ale] /etc/hosts and caching<br>
>><br>
>><br>
>><br>
>> Good morning Damon!<br>
>><br>
>><br>
>><br>
>> As far as I can tell by editing /etc/hosts on a RHEL 4 box, the IP<br>
>> addresses are not cached longer than it takes me to edit the file. I believe<br>
>> your server will alwyas look in /etc/hosts anyway, per the<br>
>> /etc/nsswitch.conf file. The normal hosts line is something like:<br>
>><br>
>><br>
>><br>
>> hosts: files dns<br>
>><br>
>> There is the program nscd and it's config file, ncsd.conf. This configures<br>
>> some caching for you but I *think* it's more DNS related than affecting<br>
>> /etc/hosts.<br>
>><br>
>> Hope that helps.<br>
>><br>
>><br>
>><br>
>> Leam<br>
>><br>
>> On Fri, Nov 4, 2011 at 7:40 AM, Chesser.Damon <<a href="mailto:Damon.Chesser@suntrust.com">Damon.Chesser@suntrust.com</a>><br>
>> wrote:<br>
>><br>
>> This dovetails into building a DNS caching server I asked earlier this<br>
>> week. The issue is we are seeing latency in our application and a possible<br>
>> (but only possible, not proven) issue might be host lookups. I figured that<br>
>> an entry into /etc/hosts would be faster than a WAN DNS lookup especially<br>
>> since the IP is static. Someone was concerned with disk reads and that<br>
>> becoming a bottleneck. Someone else pointed out that /etc/hosts file was<br>
>> cached.<br>
>><br>
>><br>
>><br>
>> This started a google search by me to find out if that was true or not.<br>
>> Totally inconclusive. Some have reported issues with not being able to get<br>
>> the Linux box to re-read the hosts file after a change was committed short<br>
>> of a reboot or init restart. Others have said just make the change and it<br>
>> shows up. I have not found any documentation saying whether it was cached<br>
>> or not. Any smart guys know the answer or can provide any documentation on<br>
>> that? It’s kind of funny, you think you KNOW something until someone says<br>
>> “Prove it”.<br>
>><br>
>><br>
>><br>
>> <a href="mailto:Damon@damtek.com">Damon@damtek.com</a><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>> LEGAL DISCLAIMER<br>
>> The information transmitted is intended solely for the individual or<br>
>> entity to which it is addressed and may contain confidential and/or<br>
>> privileged material. Any review, retransmission, dissemination or other use<br>
>> of or taking action in reliance upon this information by persons or entities<br>
>> other than the intended recipient is prohibited. If you have received this<br>
>> email in error please contact the sender and delete the material from any<br>
>> computer.<br>
>><br>
>> SunTrust is a federally registered service mark of SunTrust Banks, Inc.<br>
>> Live Solid. Bank Solid. is a service mark of SunTrust Banks, Inc.<br>
>> [ST:XCL]<br>
>><br>
>> _______________________________________________<br>
>> Ale mailing list<br>
>> <a href="mailto:Ale@ale.org">Ale@ale.org</a><br>
>> <a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
>> See JOBS, ANNOUNCE and SCHOOLS lists at<br>
>> <a href="http://mail.ale.org/mailman/listinfo" target="_blank">http://mail.ale.org/mailman/listinfo</a><br>
>><br>
>><br>
>> --<br>
>><br>
>> Mind on a Mission<br>
>><br>
>><br>
>><br>
>> _______________________________________________<br>
>> Ale mailing list<br>
>> <a href="mailto:Ale@ale.org">Ale@ale.org</a><br>
>> <a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
>> See JOBS, ANNOUNCE and SCHOOLS lists at<br>
>> <a href="http://mail.ale.org/mailman/listinfo" target="_blank">http://mail.ale.org/mailman/listinfo</a><br>
>><br>
><br>
><br>
><br>
> --<br>
> Mind on a Mission<br>
><br>
> _______________________________________________<br>
> Ale mailing list<br>
> <a href="mailto:Ale@ale.org">Ale@ale.org</a><br>
> <a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
> See JOBS, ANNOUNCE and SCHOOLS lists at<br>
> <a href="http://mail.ale.org/mailman/listinfo" target="_blank">http://mail.ale.org/mailman/listinfo</a><br>
><br>
><br>
<br>
<br>
<br>
--<br>
.!# RichardBronosky #!.<br>
</blockquote></div>