
A FQDN is a fully qualified domain name that includes the hostname and the domain name, such as "server.example.com". This makes it a more specific and unique identifier for a device on the internet.
In contrast, a hostname is a shorter and more general term that can refer to any device on a network, such as "server" without the domain name.
A hostname can be used to identify a device on a local network, while a FQDN is used to identify a device on the internet.
A fresh viewpoint: Nextjs Set Hostname
What is FQDN and Hostname?
A fully qualified domain name (FQDN) is the complete domain name of a specific server or host on the Internet. It's like a complete path to a certain host, where each part of a domain name specifies one part of the path.
An FQDN consists of the Hostname and Domain, making it the absolute value of the DNS hierarchy from the lowest level to the top level domain (TLD). For example, an FQDN value could be "bob-berto-pc.bigwheel.corporation.local".
The Hostname is the unique identifier for a server or host, similar to how an apartment number identifies a specific unit in a building. The Domain is the name of the organization or entity that the server or host belongs to.
A hostname, on the other hand, is just the Hostname part of the FQDN, without the Domain. So, if the FQDN is "bob-berto-pc.bigwheel.corporation.local", the hostname would be "bob-berto-pc".
Importance and Use Cases
Using an FQDN, or Fully Qualified Domain Name, is useful for many reasons. It helps identify your site uniquely, whether you're a site administrator or just a visitor.
Having an FQDN is useful for many possible reasons, including providing a unique identifier for your site. This is especially important for site administrators who need to manage multiple sites or troubleshoot issues.
Using an FQDN is essential for accessing your site remotely or through a web browser. This is because it includes the domain name and the path to your site, making it a more specific and reliable way to access your site.
Having a unique FQDN can help prevent confusion or conflicts with other sites that have similar hostnames. This is especially important if you're managing multiple sites or working with a team that needs to access different sites.
Using an FQDN can also be helpful when setting up email accounts or other services that require a unique identifier for your site. This is because the FQDN provides a clear and specific way to identify your site.
Implementation and Configuration
To avoid ambiguity in log sources, we'll define clear definitions for FQDN, Domain, and Hostname. This way, we can distinguish between the three without confusion.
The definitions apply to both source and destination FQDNs, Domains, and hostnames. If you only see destination verbiage, simply replace it with source for the applicable log scenario.
In order to configure the hostname and FQDN correctly, the hostname should be set to its FQDN using the hostname or hostnamectl command. This is preferred over modifying the Apache server name configuration.
Ideally, the network where the server is installed should have a DNS set up to resolve hostnames. However, in cases where there is no DNS, static hostnames can be used.
Static hostnames can be set using the hostname or hostnamectl command, and the /etc/hostname file should be updated to match. The /etc/hosts file should also be updated to include the FQDN followed by the host portion.
If setting the hostname to the FQDN is not possible, then setting the FQDN in the /etc/hosts file is necessary. Adding the FQDN to /etc/hosts can also fix issues where some operating systems give a warning on Apache startup.
The system configuration determines what order is used to resolve the FQDN. For example, the /etc/nsswitch.conf file defines the order as: hosts:dns myhostname files. This means that DNS is queried first, followed by the hostname, and then configuration files.
In some cases, the /etc/host.conf file is used to resolve the hostname, with a line like order hosts, bind. This defines the order as: the /etc/hosts file is checked first, and then the DNS.
Check this out: Static vs Dynamic Websites
Troubleshooting and Examples
Determining what's truly the FQDN, Hostname, or Domain can be tricky, especially when dealing with logging.
A common example of ambiguity is when a server has a hostname that matches its domain name, making it difficult to distinguish between the two.
Let's use some real-life examples to illustrate the complexity of this issue.
In one scenario, a company has a server named "server1" in the domain "example.com", making it unclear whether "server1" is the hostname or the FQDN.
Implementation Examples
In troubleshooting, knowing where to look for specific information is crucial. For instance, when analyzing Sysmon EventID:3, you should set the DestinationHostName field as dst_host_name.
Let's take a closer look at some implementation examples. Sysmon EventID:22 dns query event log field for QueryName should be set as dst_host_name.
When it comes to HTTP or Proxy or web server application logs, such as IIS, Apache, or NGINX, the hostname/domain field should be set as dst_host_name.
Here are some specific examples of how to set dst_host_name:
- TLS/SSL server name (SNI) should be set as dst_host_name.
- Kerberos service name should be set as dst_host_name.
- DNS query name field should be set as dst_host_name.
In some cases, you may need to parse the hostname/domain portion out of a URL. For example, if you have a URL like "https://example.com/path/to/resource", the hostname/domain portion is "example.com".
On the other hand, RDP client/source name should be set as src_host_name.
If you're working with endpoint logs, be aware that some logs may not be applicable to the use cases above. In such cases, check if the log is already defined in data dictionaries or if it logically fits into the Target or category.
Examples of Ambiguity
In the world of logging, ambiguity can be a real challenge. Let's take the example of a private web server, where the issue is related to using the fully-qualified domain name (FQDN) versus just the hostname in the URL.
Using the FQDN can lead to a login page displaying, but a logon attempt simply reloading, as seen in the example with the servername.domain.name.tld:52773/csp/sys/UtilHome.csp URL. This issue is not unique to the private web server, as it's also seen in other servers with identical configurations.
See what others are reading: Web Developer vs Programmer

The problem seems to be related to browser caching, as switching to incognito mode or clearing cookies/cache resolves the issue. This is evident in the example where Chrome worked fine for other servers but not for the two problem servers, until incognito mode or cookie clearing was used.
In another scenario, a proxy log defines the field as hostname, while the endpoint log defines it as DestinationDomain, and the DNS log defines it as dns_query. This highlights the importance of defining fields in a common format to enable pivoting between related logs.
To clarify the ambiguity, we can define common field names, such as dst_host_name, dst_domain, dst_fqdn, src_host_name, src_domain, and src_fqdn. This can help to eliminate confusion caused by log source field names.
These definitions can be applied to both source and destination FQDNs, domains, and hostnames, making it easier to pivot between related logs and troubleshoot issues.
How to Get and Set Them
Getting and setting FQDNs and hostnames can be a bit tricky, but don't worry, I've got you covered.
To get the FQDN, you can use the command `hostname --fqdn` or `dnsdomainname`. However, be aware that using `hostname --fqdn` can lead to incorrect results, especially in mobile environments or when a machine has multiple network interfaces.
The FQDN is the fully qualified domain name, which consists of a short hostname and the DNS domain name. For example, if the hostname is `dev-qa001` and the domain is `test.com`, the FQDN would be `dev-qa001.test.com`.
You can also use the `hostname -f` command to get the FQDN.
To set the FQDN, you can modify the `/etc/hosts` file. This file contains a list of IP addresses and their corresponding hostnames and FQDNs. For example, if you want to set the FQDN for a machine with the IP address `10.59.74.121`, you would add a line like this: `10.59.74.121 CentOS-6-121.test.com CentOS-6-121`.
Alternatively, you can use DNS to resolve the FQDN. This involves setting up a DNS server that can resolve the hostname to the correct FQDN.
Here's a summary of the commands and methods you can use to get and set FQDNs and hostnames:
Remember to be careful when modifying the `/etc/hosts` file, as incorrect entries can cause problems with hostname resolution.
Frequently Asked Questions
Should etc. hostname be FQDN?
No, the /etc/hostname file should not contain the FQDN. Instead, use /etc/hosts or a DNS service to set the hostname as an alias for the fully qualified name.
Featured Images: pexels.com


