GNU/Linux Network Configuration Configure a hostname for some other system on your network


You can configure your Linux (or macOS) system in order to tie in an identifier <hostname> to some other system's IP address in your network. You can configure it:

  • Systemwide. You should modify the /etc/hosts file. You just have to add to that file a new line containing:

    1. the remote system's IP address <ip_rem>,
    2. one or more blank spaces, and
    3. the identifier <hostname>.
  • For a single user. You should modify the ~/.hosts file --- you-d have to create it. It is not as simple as for systemwide. Here you can see an explanation.

For instance, you could add this line using the cat Unix tool. Suppose that you want to make a ping to a PC in yout local network whose IP address is and you want to refer to that IP address just by remote_pc. Then you must write on your shell:

$ sudo cat remote_pc

Then you can make that ping just by:

$ ping remote_pc