<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, &quot;Richard Bronosky&quot; &lt;<a href="mailto:Richard@bronosky.com">Richard@bronosky.com</a>&gt; 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 &quot;It depends on how your<br>
system is configured.&quot; 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 &lt;&lt;&lt; &quot;174.143.204.116 <a href="http://google.com" target="_blank">google.com</a>&quot;)<br>
&amp; (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 &lt;&lt;&lt;<br>
&quot;174.143.204.116 <a href="http://google.com" target="_blank">google.com</a>&quot; )<br>
<br>
Is that quick enough for you?<br>
<br>
<br>
On Fri, Nov 4, 2011 at 8:30 AM, leam hall &lt;<a href="mailto:leamhall@gmail.com">leamhall@gmail.com</a>&gt; wrote:<br>
&gt; I use it as it is turned on everywhere I&#39;ve worked. I&#39;ve not seen any data<br>
&gt; that suggests it is a problem, but I&#39;d be happy to see some facts.<br>
&gt;<br>
&gt; Leam<br>
&gt;<br>
&gt; On Fri, Nov 4, 2011 at 8:24 AM, Chesser.Damon &lt;<a href="mailto:Damon.Chesser@suntrust.com">Damon.Chesser@suntrust.com</a>&gt;<br>
&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; Thanks for the reply, that is how I thought it worked also.  As for nscd,<br>
&gt;&gt; someone on this list said “Don’t.  Use. It.”<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; Any other opinions on it?<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; <a href="mailto:Damon@damtek.com">Damon@damtek.com</a><br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; 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>
&gt;&gt; hall<br>
&gt;&gt; Sent: Friday, November 04, 2011 8:17 AM<br>
&gt;&gt; To: Atlanta Linux Enthusiasts<br>
&gt;&gt; Subject: Re: [ale] /etc/hosts and caching<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; Good morning Damon!<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; As far as I can tell by editing /etc/hosts on a RHEL 4 box, the IP<br>
&gt;&gt; addresses are not cached longer than it takes me to edit the file. I believe<br>
&gt;&gt; your server will alwyas look in /etc/hosts anyway, per the<br>
&gt;&gt; /etc/nsswitch.conf file. The normal hosts line is something like:<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;    hosts:      files dns<br>
&gt;&gt;<br>
&gt;&gt; There is the program nscd and it&#39;s config file, ncsd.conf. This configures<br>
&gt;&gt; some caching for you but I *think* it&#39;s more DNS related than affecting<br>
&gt;&gt; /etc/hosts.<br>
&gt;&gt;<br>
&gt;&gt; Hope that helps.<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; Leam<br>
&gt;&gt;<br>
&gt;&gt; On Fri, Nov 4, 2011 at 7:40 AM, Chesser.Damon &lt;<a href="mailto:Damon.Chesser@suntrust.com">Damon.Chesser@suntrust.com</a>&gt;<br>
&gt;&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; This dovetails into building a DNS caching server I asked earlier this<br>
&gt;&gt; week.  The issue is we are seeing latency in our application and a possible<br>
&gt;&gt; (but only possible, not proven) issue might be host lookups.  I figured that<br>
&gt;&gt; an entry into /etc/hosts would be faster than a WAN DNS lookup especially<br>
&gt;&gt; since the IP is static.  Someone was concerned with disk reads and that<br>
&gt;&gt; becoming a bottleneck.  Someone else pointed out that /etc/hosts file was<br>
&gt;&gt; cached.<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; This started a google search by me to find out if that was true or not.<br>
&gt;&gt; Totally inconclusive.  Some have reported issues with not being able to get<br>
&gt;&gt; the Linux box to re-read the hosts file after a change was committed short<br>
&gt;&gt; of a reboot or init restart.  Others have said just make the change and it<br>
&gt;&gt; shows up.  I have not found any documentation saying whether it was cached<br>
&gt;&gt; or not.  Any smart guys know the answer or can provide any documentation on<br>
&gt;&gt; that?  It’s kind of funny, you think you KNOW something until someone says<br>
&gt;&gt; “Prove it”.<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; <a href="mailto:Damon@damtek.com">Damon@damtek.com</a><br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; LEGAL DISCLAIMER<br>
&gt;&gt; The information transmitted is intended solely for the individual or<br>
&gt;&gt; entity to which it is addressed and may contain confidential and/or<br>
&gt;&gt; privileged material. Any review, retransmission, dissemination or other use<br>
&gt;&gt; of or taking action in reliance upon this information by persons or entities<br>
&gt;&gt; other than the intended recipient is prohibited. If you have received this<br>
&gt;&gt; email in error please contact the sender and delete the material from any<br>
&gt;&gt; computer.<br>
&gt;&gt;<br>
&gt;&gt; SunTrust is a federally registered service mark of SunTrust Banks, Inc.<br>
&gt;&gt; Live Solid. Bank Solid. is a service mark of SunTrust Banks, Inc.<br>
&gt;&gt; [ST:XCL]<br>
&gt;&gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; Ale mailing list<br>
&gt;&gt; <a href="mailto:Ale@ale.org">Ale@ale.org</a><br>
&gt;&gt; <a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
&gt;&gt; See JOBS, ANNOUNCE and SCHOOLS lists at<br>
&gt;&gt; <a href="http://mail.ale.org/mailman/listinfo" target="_blank">http://mail.ale.org/mailman/listinfo</a><br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; --<br>
&gt;&gt;<br>
&gt;&gt; Mind on a Mission<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; Ale mailing list<br>
&gt;&gt; <a href="mailto:Ale@ale.org">Ale@ale.org</a><br>
&gt;&gt; <a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
&gt;&gt; See JOBS, ANNOUNCE and SCHOOLS lists at<br>
&gt;&gt; <a href="http://mail.ale.org/mailman/listinfo" target="_blank">http://mail.ale.org/mailman/listinfo</a><br>
&gt;&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; Mind on a Mission<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; Ale mailing list<br>
&gt; <a href="mailto:Ale@ale.org">Ale@ale.org</a><br>
&gt; <a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
&gt; See JOBS, ANNOUNCE and SCHOOLS lists at<br>
&gt; <a href="http://mail.ale.org/mailman/listinfo" target="_blank">http://mail.ale.org/mailman/listinfo</a><br>
&gt;<br>
&gt;<br>
<br>
<br>
<br>
--<br>
.!# RichardBronosky #!.<br>
</blockquote></div>