samples/net/mdns_responder/README.html · samples/net/mdns_responder/README.rst 공식 원문 ↗

Zephyr 3.7.0 · Samples · Networking · DNS-SD

mDNS Responder

Avahi로 zephyr.local의 IPv4·IPv6 address와 _zephyr._tcp service를 조회합니다.

Official pathsamples/net/mdns_responder/README.html
Source filesamples/net/mdns_responder/README.rst
Source versionZephyr 3.7.0
TranslationFull · reviewed

본문 기준: Zephyr 3.7.0 LTS3 · 이후 유지보수 패치는 별도입니다.

Part 1

요약·해설

IPv4·IPv6 query와 service discovery의 7개 command/output block 및 port 4242를 보존합니다.

Hostname

zephyr.local

Service

_zephyr._tcp

Port

4242

Part 2

접을 수 있는 영어 원문 전체

영어 원문 전체 펼치기
원문 SHA-256 A494B4D3A2EB6E11D1834EC3B2B3E643A079E0896031A187C57FC08387258D8F
.. zephyr:code-sample:: mdns-responder
   :name: mDNS responder
   :relevant-api: net_core dns_sd bsd_sockets

   Listen and respond to mDNS queries.

Overview
********

This application will wait mDNS queries for a pre-defined hostname and
respond to them. The default hostname is **zephyr** and it is set in the
:file:`prj.conf` file.

Requirements
************

- :ref:`networking_with_host`

- avahi or similar mDNS capable application that is able to query mDNS
  information.

Building and Running
********************

Build and run the mdns-responder sample application like this:

.. zephyr-app-commands::
   :zephyr-app: samples/net/mdns_responder
   :board: <board to use>
   :conf: <config file to use>
   :goals: build
   :compact:

After the mdns-responder sample application is started, it will await queries
from the network.

Open a terminal window in your host and type:

.. code-block:: console

    $ avahi-resolve -4 -n zephyr.local

If the query is successful, then following information is printed:

.. code-block:: console

    zephyr.local	192.0.2.1

For a IPv6 query, type this:

.. code-block:: console

    $ avahi-resolve -6 -n zephyr.local

If the query is successful, then following information is printed:

.. code-block:: console

    zephyr.local	2001:db8::1

Lastly, resolve services using DNS Service Discovery:

.. code-block:: console

    $ avahi-browse -t -r _zephyr._tcp

If the query is successful, then the following information is printed:

.. code-block:: console

    +   zeth IPv6 zephyr                                        _zephyr._tcp         local
    =   zeth IPv6 zephyr                                        _zephyr._tcp         local
       hostname = [zephyr.local]
       address = [192.0.2.1]
       port = [4242]
       txt = []

Part 3

한국어 전문 번역

개요

이 application은 미리 정의한 hostname에 대한 mDNS query를 기다렸다가 응답합니다.

기본 hostname은 zephyr이며 prj.conf file에서 설정합니다.

요구 사항

Build와 실행

다음과 같이 mdns-responder sample application을 build합니다.

west build -b <board to use> samples/net/mdns_responder -- -DCONF_FILE=<config file to use>

Sample application이 시작되면 network에서 들어오는 query를 기다립니다.

Host terminal에서 다음 명령으로 zephyr.local의 IPv4 address를 query합니다.

$ avahi-resolve -4 -n zephyr.local

Query가 성공하면 다음 정보가 출력됩니다.

zephyr.local        192.0.2.1

IPv6 address는 다음 명령으로 query합니다.

$ avahi-resolve -6 -n zephyr.local

Query가 성공하면 다음 정보가 출력됩니다.

zephyr.local        2001:db8::1

마지막으로 DNS Service Discovery를 사용해 service를 resolve합니다.

$ avahi-browse -t -r _zephyr._tcp

Query가 성공하면 _zephyr._tcp service의 hostname, address, port와 TXT data가 다음과 같이 출력됩니다.

+   zeth IPv6 zephyr                                        _zephyr._tcp         local
=   zeth IPv6 zephyr                                        _zephyr._tcp         local
   hostname = [zephyr.local]
   address = [192.0.2.1]
   port = [4242]
   txt = []

Source

출처

영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.