/etc/hosts

Back on a related networking topic if you are logging in remotely via ssh then in general you have to type

ssh user@ip of host

While this is fine in most circumstances,  remembering lots of IP address can be a headache at the best of times,.

The hosts file is a good way to partly solve this issue,  I have provided an example from my own hosts file but changed the ip adresses / hostnames listed for security reasons

127.0.0.1    localhost
127.0.1.1    G-machine
192.168.1.10    Desktop
192.168.1.11   raspPI

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

I don’t understand the 2nd section too much, but the first section is essentially a list of devices on the network (ipv4),  and an associated human readable name. (hostname)

If you edit your /etc/hosts file you leave the first 2 entries intact,  and then add the others for each device on the network,   then if you want to for example ssh in to your raspberry pi you can use

ssh user@raspPi  this will then resolve to 192.168.1.11 and you should then connect,  and either require  password or if you set up password less logins just connect without asking for  password

This can be a real time saver.

if you then replicate the entries on each computer, then you can use the same technique on each system.

If you are using windows or mac then the hosts file will be located elsewhere,

More information can be found on Wikipedia article on the hosts file.

Hope this information is useful.