2009年12月18日 星期五

Linux Command - hostname

// Do the hostname positive/negative resolution

// hostname will print the name of the system as returned by the gethostname(2) function.
# hostname

// "-a", Display the alias name of the host (if used).
# hostname -a
// "-f", Display the FQDN (Fully Qualified Domain Name). A FQDN consists of a short host name and the DNS domain name. Unless you are using bind or NIS for host lookups you can change the FQDN and the DNS domain name (which is part of the FQDN) in the /etc/hosts file.
# hostname -f

http://www.faqs.org/docs/securing/chap9sec95.html

example /etc/hosts file:
IPAddress Hostname Alias
127.0.0.1 localhost deep.openna.com
208.164.186.1 deep.openna.com deep
208.164.186.2 mail.openna.com mail
208.164.186.3 web.openna.com web

The leftmost column is the IP address to be resolved. The next column is that host's name. Any subsequent columns are alias for that host. In the second line, for example, the IP address 208.164.186.1 is for the host deep.openna.com. Another name for deep.openna.com is deep.

沒有留言: