[NTLUG:Discuss] localhost vs "real" IP address

./aal al_h at technologist.com
Tue Jan 13 12:20:50 CST 2009


On Tue, Jan 13, 2009 at 10:50 AM, George Lass <george.lass at sbcglobal.net> wrote:
>
> ________________________________
> From: Dennis Rice <dennis at dearroz.com>
> To: NTLUG Discuss <discuss at ntlug.org>
> Sent: Tuesday, January 13, 2009 7:26:40 AM
> Subject: Re: [NTLUG:Discuss] localhost vs "real" IP address
>
> Ken wrote:
>
> Chris Cox wrote:
>
>> > George Lass wrote:
>>
>>> >> Sorry, I got that backwards.  It should have read something like:
>>> >>
>>> >> ... how much more overhead in using the IP address for eth0 as compared to 127.0.0.1...
>>>
>> >
>> >  :)   Well.. that obviously varies.  But I'm not sure how quantifiable it is... anyone?
>>
>
> It really should not vary.  Both translate to an internal interface.
>
> traceroute to 192.168.1.5 (192.168.1.5), 30 hops max, 40 byte packets
> 1  neptune.local (192.168.1.5)  0.071 ms  0.032 ms  0.031 ms
>
> and
>
> traceroute to neptune (127.0.0.1), 30 hops max, 40 byte packets
> 1  neptune.loafman.com (127.0.0.1)  0.072 ms  0.031 ms  0.031 ms
>
> Both come up with 0.031ms on my machine.  One is going to an internal
> 'lo' interface, the other to 'eth0'.  I would imagine the difference
> could be measured with enough repetition and measurement.  I doubt it
> would amount to even a 0.1% difference.
>
> ...Ken
>
>
> Both must be identical.  The only difference between the two segments
> coming out of the Transport Layer (Layer 4) is the destination IP
> address, namely 127.0.0.1 or the local interface address.  Both packets
> terminate at the ICMP function, which resides at the Network Layer
> (Layer 3).  The ICMP function is responsible for responding back or
> looping back the message, plus other management functions.  ICMP does
> not care what the origin is, or whether the packet came from the Data
> Link Layer (Layer 2) or the Transport Layer - it just loops it back.
>
> Many believe that when pinging one's local address that the loopback is
> in the Data Link Layer or Physical Layer -- that is totally incorrect.
> It would be nice is if one could ping a MAC address, then one could see
> a response from the Data Link Layer, but no mechanism exists for a MAC
> address to respond.
>
>
> _______________________________________________
> http://www.ntlug.org/mailman/listinfo/discuss
>
>
>
> Dennis,
> Thanks for your explanation of *why* this works the way it does when using ICMP messages.  Do you know if it is safe to assume a similar operation for TCP/IP socket connections?
> George
> _______________________________________________
> http://www.ntlug.org/mailman/listinfo/discuss
>

perhaps  time wget http://127.0.0.1/foo.bar vs. time wget
http://192.168.1.5/foo.bar

./aal
-- 
I'm a PC(x86 AND ppc)
AND I RUN LINUX!!!

Jack London  - "You can't wait for inspiration. You have to go after
it with a club."



More information about the Discuss mailing list