associate name with ip for ssh?

Solution 1:

If you only want the name for ssh and ssh only, you can add a name to your ssh config in ~/.ssh/config

As an example, your config file could look like this:

Host database
    HostName <real IP address or hostname here>
    User username

Then you can type ssh database on the command line and ssh will automatically do ssh [email protected] for you.

Solution 2:

Add an entry for it to /etc/hosts on the system you're ssh'ing from.

The syntax is

1.1.1.1 hostname

This works on Linux and Mac. For Windows, the file is c:\windows\system\drivers\etc\hosts.


Solution 3:

clients have 2 or 3 ways to associate a name with a IP address.

1) DNS, but that implies a hostname and a domain.

2) host file, you can add any name in the clients host file and then it will be used. Add the line '192.168.1.1 database' in /etc/hosts to associate the name database with the address 192.168.1.1. See http://en.wikipedia.org/wiki/Hosts_%28file%29 for more specific details and OS specific locations.

3) NIS, Solaris computers can use NIS to share hostnames for multiple clients.