JoeHill wrote:
The 'test' machines are piling up, and I would like to be able to SSH in via
hostnames rather than IP's (easier to remember, eh?).

I'd go with Google, but I'm not even sure what to search for or what it is I
need to configure and on which box.

I have one machine that is my 'server', can I set up something on there to
resolve hostnames to IP's?

Any pointers appreciated. I don't mind doing the work, I just don't know where
to start :-)

Thanks!


Joe, All OS's check their 'hosts' files before doing a DNS lookup, just in case the system you're trying to connect to is on your local network and not on the Internet. It's a default standard for just about everything and in fact, you can add domains to the hosts file and they resolve instantly that way.

If we're talking Linux here, your hosts file is on the /etc folder. It's a plain text file that you can edit in any text editor. The syntax you need to use is very simple;

IP Address              FQDN                    Hostname

127.0.0.1       localhost.localdomain           localhost

64.233.187.99      google.com                   google

192.168.0.1     joe.freeyourmachine.net         joe


The hostname examples I've given above aren't the actual host names for those systems, but they don't have to be. They can be whatever name you want to give them as long as the IP address is right.

When you want to surf the net or ssh into another system, you can just type in the hostname after the command;

http://google

ssh joe

Your system will check the hosts file, find google or joe and go to the IP address you've provided for that name. Just don't use the same name twice or it won't know which one to go to and will default to the first one it finds.

Once you've written the file once, copy and paste it into the other machines and make sure that you leave the 127.0.0.1/localhost entry in there. It represents the individual system that it is currently on, even if that IP address/hostname combination is used on 2000 computers or more.

Set the file to 'read only' and let root own it. By the way, you can put that file right into Windows as well. M$ provides a sample of the file somewhere in a sub-folder of the system32 folder. They've named it 'hosts.sam' and they have another one called 'lmhosts.sam'

Just paste the hosts file into the same directory, but don't name it with an extension to the filename. It should just be called 'hosts'. You can also past it a second time to the same folder and call it 'lmhosts'.
(the 'lm' stands for 'local machines')

For any sites you go to frequently, this will save a bit of time in resolving the name as well, since the hosts file is checked before sending out a DNS request. You can use the hosts files for ssh, http, smtp, pop3, dns, etc., and they will still work even if your ISP's DNS servers go down. I'd also suggest that you add the host info for Sympatico's DNS servers, since they can go down quite often.

HTH's

DL
____________________________________________________
Want to buy your Pack or Services from Mandriva? Go to http://store.mandriva.com
Join the Club : http://www.mandrivaclub.com
____________________________________________________

Reply via email to