0
votes

From The Linux Programming Interface

struct utsname {
    char sysname[_UTSNAME_LENGTH];      /* Implementation name */
    char nodename[_UTSNAME_LENGTH];     /* Node name on network */
    char release[_UTSNAME_LENGTH];      /* Implementation release level */
    char version[_UTSNAME_LENGTH];      /* Release version level */
    char machine[_UTSNAME_LENGTH];      /* Hardware on which system
                                           is running */
#ifdef _GNU_SOURCE                      /* Following is Linux-specific */
    char domainname[_UTSNAME_LENGTH];   /* NIS domain name of host */
#endif
};

The nodename field returns the value that was set using the sethostname() system call (see the manual page for details of this system call). Often, this name is something like the hostname prefix from the system’s DNS domain name.

The domainname field returns the value that was set using the setdomainname() system call (see the manual page for details of this system call). This is the Network Information Services (NIS) domain name of the host (which is not the same thing as the host’s DNS domain name).

Is nodename used by some DNS server for resolving the hostname of the current machine to its IP address? If yes, which DNS server is that?

Does sethostname() send a new value of nodename from the local machine to the DNS server to update the hostname in the DNS record for the local machine?

Similar questions for domainname and setdomainname(), if possible.

1

1 Answers

1
votes

No, sethostname mere updates a name in the kernel, and this part of the kernel knows nothing at all about DNS.

What can happen is that if you use glibc and have certain NSS modules (such as myhostname from systemd), they might react automatically to the host name change in the kernel. This affects name resolution (mapping from names to IP addresses), but does not involve DNS, either.