Raspberry Pi assigns its network name through DHCP or manual configuration during setup.
Raspberry Pi assigns its network name through DHCP or manual configuration during setup.
Observing the behavior shows the hostname is exposed during imager setup. This happens because the imager configs the network settings so external devices can reach it. To achieve similar access in a standard Linux system, you’d need to adjust firewall rules and possibly use a service like iptables or ufw to allow traffic on the relevant ports while keeping the hostname hidden from default browsing.
More precisely, when the device initiates a DHCP request it transmits both the MAC address and the hostname. At that point the router selects this information and adds it to its own DNS table. I usually configure these settings statically on the router, since dynamic allocation might force a restart of the DNS server each time a DHCP request occurs, causing temporary DNS disruptions across the entire LAN.
In my configuration, I use fixed DHCP/DNS settings for all stationary devices—meaning not laptops or phones. This works well for headless systems like servers or Raspberry Pi units in the room corner that act as IoT nodes, giving a consistent IP when troubleshooting remotely. It’s typically needed when you need port forwarding to expose services from outside.