Q.H. Wang wrote:
On Wednesday 31 August 2005 12:25 am, et wrote:
he needs a localhost entry in his /etc/hosts file. he is not resolving his
own IP without DNS lookups.
Thanks a lot. The problem is I use DHCP. Is it still necessary to add a
localhost entry in my /etc/hosts file? Maybe it is as I usually get a fixed
IP in my (domain) name in our LAN.
Thanks.
Q.H.
Do you give your system a hostname, or is it called localhost? If it has
a host name, then you need to be able to look up that host name, and get
a matching IP address for it. If your LAN is running a name server, with
local hostname/IP address mapping, and DHCP is properly set up to
provide the IP address of this name server so that /etc/resolv.conf gets
set correctly, then you don't need to set anything in /etc/hosts. Where
you get delays is where you have given the system a hostname, but it can
not be looked up - you get a delay every time the system needs to look
up the hostname, and must wait for it to time out.
Because your system works when you have one specific IP address, it
sounds like you have a hostname, and you have an entry for it in
/etc/hosts that points to the specific IP address. So when you get this
IP address, everything works fine. But if you get another IP address
from DHCP, then the machine still tries to use that IP address but it is
trying to talk to another machine. (Or no machine, if that IP address
isn't in use.)
Linux is designed from the ground up to be a networked OS, and so you
have to have the network setting correct, or you run into timeout
delays. Having your hostname mapped to 127.0.0.1 will cut down drasticly
on the problems. Of corse, if you network has a local name server, and
the name server is updated by the DHCP server, or if you get your
hostname from the DHCP server, then this is not a problem. Of corse, it
can be confusing when you get a different hostname if your IP address
changes...
Mikkel
--
Do not meddle in the affairs of dragons,
for thou art crunchy and taste good with Ketchup!
____________________________________________________
Want to buy your Pack or Services from Mandriva?
Go to http://store.mandriva.com
Join the Club : http://www.mandrivaclub.com
____________________________________________________