Wiki DE Start in the browser

Wiki › Protocols

DNS

Translating names into addresses: zones, records (A, AAAA, CNAME, MX, PTR …), forwarding, cache and nslookup.

Layer
7 (Anwendung, über UDP 53)
Standard
RFC 1034, RFC 1035, RFC 3596 …
See an example
See demo

What for

People remember www.schule.example, devices need 192.168.0.3. The Domain Name System translates names into addresses. Every computer has a DNS server configured for this (static or via DHCP) and asks it before opening a connection.

Records

TypemapsExample
Aname → IPv4 addressweb.schule.example A 192.168.0.3
AAAAname → IPv6 addressweb AAAA 2001:db8::3
CNAMEalias → another namewww CNAME web
MXdomain → mail server (with preference)schule.example MX 10 mail
NSdomain → responsible name server
PTRaddress → name (reverse lookup)
TXTfree text

Every record has a TTL: a client may keep the answer in its cache for that long.

How a query works

  1. The browser wants www.schule.example and asks the DNS server (UDP, port 53).
  2. The server finds www as a CNAME for web and the A record for it.
  3. It answers authoritatively with the chain; the client remembers the result.
  4. If the server does not know the zone, it forwards to another DNS server (e.g. the provider’s) and answers “non-authoritative”.

Example names end in .example, a domain that according to RFC 2606 is never assigned.

Recursive and iterative

A PC asks its DNS server recursively: “Give me the finished answer.” The server (resolver) then continues iteratively itself: first a root server, which refers to the servers of the top-level domain, these refer to the responsible server of the domain, and only that one answers with the address (RFC 1034, Section 4.3.1). Every answer has a TTL; it may be cached for that long, and the next question is answered faster.

In leyoNET a DNS server can forward queries it cannot answer itself to another server (forwarder). That corresponds to the resolver that keeps asking on behalf of its clients.

In leyoNET

A server becomes a DNS server under Advanced → Services and gets a zone.

C:\> nslookup www.schule.example
C:\> nslookup -type=MX schule.example
C:\> nslookup 192.168.0.3
C:\> ipconfig /displaydns
C:\> ipconfig /flushdns

How to do it in leyoNET

The same text as in the app’s help (F1 key).

DNS

DNS translates names into addresses and back. The client asks its DNS server via UDP port 53 and caches the answer for its TTL (ipconfig /displaydns, ipconfig /flushdns).

  • A and AAAA: name → IPv4 or IPv6 address
  • CNAME: alias for another name (the server follows the chain)
  • MX: mail server of a domain; the smallest preference wins
  • TXT: text, e.g. an SPF rule
  • NS: name server of the domain
  • PTR: address → name (reverse lookup under in-addr.arpa or ip6.arpa)

The server answers names in its own zone authoritatively. With forwarding it asks another server (e.g. the provider's) for all other names and answers “non-authoritative”. Test with nslookup -type=MX school.example, nslookup 192.168.0.3 (PTR) or nslookup name server (ask a specific server).

See an example

  • Demo “DNS with forwarding” in leyoNETDemo “DNS with forwarding” in leyoNET
    DNS with forwarding

    School DNS with the zone schule.example (A, CNAME, MX, TXT, NS, PTR) that forwards unknown names to the provider's DNS.

    PC 1 resolves an alias through two CNAMEs, looks up the mail server (MX) and opens a page at the provider: the school DNS forwards the question and answers “non-authoritative”.

    Watch live Project file

“Watch live” opens the network in leyoNET, the simulation runs in a loop. In the app you find it under File → Demo networks, with a step-by-step tour.

Practise

  • ★★★☆☆ Open a web page via DNS · 3 goals · Worksheet (German)
  • ★★★★☆ UE02 network services: web server, DNS and fixed assignments · 19 goals · Worksheet (German)
  • ★★★★☆ Protocol analysis – Task 3: ARP, DNS and HTTP · 7 goals · Worksheet (German)

In leyoNET under Tools → Exercise catalogue. Every exercise checks itself.

What leyoNET simplifies

ProtocolLayerSimplification in the simulation
DNS7Records A, AAAA, CNAME (also chains), MX with preference, TXT, NS, PTR (in-addr.arpa, ip6.arpa); authoritative answers from the zone, forwarding to another DNS server with cache (“non-authoritative”), NXDOMAIN, NODATA and SERVFAIL; client cache by TTL; nslookup -type=…. No zone transfer, no DNSSEC, no own recursion via the root servers

Standards

  • RFC 1034 – Domain Names – Concepts and Facilities
  • RFC 1035 – Domain Names – Implementation and Specification
  • RFC 3596 – DNS Extensions to Support IP Version 6
  • RFC 2606 – Reserved Top Level DNS Names

Read on

Found a mistake or have an idea? Source of this page on GitHub.