1.. _net_hostname_interface: 2 3Hostname Configuration 4###################### 5 6.. contents:: 7 :local: 8 :depth: 2 9 10Overview 11******** 12 13A networked device might need a hostname, for example, if the device 14is configured to be a mDNS responder (see :ref:`dns_resolve_interface` for 15details) and needs to respond to ``<hostname>.local`` DNS queries. 16 17The :kconfig:option:`CONFIG_NET_HOSTNAME_ENABLE` must be set in order 18to store the hostname and enable the relevant APIs. If the option is enabled, 19then the default hostname is set to be ``zephyr`` by 20:kconfig:option:`CONFIG_NET_HOSTNAME` option. 21 22If the same firmware image is used to flash multiple boards, then it is not 23practical to use the same hostname in all of the boards. In that case, one 24can enable :kconfig:option:`CONFIG_NET_HOSTNAME_UNIQUE` which will add a unique 25postfix to the hostname. By default the link local address of the first network 26interface is used as a postfix. In Ethernet networks, the link local address 27refers to MAC address. For example, if the link local address is 28``01:02:03:04:05:06``, then the unique hostname could be 29``zephyr010203040506``. If you want to set the prefix yourself, then call 30``net_hostname_set_postfix()`` before the network interfaces are created. 31For example for the Ethernet networks, the initialization priority is set by 32:kconfig:option:`CONFIG_ETH_INIT_PRIORITY` so you would need to set the postfix before 33that. The postfix can be set only once. 34 35API Reference 36************* 37 38.. doxygengroup:: net_hostname 39