This script is designed to validate and, if necessary, correct the system’s configured Fully Qualified Domain Name (FQDN) on Debian/Ubuntu (and similar) systems. It:
- Checks if the current operating system is a Debian/Ubuntu (APT-based) distribution.
- Ensures required system commands are installed, attempting silent installation via apt-get if necessary.
- Identifies the default route’s interface for both IPv4 and IPv6.
- Retrieves the primary global (i.e., non-local) IPv4 and IPv6 addresses on those interfaces.
- Performs reverse DNS lookups on those local addresses to determine their FQDNs.
- Ensures that the forward DNS record for that FQDN matches both IP addresses.