1.. zephyr:code-sample:: mdns-responder 2 :name: mDNS responder 3 :relevant-api: net_core dns_sd bsd_sockets 4 5 Listen and respond to mDNS queries. 6 7Overview 8******** 9 10This application will wait mDNS queries for a pre-defined hostname and 11respond to them. The default hostname is **zephyr** and it is set in the 12:file:`prj.conf` file. 13 14Requirements 15************ 16 17- :ref:`networking_with_host` 18 19- avahi or similar mDNS capable application that is able to query mDNS 20 information. 21 22Building and Running 23******************** 24 25Build and run the mdns-responder sample application like this: 26 27.. zephyr-app-commands:: 28 :zephyr-app: samples/net/mdns_responder 29 :board: <board to use> 30 :conf: <config file to use> 31 :goals: build 32 :compact: 33 34After the mdns-responder sample application is started, it will await queries 35from the network. 36 37Open a terminal window in your host and type: 38 39.. code-block:: console 40 41 $ avahi-resolve -4 -n zephyr.local 42 43If the query is successful, then following information is printed: 44 45.. code-block:: console 46 47 zephyr.local 192.0.2.1 48 49For a IPv6 query, type this: 50 51.. code-block:: console 52 53 $ avahi-resolve -6 -n zephyr.local 54 55If the query is successful, then following information is printed: 56 57.. code-block:: console 58 59 zephyr.local 2001:db8::1 60 61Lastly, resolve services using DNS Service Discovery: 62 63.. code-block:: console 64 65 $ avahi-browse -t -r _zephyr._tcp 66 67If the query is successful, then the following information is printed: 68 69.. code-block:: console 70 71 + zeth IPv6 zephyr _zephyr._tcp local 72 = zeth IPv6 zephyr _zephyr._tcp local 73 hostname = [zephyr.local] 74 address = [192.0.2.1] 75 port = [4242] 76 txt = [] 77 78Wi-Fi 79===== 80 81The IPv4 Wi-Fi support can be enabled in the sample with 82:ref:`Wi-Fi snippet <snippet-wifi-ipv4>`. 83