[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: localhost = loopback



On Thu, 2002-09-05 at 09:20, Charles Menzes wrote:
> Does anyone know why Linux opts to put a localhost entry in /etc/hosts 
> using the loopback address even when an e0 is configured? I'm asking 
> because I've seen BSD distros use the real ethernet assigned address and 
> was curious as to the rationale for using the loop.

That sounds very strange.  If it's true, it really takes BSD down a
notch, IMHO.

The rationale is simple: you don't want to subject entirely local
connections to the vagracies of a real network connection, with its
faulty drivers, disappearing hotplug devices like PCMCIA or USB
adapters, flaky DHCP servers, and the like.  Loopback is a network
address that can be counted upon; one should count on it when one can.

I can just see the poor process doing a name lookup on "localhost"
immediately before DHCP orders the box to use a different IP on eth0, or
immediately before the user ejects the wireless card from the laptop in
a futile attempt to fix a problem with the access point.

Fortunately, few programs go through the indignity of a
gethostbyname("localhost"); they just open sockets to 127.0.0.1.  Still,
I'm sure that programs that take hostnames in their config are set to
"localhost" sometimes.  If I had a system like that, I'd definitely
freak out if "localhost" resolved to something besides 127.0.0.1.


-
To unsubscribe, send email to majordomo@luci.org with
"unsubscribe luci-discuss" in the body.