Home Explore Blog CI



man-pages

2nd chunk of `hostname.man`
c04c58c1261f4fe981d5605dd6e174dabbf4df344e777b8f0000000100000a1f
 hostname  was  "ursula",  one  might  have  a line in
       /etc/hosts which reads

              127.0.1.1    ursula.example.com ursula

       Technically: The FQDN is the name getaddrinfo(3) returns  for  the  host
       name  returned by gethostname(2).  The DNS domain name is the part after
       the first dot.

       Therefore it depends on the configuration of the  resolver  (usually  in
       /etc/host.conf)  how you can change it. Usually the hosts file is parsed
       before DNS or  NIS,  so  it  is  most  common  to  change  the  FQDN  in
       /etc/hosts.

       If  a  machine has multiple network interfaces/addresses or is used in a
       mobile environment, then it may either have multiple FQDNs/domain  names
       or none at all. Therefore avoid using hostname --fqdn, hostname --domain
       and dnsdomainname.  hostname --ip‐address is subject to the same limita‐
       tions so it should be avoided as well.

OPTIONS
       -a, --alias
              Display the alias name of the host (if used). This option is dep‐
              recated and should not be used anymore.

       -A, --all‐fqdns
              Displays  all  FQDNs  of  the machine. This option enumerates all
              configured network addresses on  all  configured  network  inter‐
              faces,  and  translates  them to DNS domain names. Addresses that
              cannot be translated (i.e. because they do not have an  appropri‐
              ate  reverse IP entry) are skipped. Note that different addresses
              may resolve to the same name, therefore the  output  may  contain
              duplicate entries. Do not make any assumptions about the order of
              the output.

       -b, --boot
              Always set a hostname; this allows the file specified by -F to be
              non‐existent  or empty, in which case the default hostname local‐
              host will be used if none is yet set.

       -d, --domain
              Display the name of the DNS domain.  Don’t use  the  command  do‐
              mainname  to get the DNS domain name because it will show the NIS
              domain name and not the DNS domain name.  Use  dnsdomainname  in‐
              stead.  See the warnings in section THE FQDN above, and avoid us‐
              ing this option.

       -f, --fqdn, --long
              Display the FQDN (Fully Qualified Domain Name). A  FQDN  consists
              of  a short host name and the DNS domain name. Unless you are us‐
              ing bind or NIS for host lookups you can

Title: FQDN Configuration, Options for Hostname and Domain Name Commands
Summary
This section describes how to configure the Fully Qualified Domain Name (FQDN) in /etc/hosts and explains the technical definition of FQDN and DNS domain name. It also warns against using certain `hostname` options like `--fqdn`, `--domain`, and `dnsdomainname` in environments with multiple network interfaces or mobile usage. The OPTIONS section details the usage of various flags for the `hostname` command, including `--alias`, `--all-fqdns`, `--boot`, `--domain`, and `--fqdn/--long`.