Skip to main content
  • Products
  • Evaluate our Software
  • Downloads
  • Free Utilities
  • Purchase
  • Support
  • About Us
  • Blog
  • Forum
  • Search
    • Contact Us
    • Forum
    • Knowledge Base
    • Web Shop
    • Newsletter
    • RSS
  •   Jobs
  •   Videos
  •   Blog
  •   Sustainability
  • emNet
  • Domain name resolution
  • Technology
  • Add-Ons
  • Tools

Domain name resolution

The emNet TCP/IP stack provides a way to easily discover a target by its name.

Contact us
Downloads
Documentation
SEGGER emNet
  1. 1.Overview
    1. 1.1.Key features
  2. 2.Background
    1. 2.1.Example
  3. 3.Service discovery
  4. 4.Resource usage
  5. 5.Relevant parts

Overview

The emNet TCP/IP stack provides a way to easily discover a target by its name. For targets used as client, both Apple multicast DNS (mDNS / Bonjour) and Microsoft Link-Local Multicast Name Resolution (LLMNR) are supported. When the target is used as server, a simple DNS server can be used. The add-on also provides a simple support for service discovery (DNS-SD).

Key features

  • Low memory footprint
  • Makes your target easily discoverable
  • Supports protocols for Windows, MacOS and Linux
  • Easy to implement

Background

The different specifications are all based on UDP messages with DNS format. They serve the same purpose to easily identify a target by its name without prior knowledge of its IP address, or to discover the service it is proposing like a web server for example.

mDNS: Apple multicast DNS (mDNS) uses multicast messages on port 5353. A target with a mDNS server could easily be found by a request with its name (by an Apple device for example). The mDNS client is part of the base emNet package and is able to send such requests.

LLMNR: Microsoft Link-Local Multicast Name Resolution (LLMNR) uses multicast messages on port 5355. A target with a LLMNR server could easily be found by a request with its name (by a Windows computer for example). The LLMNR client is part of the base emNet package and is able to send such requests.

Simple DNS server: When the target is used as server, for example with the emNet DHCP server, a client sends unicast requests to the DNS server. The emNet simple DNS server does not provide full DNS server capabilities but covers main requirements with a low memory footprint.

Example

In the following example, a device with a Web server could be easily found by a browser with its name without a prior knowledge of its IP address.

domain name resolution chart

Service discovery

Along with A and AAAA records for the IPv4 and IPv6 addresses, it is also possible to configure SRV, PTR and TXT records. This allows a device to advertise a service and be found by system like Bonjour or equivalent tools (avahi on linux for example).

For example, the following configuration advertises a web server for the device mydevice.local.

//
// Web server discovery configuration
//
static const IP_DNS_SERVER_SD_CONFIG _Config[] = {
  //
  // PTR record _http._tcp.local -> mydevice._http._tcp.local
  //
  {
      .Type    = IP_DNS_SERVER_TYPE_PTR,
      .TTL     = 0,                           // Use main TTL.
      .Config  = {
                   .PTR = {
                            .sName       = "_http._tcp.local",
                            .sDomainName = "mydevice._http._tcp.local"
                          }
                 }
  },
  //
  // SRV record mydevice._http._tcp.local -> mydevice.local port 80
  //
  {
      .Type    = IP_DNS_SERVER_TYPE_SRV,
      .TTL     = 0,                           // Use main TTL.
      .Config  = {
                   .SRV = {
                            .sName       = "mydevice._http._tcp.local",
                            .Priority    = 0,
                            .Weight      = 0,
                            .Port        = 80,
                            .sTarget     = NULL  // Use default hostname mydevice.local
                          }
                 }
  },
  //
  // TXT record. Path of the web server.
  //
  {
      .Type    = IP_DNS_SERVER_TYPE_TXT,
      .TTL     = 0,                           // Use main TTL.
      .Config  = {
                   .TXT = {
                            .sName       = "mydevice._http._tcp.local",
                            .sTXT        = "PATH=/"
                          }
                 }
  }
};

static const IP_DNS_SERVER_CONFIG _DiscoverConfig = {
  .sHostname   = "mydevice.local",
  .TTL         = 120u,
  .NumConfig   = 3,
  .apSDConfig  = _Config
};

The device could then be discovered easily, for example on Linux with avahi-discover tool. In this example the discovery tool and the device exchange the following mDNS messages:

  • Tool sends request: PTR _http._tcp.local to identify web servers.
  • Device replies that it proposes the service mydevice._http._tcp.local
  • Tool sends request: SRV mydevice._http._tcp.local to get service details.
  • Device replies with the SRV information such as the port 80 and server target name mydevice.local.
  • Tool sends request: TXT mydevice._http._tcp.local to get more information.
  • Device replies with the web server path "/"
  • Tool sends request: A mydevice.local and/or AAAA mydevice.local to get the IPv4/IPv6 address.
  • Device replies with its IP address.
AvahiDiscover2Masked

Resource usage

The ROM usage depends on the compiler options, the compiler version and the used CPU. The memory requirements presented below have been measured on a Cortex-M4 system with the default configuration.Only the server is shown below as the client is part of the emNet base package.

ROM Usage

The following resource usage has been measured on an Cortex-M4 system using SEGGER Embedded Studio, size optimized.

Add-onROM
emNet mDNS/LLMNR serverApproximately 3.1 kByte

RAM Usage

The add-on uses a data for the multicast UDP management.

Add-onRAM
emNet mDNS/LLMNR serverApproximately 0.2 kByte

Relevant parts

The relevant parts of the following Request For Comments (RFC) are implemented.

RFC#Description
[RFC 6762]Direct Link: Multicast DNS
[RFC 4795]Direct Link: Link-Local Multicast Name Resolution (LLMNR)
[RFC 6763]Direct Link: DNS-Based Service Discovery
[RFC 2782]Direct Link: A DNS RR for specifying the location of services (DNS SRV)
[RFC 1035]Direct Link: DOMAIN NAMES - IMPLEMENTATION AND SPECIFICATION

Headquarters

SEGGER Microcontroller GmbH

Ecolab-Allee 5
40789 Monheim am Rhein, Germany
info@segger.com
Tel.: +49-2173-99312-0
Fax: +49-2173-99312-28

Locations

USA: SEGGER Microcontroller Systems LLC

Boston area
101 Suffolk Lane
Gardner, MA 01440, USA
us-east@segger.com
Tel.: +1-978-874-0299
Fax: +1-978-874-0599

Silicon Valley
Milpitas, CA 95035, USA
us-west@segger.com
Tel.: +1-408-767-4068

China: SEGGER Microcontroller China Co., Ltd.

Room 218, Block A, Dahongqiaoguoji
No. 133 Xiulian Road
Minhang District, Shanghai 201199, China
china@segger.com
Tel.: +86-133-619-907-60

ISO 9001 certified

ISO 9001

30+ years of experience

First-class embedded software tools since 1992
  • Imprint
  • Disclaimer
  • Privacy Policy
© 2025 SEGGER - All rights reserved.