Sunday, June 27, 2010

Difference between /etc/hosts and /etc/networks

In many of linux based Operating Systems, /etc/hosts and /etc/networks both files exists. Both files are useful to give aliases to computer names.

/etc/host file contains alias for all the hosts. So if you have host named "tango", you can put an entry "10.2.3.1 tango", indicating the which IP to connect when OS is told to connect "tango". Moreover you can also specify multiple ips to perticular host.

/etc/networks is helpful to see if two different box names are referring to same ip. As an example "charlie 12.234.2.1 alice" tells OS network adapter that one ip refers to two box names.

Due to similar functionality of /etc/hosts and /etc/networks, /etc/networks is removes from many linux based Systems. Linux based Fedora, RedHat linux and Ubuntu no more have /etc/networks file.

1 comment:

  1. If you forget that -n option, netstat will do reverse name lookups on the addresses. If they don't resolve, because of absence of a nameserver the DNS requests will time out, and that can cause considerable delays.

    fldrclnr.dll

    ReplyDelete