Resolve hostname locally without DNS using hosts configuration file

Computer Configuration GNU Linux Fedora using Linux Command


   The hosts configuration file that is reside under /etc directory is useful to resolve the hostname locally without the use of the DNS server.  The hosts configuration file can configure to map the local network host on your intranet network or internet network without the use of DNS.

The example of hosts configuration file under Linux Fedora 9: 

View the contents of Linux Fedora 9 hosts configuration file

[root@fedora ~]# cat /etc/hosts

# Do not remove the following line, or various programs

# that require network functionality will fail. localhost.localdomain localhost localhost

::1 localhost6.localdomain6 localhost6

[root@fedora ~]#


Using the ls -l command to show the hosts file permission, owner, group owner, file size, date created or edited and file location.

List hosts file on Linux Fedora

[root@fedora ~]# ls -l /etc/hosts

-rw-r--r-- 2 root root 197 2008-08-19 05:35 /etc/hosts

[root@fedora ~]#