Application Layer 1: HTTP and DNS

1. What it includes

The application layer includes network applications and the protocols they use. Many examples are mentioned:

  • email
  • web browsing
  • chat
  • streaming
  • messaging apps
  • voice/video conferencing
  • search engines
  • remote work tools
  • games
  • Internet-connected cars
  • smart home devices

The point is that networking is deeply embedded in modern digital life.

2. Writing a Network Application

If someone wants to build a networked application, they write code that runs on end systems and communicates over the network.

Important idea:

  • the application developer does not implement the network core
  • the application uses existing network services
  • the application lives at the edge
  • this enables rapid development of new applications

This edge-centric development model is one reason the Internet supports fast innovation.

3. Application Architectures

The lecture contrasts two main architectures.

3.1. Client-server model

In the client-server model:

  • clients send requests
  • servers are typically always on
  • servers often have stable names and addresses
  • clients may be intermittently connected
  • clients may use dynamic IP addresses
  • clients usually communicate through the server, not directly with each other

Examples given include HTTP and FTP. Servers are often placed in data centers and may run as virtual machines rather than as dedicated physical machines.

3.2. Peer-to-peer model

In a peer-to-peer model:

  • hosts communicate directly with each other
  • each host can act as both client and server
  • there is no need for one central always-on server

Advantages:

  • adding peers can also add service capacity

Challenges:

  • peers may be intermittently connected
  • peer discovery is non-trivial
  • peers may have highly unequal resources
  • many users prefer consuming resources rather than contributing them
  • management and routing can be complex
  • scaling is not automatically easy

BitTorrent is used as the classic example. The lecturer notes that peer-to-peer traffic used to be a very large fraction of Internet traffic, but today is much less dominant. Still, torrents remain useful for some software distribution scenarios.

4. Processes and Process-to-Process Communication

A process is simply a running program on a host.

4.1. Client and server processes

  • the client process initiates communication
  • the server process must already be running to receive contact

This distinction still makes sense even in peer-to-peer systems, because a peer can play either role at different times.

4.2. Role of the operating system

Processes do not directly inject packets into the network.

Instead, communication goes through the operating system, which provides the interface used by applications.

5. Sockets

The lecture introduces the socket as the interface between an application and the transport/networking functionality provided by the operating system.

5.1. Intuition

A socket is like a door:

  • the application hands data to the socket
  • the OS then takes care of getting it to the destination

5.2. API perspective

The lecturer connects sockets to the Berkeley sockets API, which has remained stable and influential for decades.

A key idea is that many socket operations resemble file operations:

  • open a connection
  • write data
  • read data
  • manage the connection

This familiar interface makes socket programming practical for application developers.

5.3. Design implication

Because lower-layer mechanisms are in the operating system:

  • changing lower layers is harder
  • changing application-layer protocols is much easier

That is one reason application-layer innovation happens quickly.

6. Protocols: Syntax and Semantics

A protocol defines how communicating parties interact.

6.1. Syntax

Syntax defines the form of messages:

  • which fields appear
  • in what order
  • which exact formatting is valid

If syntax is not followed exactly, communication can fail.

6.2. Semantics

Semantics defines what the message means and what action should occur after receiving it.

For example, a request such as asking for the time has a semantic meaning: the receiver should determine and provide the current time.

6.3. Interoperability

A major goal in networking is interoperability:

  • one implementation’s sender should work with another implementation’s receiver

The lecture states that this is why most Internet protocols are open protocols with public specifications. Many are documented in RFCs (Requests for Comments) through the IETF. Proprietary protocols exist, but historically many were reverse engineered.

7. Addressing Processes

To communicate with a process, a host must be identified and then a process on that host must be identified.

7.1. Host identification

A host may have a domain name such as:

  • cnn.com

But machines ultimately need an IP address, such as an IPv4 or IPv6 address. Domain names must therefore be translated to IP addresses.

7.2. Process identification

To identify a process on the destination host, a port number is used.

Examples mentioned:

  • HTTP: port 80
  • HTTPS: port 443
  • SMTP: port 25
  • SSH: port 22
  • Telnet: port 23

The /etc/services file is mentioned as a place where common service/port mappings can be found. DNS tools such as dig can be used to discover IP addresses associated with a domain.

7.3. Socket address

A communicating endpoint is therefore identified by:

  • IP address
  • port number

This pair uniquely identifies the target process on a host. The same port number can exist on different hosts without conflict because the IP addresses differ.

7.4. Port-space scale

Port numbers range up to roughly 65K, giving many possible process endpoints on a single host, though in practice operating-system limits and resource constraints matter.

8. What Applications Need from the Transport Layer

The lecture frames transport-layer services from the perspective of application requirements.

8.1. Reliability / data integrity

Some applications require full, correct delivery:

  • email
  • file upload/download
  • web documents

Partial delivery is unacceptable for these cases.

8.2. Timing

Some applications are delay-sensitive:

  • interactive games
  • certain real-time communications
  • medical scenarios

Others, like email, are not real-time sensitive.

8.3. Throughput

Some applications want sustained throughput:

  • video
  • audio
  • large data transfers

The precise requirement depends on the application.

8.4. Security

Applications may require:

  • confidentiality
  • integrity
  • protection against tampering

These are not automatically provided by basic TCP or UDP.

9. TCP and UDP

9.1. TCP

TCP is presented as offering:

  • reliable transfer
  • flow control
  • congestion control
  • connection-oriented operation

What TCP does not inherently provide:

  • timing guarantees
  • minimum throughput guarantees
  • encryption / security

Flow control prevents overwhelming the receiver.

Congestion control prevents overwhelming the network.

9.2. UDP

UDP provides very little beyond:

  • addressing data to the correct process

It does not provide:

  • reliability
  • flow control
  • congestion control
  • timing guarantees
  • security

So why use it?

  • less overhead
  • no connection setup handshake
  • useful for very small exchanges
  • useful when the application itself is willing to manage missing data or build extra logic on top

The lecturer warns that developers using UDP must be careful, because if they need properties such as congestion control and do not implement them properly, they can damage the network.

9.3. Application examples

The lecture associates transport choices with common applications:

  • file transfer: TCP
  • web documents: TCP
  • Internet telephony: sometimes UDP, sometimes TCP
  • interactive games: often UDP, but TCP is also possible

The choice depends on application goals and deployment realities such as firewall behavior.

10. TLS and Secure Communication

TCP and UDP by themselves do not encrypt data. If encryption is needed, TLS is typically added on top.

10.1. TLS characteristics mentioned

  • it requires another handshake
  • it exchanges security-related information
  • it is commonly used over TCP
  • from the application perspective, it offers an API similar in spirit to sockets
  • applications can often be adapted to use TLS without changing their overall communication structure very much

The lecturer strongly recommends using TLS when implementing networked applications.

10.2. QUIC note

The lecture briefly mentions that there are protocols combining security and UDP-style transport, especially QUIC, and notes that such designs became more practical once UDP-based traffic became more widely accepted in the network.

11. HTTP and the Web

11.1. Web Pages as Objects

A web page is not just one monolithic item.

11.1.1. Components of a web page

A page may contain:

  • a base HTML file
  • images
  • audio
  • video
  • JavaScript
  • additional embedded objects

The browser first retrieves the base HTML and then parses it to discover referenced embedded objects, which are then fetched separately.

11.1.2. URL structure

A URL identifies where and how an object should be fetched. The lecture describes it in terms of:

  • protocol (for example HTTPS)
  • domain name
  • path on that domain

11.2. HTTP as an Application-Layer Protocol

HTTP stands for Hypertext Transfer Protocol.

It is the application-layer protocol used by the web.

11.2.1. Common protocol across clients

Different clients can all speak HTTP:

  • Firefox
  • Chrome
  • command-line tools
  • even a text-based manual interaction

What matters is speaking the protocol correctly, not which interface is used.

11.2.2. Client-server model

HTTP follows a client-server architecture:

  • the browser is the client
  • the web server is the server

The client sends an HTTP request.

The server returns an HTTP response.

11.2.3. Underlying transport

HTTP runs on top of TCP. By default:

  • HTTP uses port 80
  • HTTPS uses port 443

A server waits on the appropriate port, and the client initiates a TCP connection from some ephemeral client-side port, typically above the well-known service range.

11.3. Statelessness of HTTP

A key property emphasized in the lecture is that HTTP is stateless by default.

11.3.1. Meaning of statelessness

Once the TCP connection is closed, the server does not retain conversational state about the client request by default.

That means:

  • every request must include enough information on its own
  • the server does not remember a current directory or ongoing context
  • each object request is independent

This greatly simplifies implementation and recovery from failures, because if something goes wrong, communication can simply be restarted without reconstructing server-side conversational state, and helps explain why HTTP became extremely widespread, even in small devices and appliances.

However, statelessness also creates limitations. Many practical applications require memory of previous interactions, for example:

  • whether a user has authenticated,
  • what items are in a shopping cart,
  • what has already been done in a multi-step interaction.

11.3.2. Consequence

Features such as shopping carts or “welcome back” behavior require adding state on top of basic HTTP. The lecture foreshadows cookies as one mechanism for this.

11.4. HTTP Messages

HTTP uses a request-response model.

11.4.1. Readable text format

The lecture notes that HTTP was intentionally designed in a human-readable format. Advantages:

  • easy debugging
  • easy to inspect in tools and packet traces

Disadvantage:

  • more verbose than binary encoding

This is an engineering tradeoff between compactness and debuggability.

11.4.2. Request format

An HTTP request consists of:

  • a request line,
  • header lines,
  • an empty line,
  • optionally a message body.

The request line contains:

  • the method,
  • the URL,
  • the protocol version.

Typical methods mentioned in the lecture:

GET
retrieve data from the server.
POST
upload data to the server, e.g. through forms.
HEAD
request only metadata, not the body.
PUT
upload/replace a file or resource.

Header lines are key-value pairs, one per line. They may contain information such as:

  • the host name,
  • browser information,
  • accepted content types
  • accepted languages
  • accepted encodings
  • whether the connection should be kept alive

The purpose is to allow the server to tailor the response appropriately.

The empty line separates headers from the body.

The lecture also notes an implementation detail: line endings are not handled identically on all systems. For example, Linux and Windows differ in newline conventions, so implementers must be careful.

A particularly important point is the Host header. Earlier designs without a host header scaled poorly, because a different server would have been needed per hostname. Adding the host header made virtual hosting practical and improved scalability.

11.4.3. Persistent connections

The lecture mentions keep-alive, which allows multiple requests to reuse one TCP connection and thus avoid repeated connection setup overhead.

11.4.4. Interacting with HTTP Manually

The lecture demonstrates that HTTP can be accessed manually through simple tools rather than only through browsers.

Examples mentioned include:

  • telnet for plain HTTP-style interaction
  • packet captures with tcpdump or Wireshark

This reinforces the idea that HTTP is fundamentally just a protocol, not something tied to graphical browsers.

11.4.5. GET vs POST

Although data can sometimes be sent through a GET request using URL arguments, the lecture emphasizes that POST is the cleaner and more appropriate mechanism for uploading data to the server.

The lecturer also gives a security warning: servers must never blindly trust client input. If user-supplied arguments are handled unsafely, they can enable severe vulnerabilities such as remote code execution.

11.4.6. Response format

An HTTP response also has:

  • a status line,
  • header lines,
  • an empty line,
  • a body.

The status line contains:

  • the protocol version,
  • a status code,
  • a human-readable status message.

Examples discussed:

200 OK
success.
301 Moved Permanently
the resource has moved to a new URL.
304 Not Modified
the cached version can still be used.
400 Bad Request
Request msg not understood by server
404 Not Found
the requested object does not exist.
505 HTTP Version Not Supported

The lecture remarks that the style of numeric status codes was historically influenced by earlier protocols such as FTP.

11.4.7. Non-persistent vs persistent HTTP

A major performance issue arises if each object requires a separate TCP connection.

Modern web pages often contain many embedded objects. If each object required:

  • TCP setup,
  • request,
  • response,
  • connection teardown,

then a page with many objects would require many repeated handshakes.

RTT (definition): time for a small packet to travel from client to server and back

For non-persistent HTTP, the minimum response time for one object is roughly:

  • One RTT to initiate TCP connection
  • One RTT for HTTP request and first few bytes of HTTP response to return
  • the object/file transmission time.

If the RTT is large and objects are small, this becomes very inefficient.

Browsers tried to compensate by opening several TCP connections in parallel. However, that increases overhead and server state. The lecture mentions that browsers were limited in how many parallel connections they should open to one server.

Persistent HTTP improves this by reusing the same TCP connection for multiple requests and responses. This avoids repeated handshakes and significantly reduces latency, especially after the main HTML page has been fetched and the client discovers which embedded objects it still needs.

11.5. Cookies and HTTP state

Because HTTP itself is stateless, state has to be added explicitly.

Cookies are small pieces of text stored in the browser. A website can encode values into them and later use them to identify a returning client.

The lecture presents cookies as a four-part mechanism:

  1. a cookie is sent by the server in an HTTP response header;
  2. the browser stores it locally in a cookie file/storage;
  3. future HTTP requests send the cookie back;
  4. the server associates the cookie value with data in its backend database.

This enables stateful behavior on top of stateless HTTP.

11.5.1. Example use case

For an e-commerce site:

  • on the first visit, the server creates a new identifier,
  • stores a corresponding entry in its backend,
  • sends the identifier to the browser as a cookie.

On later visits:

  • the browser returns the cookie,
  • the server recognizes the user,
  • the server can restore state such as a shopping cart or personalization.

Thus cookies support things like:

  • authentication,
  • personalization,
  • webmail sessions,
  • remembering user activity,
  • multi-step transactions.

The core idea is that HTTP requests are still independent, but the client carries a token that lets the server reconnect them to a shared state stored elsewhere.

11.5.2. Cookies, tracking, advertising, and privacy

The lecture then shifts from functional cookies to the broader issue of tracking.

  1. First-party vs third-party cookies
    • First-party cookies are associated with the site the user intentionally visits and are often necessary to provide service.
    • Third-party cookies come from other parties embedded into the page, typically advertisers or trackers.

    Third-party cookies allow cross-site tracking. If the same advertising or tracking company appears on multiple websites, it can correlate the user’s browsing behavior across those sites.

    This explains why searching for some product may lead to repeated advertisements for that same product elsewhere.

  2. Economic logic

    The lecturer stresses that many websites are funded by advertising. If users do not pay with money, they often pay with data. Online ads are attractive because they can be targeted, unlike traditional offline advertising such as posters or TV ads.

    Advertisers may be paid at different levels, for example:

    • for an ad impression,
    • for a click,
    • or for an eventual purchase.

    Because targeted ads are more valuable, tracking infrastructure became central to the web economy.

  3. Privacy concerns

    The lecture is clearly critical of extensive tracking. Personalized ads may be useful for some users, but they also reveal how much websites and ad networks know about browsing behavior.

    Incognito/private browsing is mentioned as a way to reduce persistent local state such as cookies and history, though it is not a complete privacy solution.

    The lecture also notes that even users who reject cookies can sometimes still be tracked by other mechanisms.

  4. GDPR and consent banners

    Cookies can identify individuals and are therefore treated as personal data under GDPR. This is why websites present cookie consent banners and must obtain explicit consent for non-essential tracking.

    However, the lecturer notes that many banners are designed in manipulative ways:

    • accepting cookies is made easy,
    • rejecting them is made cumbersome.

    This is legally supposed to be improved, but in practice implementations vary. The lecture suggests that not all websites fully honor rejection choices.

  5. Ad blockers and trade-offs

    Ad blockers can block trackers and advertisements. However, they create a tension:

    • users want information,
    • websites need revenue,
    • users may refuse both direct payment and data-based payment.

    So ad blocking is presented as a double-edged sword.

  6. Broader social discussion

    The lecture briefly expands beyond protocol mechanics into social and regulatory questions:

    • online anonymity,
    • harmful content,
    • age restrictions,
    • legal enforcement,
    • the difficulty of regulating digital communication without destroying useful flexibility.

    The main message is that technical systems interact with legal and social norms, and not every problem has a purely technical solution.

11.6. Web caching

The next major topic is caching, introduced as a performance optimization.

11.6.1. Basic idea

If users repeatedly access the same objects, fetching them again from the original server is wasteful. A cache stores recently used objects and can return them directly.

A browser typically keeps a local cache. If the requested object is present and considered fresh enough, it can be displayed without contacting the remote server.

11.6.2. Why caching matters

Caching improves:

  • response time,
  • bandwidth usage,
  • scalability.

The lecture uses Google Maps as an intuitive example:

  • already viewed map tiles are kept locally,
  • new tiles are fetched only when needed,
  • the system may even prefetch likely next tiles.

11.6.3. Cache placement

A web cache can be located:

  • at the client,
  • near the server,
  • or somewhere in the network.

A cache can also act like a proxy:

  • server to the client,
  • client to the origin server.

A cache close to the client reduces response time.

A cache close to the server can reduce server load, especially for dynamically generated content.

11.6.4. Cache control

Servers can include cache-related header directives such as:

  • expiration/max-age style information,
  • no-cache or similar restrictions.

These tell caches how they should treat the object.

11.6.5. Conditional requests

Even if a cached copy exists, it may be outdated. To avoid re-downloading the whole object unnecessarily, the client can use a conditional request such as If-Modified-Since.

Then:

  • if the object has not changed, the server replies 304 Not Modified;
  • otherwise, the server sends 200 OK and the new object.

This can save large amounts of bandwidth, especially when objects are big.

11.6.6. Institutional cache example

The lecture also discusses a network with:

  • a fast local link inside an institution,
  • a slower link to the public internet.

If a local cache stores frequently requested objects, then:

  • the object only needs to traverse the slow external link once,
  • later accesses are served locally,
  • performance improves significantly.

11.7. HTTP/1.1 pipelining and head-of-line blocking

HTTP/1.1 tried to improve efficiency further by allowing multiple outstanding requests on one TCP connection.

However, responses had to come back in order. Since responses did not explicitly carry enough information to freely reorder them, the client depended on the response sequence.

This caused head-of-line blocking:

  • if the first requested object is very large,
  • all later objects are delayed behind it.

The lecture uses the analogy of choosing the wrong queue at a bank counter: the person in front may take a long time, while shorter tasks behind them cannot pass.

Loss recovery also remains problematic, because TCP retransmissions can delay all subsequent data on that connection.

11.8. HTTP/2

HTTP/2 was introduced to address these efficiency problems.

Its key idea is to split large objects into smaller frames and interleave frames from multiple objects over the same connection.

This means:

  • a large object no longer monopolizes the connection,
  • smaller objects can be delivered earlier,
  • overall user-perceived latency is reduced.

HTTP/2 also supports features such as server push/prefetching:

  • if the server can predict what the client will likely need next,
  • it can send these objects proactively.

This is useful for interactive applications such as map services.

However, HTTP/2 still relies on TCP, so TCP-level loss recovery and congestion-control behavior can still affect all multiplexed streams.

Security is also not inherent unless HTTP is run over TLS.

11.9. HTTP/3

HTTP/3 is presented as the newest version and as a further improvement.

According to the lecture, HTTP/3:

  • adds security,
  • improves pipelining/multiplexing behavior,
  • avoids some TCP-related limitations,
  • runs over UDP rather than TCP.

This means transport-like functions are partially moved up into the application layer/protocol design. That gives more flexibility, but also creates new challenges:

  • congestion control must be reimplemented,
  • interactions between different protocols and clients can become more complex.

The lecture postpones a deeper treatment until more transport-layer background has been covered.

12. DNS

The lecture then emphasizes an important point: knowing HTTP alone is not enough to access web content. The client must also know how to translate human-readable names into network addresses.

This motivates DNS.

12.1. Why DNS is needed

Humans are good at remembering names, but bad at remembering numerical IP addresses.

Computers, by contrast, operate naturally on numbers.

DNS bridges this gap by providing name resolution:

  • mapping hostnames to IP addresses.

The lecture also points out extra complications:

  • names may use different character sets,
  • hosts may have multiple names,
  • one name may map to multiple IP addresses.

Therefore DNS is not just a trivial lookup table.

Historically, such mappings were once maintained manually in a central list or book, but that does not scale.

12.2. What DNS provides

DNS is an application-layer protocol, even though it is essential to the functioning of the internet.

Its services include:

  • hostname to IP address translation,
  • support for aliases,
  • support for mail servers,
  • support for load balancing,
  • distributed operation without a single central authority.

One important design principle is that complexity is kept at the edges, not in the network core.

DNS also helps with load balancing:

  • one name can map to multiple IP addresses,
  • answers can depend on location or time,
  • this allows traffic distribution and service optimization.

12.3. Why DNS cannot be centralized

A centralized DNS would suffer from:

  • a single point of failure,
  • huge maintenance burden,
  • poor scalability.

The lecture emphasizes the massive scale of DNS traffic and the need for performance and distribution.

A practical symptom of DNS problems is intermittent internet failure:

  • some sites still work because of cached DNS answers,
  • new or expired lookups fail.

Thus caching is also important in DNS.

12.4. DNS as a distributed hierarchical database

DNS is organized hierarchically.

At the top is the root. Below it are top-level domains such as:

  • generic TLDs like com, org, edu, gov;
  • country-code TLDs like de, nl, us, jp.

Below those are further delegated domains and subdomains.

Different organizations are authoritative for different parts of the namespace. This delegation avoids central bottlenecks and distributes administrative responsibility.

12.5. DNS resource records

DNS stores information in resource records.

The lecture mentions several important record types:

A
maps a hostname to an IPv4 address.
NS
specifies a authoritative name server responsible for a domain.
CNAME
alias record.
MX
mail exchange record.
AAAA
maps a hostname to an IPv6 address.

The lecture gives the intuition for AAAA: it is the IPv6 counterpart of A.

A DNS query/response includes:

  • a question section,
  • an answer section,
  • and additional metadata.

12.6. DNS hierarchy and resolution process

To resolve a name such as amazon.com, the resolver proceeds step by step through the hierarchy.

Conceptually:

  1. start at the Root DNS Server;
  2. ask which name servers are responsible for com;
  3. ask a com DNS Server which name servers are responsible for amazon.com;
  4. ask the authoritative server for the A record of amazon.com.

Important distinction:

  • before reaching the authoritative server, the resolver often asks for NS records;
  • only at the authoritative stage does it get the desired address record.

Thus DNS resolution is an iterative delegation process through the namespace hierarchy.

12.7. Root servers and anycast

Every internet-connected system needs a preconfigured way (root hints file, or directly shipped with resolver software) to reach the DNS root.

The lecture notes that this is handled with mechanisms such as anycast:

  • multiple physical servers share the same IP address,
  • traffic is routed to a nearby or appropriate instance.

This makes the root system scalable and robust.

12.8. Name servers and resolvers

DNS contains two different kinds of roles that should not be confused.

12.8.1. Name servers

Name servers are part of the DNS hierarchy.

A name server is authoritative for some part of the DNS namespace.

Examples:

  • root name servers,
  • top-level-domain name servers, e.g. for .com, .de, .edu,
  • second-level-domain name servers, e.g. for example.com or uni-saarland.de,
  • further delegated name servers deeper in the tree.

A name server answers DNS queries from resolvers.

If it knows the final answer, it can return it.

If it does not know the final answer but knows a more specific name server below it, it can refer the resolver to that next name server.

12.8.2. Resolvers

Resolvers do not strictly belong to the DNS hierarchy.

They are clients of the DNS hierarchy.

Their job is to issue DNS queries and return answers to the client or to another resolver.

Main resolver types:

  • stub resolver / local DNS resolver,
  • forwarding resolver,
  • recursive resolver.

A resolver may:

  • answer from cache,
  • forward the query to another resolver,
  • query authoritative name servers directly.

12.9. DNS root

The root of DNS is the empty label, written as a final dot.

For example, the fully qualified domain name is conceptually:

\[ www.example.com. \]

The final dot represents the root.

Usually users omit the final dot because it is always implied.

The root name servers are authoritative for the root zone ..

They know the name server mappings for all top-level domains.

For example, if a resolver asks about something under .com, the root name server does not know the final website IP address, but it knows which name servers are responsible for .com.

12.9.1. Bootstrapping problem

A resolver needs to know the root name servers before it can resolve anything.

This creates a bootstrapping problem:

How does the resolver find the root servers if DNS itself is needed to find names?

The answer is the root hints file.

Resolver software is shipped with a root hints file that contains:

  • root server names,
  • their IP addresses.

Without this initial list, DNS resolution cannot start.

12.9.2. ICANN and root server operation

The root zone is managed by ICANN.

ICANN stands for:

Internet Corporation for Assigned Names and Numbers

ICANN is responsible for assigning names and numbers at a global level.

It delegates top-level domains to organizations that operate them.

Examples:

  • country-code TLDs such as .de,
  • generic TLDs such as .com.

There are 13 logical root server names, from A to M.

The reason for 13 is historical:

  • DNS traditionally used UDP,
  • classical UDP DNS packets were limited to 512 bytes,
  • 13 root server names and addresses fit into that limit.

However, 13 does not mean there are only 13 physical machines.

Each logical root server name is replicated many times around the world.

Thus DNS root service is physically distributed and redundant.

12.10. Top-level-domain and second-level-domain name servers

After the root come top-level-domain servers.

Examples:

  • .com,
  • .org,
  • .net,
  • .edu,
  • country-code TLDs such as .de, .cn, .uk, .fr.

Each top-level domain has its own authoritative name servers.

Below TLDs are second-level domains.

Examples:

  • example.com,
  • amazon.com,
  • uni-saarland.de.

For most websites, the important delegation often ends at the second-level domain.

A subdomain such as:

\[ www.uni\text{-}saarland.de \]

does not necessarily mean a separate DNS zone exists for www.

It can simply be a name inside the uni-saarland.de zone.

12.11. NS records, A records, and the glue problem

A key point from the lecture is that name servers themselves are identified by names.

For example, the authoritative name server for example.com might be:

\[ ns1.example.com \]

But to query ns1.example.com, the resolver needs its IP address.

This leads to a possible circular dependency:

To find the address of example.com, ask ns1.example.com. But to ask ns1.example.com, we first need the address of ns1.example.com.

This is why the parent zone may also need to provide the address of the child zone’s name server.

This additional address information is called glue.

For example:

  • the parent .com zone says that ns1.example.com is authoritative for example.com,
  • if ns1.example.com is inside example.com, the parent also gives its IP address.

This avoids the circular lookup problem.

The lecturer emphasized that this creates operational complexity:

  • changing a name server name may require updating the parent,
  • changing a name server IP address may require updating the parent,
  • adding a new name server may require checking whether glue is needed.

Historically this design grew organically and is hard to replace.

12.12. Stub, forwarding, and recursive resolvers

12.12.1. Stub resolver

A stub resolver is simple resolver software on a local machine or local network.

It usually does not walk the whole DNS hierarchy itself.

Instead, it forwards the query to another resolver.

It may still cache answers.

The operating system often uses such a local resolver.

12.12.2. Forwarding resolver

A forwarding resolver receives queries and forwards them to another resolver, usually a recursive resolver.

It may run:

  • on a home router,
  • inside a company network,
  • in the infrastructure of a large DNS service.

Reasons for forwarding resolvers:

  • caching,
  • redundancy,
  • firewall policy,
  • filtering or blocking unwanted domains,
  • local network policy.

The lecturer noted that forwarding resolvers are not strictly necessary. The only essential heavy component is the recursive resolver. But forwarding resolvers are useful in many real deployments.

12.12.3. Recursive resolver

A recursive resolver performs the actual heavy lifting.

It receives a query from a stub or forwarding resolver, then queries the DNS hierarchy.

Typical recursive resolvers:

  • ISP resolvers,
  • university resolvers,
  • company resolvers,
  • public resolvers such as Google Public DNS or Cloudflare DNS.

The recursive resolver usually:

  1. asks a root server,
  2. asks a TLD server,
  3. asks the relevant authoritative server,
  4. obtains the answer,
  5. caches intermediate results,
  6. returns the final answer to the client.

12.13. Iterative and recursive DNS queries

DNS resolution can be described using two query styles.

12.13.1. Iterative query

In an iterative query, the contacted server answers only what it knows.

If it does not know the final answer, it returns a referral.

Example:

A host wants to resolve:

\[ gaia.cs.umass.edu \]

The process is:

  1. ask the root server;
  2. root says: I do not know the final address, but ask the .edu TLD server;
  3. ask the .edu TLD server;
  4. .edu says: ask the umass.edu name server;
  5. ask the umass.edu / cs.umass.edu authoritative name server;
  6. authoritative server returns the final A record.

Iterative query style means:

“I do not know the final answer, but ask this next server.”

12.13.2. Recursive query

In a recursive query, the client asks the contacted server to perform the rest of the resolution.

The client asks:

“Please get me the final answer.”

Then the contacted server would have to query other servers on behalf of the client.

This puts heavy load on upper-level servers.

Therefore root and TLD name servers generally do not perform recursion for arbitrary clients.

12.13.3. Real-world mixture

In practice, DNS uses a mixture:

  • the client sends a recursive query to its recursive resolver;
  • the recursive resolver sends iterative queries to root, TLD, and authoritative name servers.

Thus the client only sends one query and receives one final answer, while the recursive resolver does the expensive work.

12.14. DNS caching and TTL

DNS is heavily cached.

Whenever a resolver learns a mapping, it can cache it.

Each DNS record contains a TTL:

\[ TTL = \text{time to live} \]

The TTL tells resolvers how long the answer may be cached.

Short TTLs are useful when:

  • the server may change soon,
  • load balancing is performed,
  • failover is expected.

Long TTLs are useful when:

  • records are stable,
  • query load should be reduced,
  • high-level delegation information rarely changes.

Important consequence:

If a record changes, the change is not immediately visible everywhere.

Old records may remain in caches until their TTL expires.

For example, if a record has a TTL of two days and the server IP changes, some clients may still use the old IP for up to two days.

The lecturer also mentioned that some clients or systems may use stale DNS records aggressively, trying to connect using old cached data while doing fresh DNS resolution in parallel.

12.15. Reverse DNS

DNS can also map IP addresses back to names.

This is called reverse DNS.

Special DNS domains are used:

  • in-addr.arpa for IPv4,
  • ip6.arpa for IPv6.

For IPv4, the octets are reversed.

Example:

\[ 23.220.149.130 \]

is represented as:

\[ 130.149.220.23.in\text{-}addr.arpa. \]

For IPv6, the address is reversed nibble by nibble, i.e. 4 bits at a time, under ip6.arpa.

Reverse DNS becomes important later in the email part, especially for mail server verification.

12.16. DNS security problems

The lecturer summarized DNS as useful but messy.

DNS is a distributed hierarchical database, and it mostly works, but it was not designed with modern security requirements in mind.

12.16.1. Attacking root and TLD servers

One possible attack is to bombard root name servers with traffic.

So far, root servers have not been successfully taken down by such attacks because:

  • there are many replicas,
  • traffic filtering is used,
  • resolvers cache TLD server information,
  • root servers are not queried for every lookup.

Attacking TLD servers may be more dangerous because they are lower in the hierarchy and may be easier targets.

12.16.2. Plaintext DNS and man-in-the-middle attacks

Traditional DNS is plaintext.

An attacker who can observe or modify network traffic may:

  • read DNS queries,
  • intercept responses,
  • inject fake responses.

This can be used for:

  • censorship,
  • domain blocking,
  • redirecting users to another server,
  • ISP-level filtering.

12.16.3. DNS cache poisoning

A resolver may cache an incorrect answer if an attacker can inject a bogus DNS response that the resolver accepts.

Then the poisoned cache can serve the wrong answer until the TTL expires.

12.16.4. DNS amplification DDoS

DNS can be abused for DDoS amplification.

The attacker sends DNS queries with a spoofed source IP address.

The spoofed source IP is the victim.

Then DNS servers send their responses to the victim.

Amplification happens when:

  • the query is small,
  • the response is much larger.

DNSSEC can increase response size because signatures are large, which can increase amplification potential.

12.16.5. Security extensions

Several mechanisms try to improve DNS security:

  • DNS over HTTPS,
  • DNS over TLS,
  • DNSSEC.

DNSSEC authenticates DNS records, but deployment is limited and operationally complex.

The lecturer emphasized that DNSSEC adds signatures and overhead, and real-world deployment remains difficult.

12.17. DNS summary

DNS is:

  • a distributed hierarchical database,
  • an application-layer protocol,
  • a core Internet function,
  • implemented at the network edge.

Authoritative name servers:

  • are responsible for zones,
  • store mappings,
  • answer resolver queries,
  • may return final answers or referrals.

Resolvers:

  • query authoritative servers,
  • perform the heavy lifting,
  • cache results,
  • reduce load and latency.

DNS is also a recurring dependency for many other protocols, especially email.

Author: Lowtroo

Created on: 2026-04-14 Tue 16:00

Powered by Emacs 29.3 (Org mode 9.6.15)