> ## Documentation Index
> Fetch the complete documentation index at: https://docs.siderolabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Hostname

> Learn how to configure the hostname for your Talos nodes.

export const VersionWarningBanner = () => {
  const latestVersion = "v1.13";
  const [latestUrl, setLatestUrl] = useState(null);
  const [currentVersion, setCurrentVersion] = useState(null);
  const [isBeta, setIsBeta] = useState(false);
  const parseVersion = v => v.replace("v", "").split(".").map(Number);
  const isGreaterVersion = (a, b) => {
    const [aMajor, aMinor] = parseVersion(a);
    const [bMajor, bMinor] = parseVersion(b);
    if (aMajor > bMajor) return true;
    if (aMajor === bMajor && aMinor > bMinor) return true;
    return false;
  };
  useEffect(() => {
    if (typeof window === "undefined") return;
    const {pathname, hash, search} = window.location;
    const match = pathname.match(/\/talos\/(v\d+\.\d+)\//);
    if (!match) return;
    const detectedVersion = match[1];
    if (detectedVersion === latestVersion) return;
    setCurrentVersion(detectedVersion);
    if (isGreaterVersion(detectedVersion, latestVersion)) {
      setIsBeta(true);
    }
    const newPath = pathname.replace(`/talos/${detectedVersion}/`, `/talos/${latestVersion}/`);
    setLatestUrl(`${newPath}${search}${hash}`);
  }, []);
  if (!latestUrl || !currentVersion) return null;
  return <div className="not-prose sticky top-6 z-50 my-6">
      <div className="border border-yellow-500/30 bg-yellow-500/10 px-4 py-3 rounded-xl">
        <div className="text-sm">
          {isBeta ? <>
              ⚠️ You are viewing a <strong>beta version</strong> of Talos ({currentVersion}).
              This version may be unstable.
              <a href={latestUrl} className="ml-2 underline text-yellow-400 hover:text-yellow-300 font-medium">
                View latest stable version {latestVersion} →
              </a>
            </> : <>
              ⚠️ You are viewing an older version of Talos ({currentVersion}).
              <a href={latestUrl} className="ml-2 underline text-yellow-400 hover:text-yellow-300 font-medium">
                View the latest version {latestVersion} →
              </a>
            </>}
        </div>
      </div>
    </div>;
};

<VersionWarningBanner />

By default, the Talos Linux generates a default stable hostname for each machine based on machine ID like `talos-2ld-dvw`.
This default hostname can be overridden by DHCP-provided hostname, platform (cloud) metadata, or manually configured hostname.

## Configuration

The default configuration document for the hostname looks like this ([HostnameConfig](../../reference/configuration/network/hostnameconfig)):

```yaml theme={null}
apiVersion: v1alpha1
kind: HostnameConfig
auto: stable
```

The `auto` field can have the following values:

* `stable`: generates a stable hostname based on machine ID (default).
* `off`: disables automatic hostname generation, resulting in Talos waiting for another source (DHCP, cloud metadata, manual configuration) to set the hostname.

To manually set a specific hostname, create a `HostnameConfig` document with the desired hostname:

```yaml theme={null}
apiVersion: v1alpha1
kind: HostnameConfig
hostname: my-custom-hostname
```

When patching default machine config to set a custom hostname, use the following patch (auto hostname should be disabled):

```yaml theme={null}
apiVersion: v1alpha1
kind: HostnameConfig
hostname: my-custom-hostname
auto: off
```

## Observing status

Use `talosctl` to get the current hostname of a node:

```bash theme={null}
$ talosctl get hostname
NODE         NAMESPACE   TYPE             ID         VERSION   HOSTNAME                       DOMAINNAME
172.20.0.2   network     HostnameStatus   hostname   3         talos-default-controlplane-1
```

To see all hostname configuration sources, use the following:

```bash theme={null}
$ talosctl get hostnamespec --namespace=network-config
NODE         NAMESPACE        TYPE           ID                      VERSION
172.20.0.2   network-config   HostnameSpec   default/hostname        1
172.20.0.2   network-config   HostnameSpec   dhcp4/enp0s2/hostname   1
```
