0

I am new on unix systems, I want to ask about the hosts file that is in /etc/hosts what does used for ?? also I want to ask that when connect using ssh=> I wrote on hosts file the following x.x.x.x (server IP) server.hostname

and when use ssh root@server.hostname it says that Unable to resolve host 'server.hostname': Connection failed.

1
  • 3
    If you're looking for a convenient way to map hostnames to IP addresses for SSH, I'd suggest using your ~/.ssh/config file instead Sep 13, 2015 at 14:04

1 Answer 1

0

As your machine gets started, it will need to know the mapping of some hostnames to IP addresses before DNS can be referenced. This mapping is kept in the /etc/hosts file.

In the absence of a name server, any network program on your system consults this file to determine the IP address that corresponds to a host name.

For your second question try to restart the network manager after editing your /etc/hosts file by typing this in terminal sudo service network-manager restart

Not the answer you're looking for? Browse other questions tagged or ask your own question.