1834961 Members
1770 Online
110071 Solutions
New Discussion

Re: host file

 
SOLVED
Go to solution
Sylvie Vezina
Occasional Advisor

host file

We run Unix 11.00 on L1000 server.
How to reload host file without server reboot.
We tried /usr/sbin/inetd -c: no result...
Can you tell me which command can we use?
Thanks
The best day is today
10 REPLIES 10
Sridhar Bhaskarla
Honored Contributor

Re: host file

Hi,

Can you give us more details?. If you are talking about /etc/hosts, then there is no need to restart everything. The new entry will be picked up by all the subsequent gethostbyname|addr calls. TO verify it use
'nslookup host_name' command.

Also make sure you have files appearing as the first option in your /etc/nsswtich.conf.

If you are not talking about /etc/hosts, then you can ignore this entire message.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Marco Santerre
Honored Contributor
Solution

Re: host file

Bonjour Sylvie,

tu ne serais pas suppose d'avoir besoin de rebooter le serveur si tu ne fais qu'un changement a l'interieur de ton /etc/hosts. A partir du moment ou ton /etc/hosts est change, le changement est automatique.

Le probleme reside peut-etre de la maniere dont tu resous les adresses par contre. Comment est-ce que tu resous les adresses (regarde ton fichier /etc/nsswitch.conf) Si tu regardes files en premier, et que tu fais un ping sur le nom (ou l'adresse) que tu as change tu devrais resoudre a la nouvelle adresse.
Cooperation is doing with a smile what you have to do anyhow.
Kent Ostby
Honored Contributor

Re: host file

If you are talking about the /etc/hosts file then there is nothing you need to do to make the system "re-read" it.

The problem may be that you have and /etc/resolv.conf file which is telling the computer to look at a different source rather then the /etc/hosts file.

Best regards,

Kent M. Ostby
"Well, actually, she is a rocket scientist" -- Steve Martin in "Roxanne"
Hazem Mahmoud_3
Respected Contributor

Re: host file

Once the /etc/hosts file is updated, the changes take effect. Unless you are using DNS or NIS, and in that case the system may be going there first to resolve the host name. Take a look at your /etc/nsswitch.conf file and the /etc/resolv.conf files and let us know.

-Hazem
Geoff Wild
Honored Contributor

Re: host file

Yes - what is in /etc/nsswitch.conf?

Like:

hosts: files [NOTFOUND=CONTINUE] dns

Or: hosts: dns

If the latter - then it won't read /etc/hosts at all....

Rgds...Geoff

Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Sylvie Vezina
Occasional Advisor

Re: host file

You were right, problem was DNS resolution....But many of you mentionned nsswitch.conf....and I don't find this file on system.....Must I create it or not?
The best day is today
Patrick Wallek
Honored Contributor

Re: host file

Yes, you should create it. It controls the order in which the hosts file and / or DNS/NIS/NIS+ etc will be checked for hostname resolution.

Mine generally look like this:

# ll /etc/nsswitch.conf
-rw-r--r-- 1 root sys 345 Jul 2 1998 /etc/nsswitch.conf

# cat /etc/nsswitch.conf
hosts: files[NOTFOUND=continue UNAVAIL=continue] dns [NOTFOUND=return UNAVAIL=continue TRYAGAIN=return]
protocols: files[NOTFOUND=return UNAVAIL=return]
services: files[NOTFOUND=return UNAVAIL=return]
networks: files[NOTFOUND=return UNAVAIL=return]
netgroup: files[NOTFOUND=return UNAVAIL=return]
rpc: files[NOTFOUND=return UNAVAIL=return]

The line you are most concerned about is the first line (the hosts: line). Mine checks the local /etc/hosts first and then looks to DNS.
Dave La Mar
Honored Contributor

Re: host file

Sylvie -
Marco did indeed point to nsswitch.conf.
No points here.
You should be all set with the given answers.

Best regards,

dl
"I'm not dumb. I just have a command of thoroughly useless information."
Francois LAURENT
Frequent Advisor

Re: host file

Hello,
Also use /etc/resolve.conf for indicate wich dns server to use :
domain XX.YYYY.fr
search XX.YYYY.fr
nameserver1 128.240.229.18
nameserver2 128.240.229.34

You can use nslookup and nsquery to verify the host resolution (#nsquery hosts hostname_to_resolve )

Mobeen_1
Esteemed Contributor

Re: host file

Sylvie,
The order of name resolution is first any name call looks up the local hosts file and in the event that the host entry is not present in the local hosts file, then it will lookup your DNS server.

Your local hosts file will be at /etc/hosts

So if you would need to add in an entry for a host, you can just edit this file and add in that entry.

No reboot is needed after doing this, as after you are done editing the hosts file, any lookups to the host you added will be looked into the /etc/hosts file before going to your DNS server

I hope i have been clear

regards
Mobeen