Part IX

Name Services

How a distributed system refers to its computers, services, files and users, and how a name that a person can remember, such as www.unimelb.edu.au, is turned into the address a program needs. The centrepiece is DNS, the Internet's name service: how its data is split across thousands of servers, how one name is resolved step by step, and how caching with a time-to-live keeps it fast but sometimes stale.

  • You willtell names, identifiers and addresses apart, and say when a name is pure.
  • You willdraw and compare the four ways of navigating a distributed name service.
  • You willexplain DNS zones and resource records, walk through a full lookup, and trace a cache with TTLs.
  • You willdistinguish name, directory and discovery services, and say what GNS adds.
9.1

Names, Identifiers and Addresses exam

The problem. Before two programs can share anything, they must agree on how to refer to it. A distributed system names many kinds of thing: computers, services, remote objects, files and users. Very little works without names. You need a URL to fetch one particular web page; processes cannot share a resource unless they can name it consistently; and people cannot communicate unless they can name each other, for example with an email address.

There are two very different styles of reference. Compare google.com with 74.125.237.83, or /usr/bin/tar with Disk 4, Sector 26, Block 15. Meaningful names are easier for humans to remember and type. Numbers suit programs better, because programs use them to structure data and to locate resources quickly. Both styles can carry structure, as the lower half of the figure shows.

FOR PEOPLE: MEANINGFUL NAMES FOR PROGRAMS: NUMBERS google.com 74.125.237.83 the same computer /usr/bin/tar Disk 4, Sector 26, Block 15 the same file BOTH STYLES CAN CARRY STRUCTURE dsys . cis . unimelb . edu . au server department university education country read right to left: from general to specific 74.125.237 . 83 subnet machine (where the split falls depends on the network)
Same thing, two styles. Each row on top names one object twice: once for people (teal) and once for programs (grey). Underneath, notice that structure helps in both styles. A DNS name is read right to left, from the country down to one server, and an IPv4 address splits into a subnet and a machine on it.

Three kinds of reference exam

CDK (§13.1.1) separates three terms, which run from what a person types to where the object actually sits. Learn these definitions word for word; they are the vocabulary for everything else in this Part.

Definitions: name, identifier, address
  • A name is a human-readable value, usually a string, that is resolved to an identifier or an address. Examples: /etc/passwd, http://www.cdk5.net/, www.cdk5.net.
  • An identifier is a name interpreted only by programs. It is chosen so that software can store it and look it up efficiently. It may be an address, contain an address, or be transformable into one. Examples: an NFS file handle (the token an NFS server hands out to identify a file, see Part VIII), a remote object reference (Part VI), a hash code.
  • An address is a value that identifies the location of an object rather than the object itself. That makes access efficient, but an address breaks when the object moves. Your email address, for example, changes when you change employer or Internet service provider.
NAME human-readable; resolved to an identifier or address EXAMPLES /etc/passwd www.cdk5.net http://www.cdk5.net/ resolve IDENTIFIER read only by programs; cheap to store and to look up EXAMPLES NFS file handle remote object reference hash code resolve ADDRESS the object's location, not the object itself EXAMPLES IP address + port Ethernet address email address survives a move: just rebind it efficient, but breaks if the object moves
From people to places. Read left to right: a name is resolved, possibly through an identifier, to an address. The further right you are, the faster the access and the more the reference depends on where the object currently lives.

Pure and non-pure names exam

Names also differ in how much they reveal about the object. A pure name is an uninterpreted bit pattern: it contains no information about the object at all, so it must always be looked up before it can be used. A non-pure name contains information about the object, typically its location, as in tawfiq@128.250.1.25, where the part after the @ is an IP address.

PURE NAME 0x7f3a9c21 bits that say nothing about the object look up Name service attributes location: where it lives always one lookup before every use
Pure: look it up first. Nothing can be read off the name, so a name service (green) must be asked every time.
NON-PURE NAME tawfiq@128.250.1.25 location inside the name go there 128.250.1.25 no separate lookup needed, but the name changes if the object moves
Non-pure: read the location off the name. Faster, but the name is tied to where the object is today.

Attributes, bindings and resolution

The rest of the vocabulary describes what a name refers to and how you get there. An attribute is the value of a property of an object; in a distributed system the key attribute is the object's address. A binding is the association between a name and an object, or more precisely between a name and the object's attributes. Resolution is translating a name into data about the named object, usually so that you can act on it, for example to open a connection.

Names are preferable to identifiers or addresses for two reasons. First, the binding to a physical location can change without the name changing: a web site can move to another server and keep its domain name, because only the binding is updated. Second, names mean something to users. The figure shows the first reason.

BEFORE THE MOVE www.cdk5.net binding address A a program stored the address: address A works AFTER THE MOVE www.cdk5.net binding updated address B the name still works a program stored the address: address A address A fails
Why names beat addresses. When the server (amber) moves from address A to address B, only the binding (gold) changes, so everyone who uses the name is unaffected. Anyone who kept the raw address now points at an empty location.

Service-specific names and contexts

Traditionally each service has its own naming scheme, and each scheme identifies its resource only within some enclosing context, such as one file system or one computer. A process id of 1234 means nothing until you know which computer it is on.

ResourceNameIdentifies
filepathnamea file within a given file system
processprocess ida process on a given computer
portport numberan IP port on a given computer

Hierarchy is what lets one simple name recur in different contexts without clashing. The name james can exist in two different domains at once, because each domain is its own context.

. root com domain1 domain2 james james james.domain1.com james.domain2.com same simple name, two contexts, no clash
Context makes a simple name unique. Each james is looked up inside a different domain, so the full names differ even though the last label is the same.

Composed naming domains: one URL, several name services

In practice one URL is resolved by several name services working in a chain. Step through the example below. Notice that the output of one stage, an address, is itself a name for the next stage: the IP address is resolved again to an Ethernet address by ARP (the Address Resolution Protocol, which finds the hardware address of a machine on the local network).

Resolving one URL through a chain of name services
http://www.cdk5.net:8888/WebExamples/earth.html 1 · DNS lookup of www.cdk5.net Resource ID IP 138.37.88.61 · port 8888 · path WebExamples/earth.html 2 · ARP at the last hop Ethernet address 2:60:8c:2:b0:5a an address can itself be a name: IP address → Ethernet address 3 · socket to port 8888 Web server 138.37.88.61:8888 4 · its file system resolves the path earth.html
  1. The starting point is one URL. It has three parts that will be resolved by different services: the host name (teal), the port (gold) and the path (violet).
  2. DNS resolves the host name www.cdk5.net to the IP address 138.37.88.61. Together with the port and path taken from the URL, that gives a resource ID: enough to find the resource on the Internet.
  3. The IP address is not yet something the network hardware can deliver to. At the last hop, ARP resolves it to the Ethernet address 2:60:8c:2:b0:5a. So an address (the IP) was itself treated as a name.
  4. The browser opens a socket to port 8888 on that host, reaching the web server process.
  5. Finally the web server's own file system resolves the path WebExamples/earth.html to the file. Four lookups, each by a different naming scheme, served one click.
Check yourselfDistinguish a name, an identifier and an address. What is a pure name?

A name is human-readable and is resolved to attributes (an identifier or address). An identifier is meant for programs and is chosen to be efficient to store and look up, such as a file handle or a remote object reference. An address gives the object's location, which makes access efficient, but it becomes invalid if the object moves.

A pure name is an uninterpreted bit pattern, so it must always be looked up. A non-pure name, by contrast, contains information about the object, such as its location.

Check yourselfWhich of these is a pure name?
  1. tawfiq@128.250.1.25
  2. http://www.cdk5.net:8888/WebExamples/earth.html
  3. An IP address and port pair, 138.37.88.61:8888
  4. A random 64-bit identifier that a lookup table maps to a server

D. It carries no information about the object, so it can only be used by looking it up. A contains an IP address (location), so it is non-pure. B contains the host and port, so it is non-pure too. C is not a name for people at all but an address: it is the location.

Check yourselfA company moves its web site to a new data centre with new IP addresses. Why do users who type the domain name notice nothing, while a script with a hard-coded IP address fails?

The domain name is bound to the address by the name service, and the binding is resolved only when needed. Moving the site only changes the binding, so every later resolution of the name returns the new address. The hard-coded IP is an address: it identifies the old location, not the site, so it breaks when the object moves.

Check yourselfName the separate resolution steps involved in fetching http://www.cdk5.net:8888/WebExamples/earth.html.

(1) DNS resolves www.cdk5.net to IP 138.37.88.61. (2) At the last hop, ARP resolves that IP address to an Ethernet address. (3) A socket is opened to port 8888, reaching the web server. (4) The web server's file system resolves the path WebExamples/earth.html to the file. The lesson is that an address can itself be a name needing further lookup.

In short
  • Name (for people, resolved) → identifier (for programs, efficient) → address (the location; breaks when the object moves).
  • A pure name holds no information about the object and must always be looked up; a non-pure name embeds something, usually the location.
  • A binding links a name to attributes; resolution turns a name into those attributes. Names win because the binding can change while the name stays the same.
  • Real lookups chain several naming schemes: DNS, ARP, ports, file systems.
9.2

URIs, URLs and URNs exam

The problem. The Web needs to identify all sorts of resources: pages, mailboxes, phone numbers, books. If every kind had its own unrelated syntax, every browser and library would need special code for each one. URIs (Uniform Resource Identifiers) solve this with one general, uniform syntax for identifying any kind of resource.

A URI starts with a scheme, such as http:, mailto:, tel: or urn:, and the scheme says how to read the rest. Because the overall syntax is shared, new identifier types can be added, and old ones reused, without disrupting common software such as browsers. There are two kinds of URI, and the difference between them is the one fact to remember: a URL says where the resource is and how to reach it, while a URN only names it.

URI · ONE UNIFORM SYNTAX FOR ANY RESOURCE schemes: http: mailto: tel: urn: … URL · Uniform Resource Locator holds the location and the access method http://www.cdk5.net/ mailto:fred@flintstone.org URN · Uniform Resource Name a pure resource name, not a locator urn:ISBN:0-201-62433-8 urn:doi:10.555/music-pop-1234
URL and URN are both kinds of URI. The umbrella (grey) gives the shared syntax; the scheme at the front picks the kind. Teal says where and how; violet only says which.
URL access method Internet endpoint http:// www.cdk5.net :8888 /WebExamples/earth.html protocol host port service-specific path resolved directly: DNS, then the server changes if the resource moves URN urn: ISBN :0-201-62433-8 urn nameSpace nameSpace-specificName no location, no access method: a pure name needs a resolution service to find the resource
Take each identifier apart. A URL is protocol + Internet endpoint (host and port) + a path that only the server interprets. A URN has the form urn:nameSpace:nameSpace-specificName; nothing in it says where the book or document lives.
URL (Uniform Resource Locator)URN (Uniform Resource Name)
WhatA URI that holds location information and the access methodA URI used as a pure resource name, not a locator
Exampleshttp://www.cdk5.net/, mailto:fred@flintstone.orgurn:ISBN:0-201-62433-8, urn:doi:10.555/music-pop-1234, mid:...@hpl.hp.com
StructureProtocol + Internet endpoint (host, port) + service-specific pathurn:nameSpace:nameSpace-specificName
ResolutionDirect: DNS, then the serverNeeds a resolution service, e.g. the Handle System (not widely used)
WeaknessChanges if the resource movesAn extra lookup step; little infrastructure

Dangling links

The weakness of URLs has a name. If a resource is deleted or moved, old links to it dangle: following one gives "not found" or, worse, a different resource that now happens to sit at that location. Nothing warns the reader that the link is wrong.

THE LINK WORKS Your page link: /a.html SERVER a.html found the link reaches the resource it was written for
Before: the URL encodes where the file is today, and it is still there.
THE LINK DANGLES Your page link: /a.html SERVER moved or deleted 404 "not found", or worse: a different resource now at that location
After: the link still points at the old location, which is now empty or holds something else.

The debate about what to do continues. One side says "cool URLs don't change": owners should guarantee continuity at the same URL. The other side argues for separate URNs, because not everyone can guarantee a stable domain for ever.

Common mistake

A URL is a kind of URI, not a synonym for "web address". On its own, www.google.com is a domain name, not a URL: it has no scheme and no access method. http://www.google.com/ is a URL.

Check yourselfCompare URLs and URNs. What is a dangling link?

A URL holds the resource's location plus the access method, as in http://www.cdk5.net/. That makes it efficient, but it changes when the resource moves. A URN is a pure name, such as urn:ISBN:0-201-62433-8, so it stays stable, but it needs a resolution service.

A dangling link is a URL that points to a moved or deleted resource, so following it gives "not found" or a different resource.

Check yourselfWhich statement is correct?
  1. www.cdk5.net is a URL.
  2. Every URN is a URL whose host is a resolution service.
  3. mailto:fred@flintstone.org is a URL, because it states the access method and the location.
  4. A URN stays valid when the resource moves because DNS updates it automatically.

C. The guide lists mailto: addresses as URL examples. A is a bare domain name with no scheme. B is wrong because a URN is a pure name with no host at all. D gets the reason wrong: a URN stays valid because it contains no location in the first place, and it is resolved by a separate resolution service such as the Handle System, not by DNS.

In short
  • URI = one uniform syntax for any resource, with extensible schemes.
  • URL = location + access method; efficient but breaks (dangles) when the resource moves.
  • URN = urn:nameSpace:specificName, a pure name; stable, but it needs a resolution service that hardly exists.
9.3

Name Services exam

The problem. Once resources have names, something has to remember which name is bound to which attributes, and answer questions about them. That is the job of a name service.

Definition · name service (CDK)

A name service stores a collection of one or more naming contexts. A context is a set of bindings between textual names and attributes of objects such as computers, services and users. Its major operation is to resolve a name, that is, to look up attributes from a name. It also creates and deletes bindings, lists bound names, and adds and deletes contexts.

The slides phrase it by purpose: a name service provides consistent and uniform naming so that programs can locate resources and obtain the metadata they need to interact with them.

Client program needs a resource resolve(name) attributes NAME SERVICE naming context: cdk5.net www→ alias of cdk5.net cdk5.net→ 138.37.88.61 naming context: users fred → mailbox at flintstone.org OPERATIONS resolve(name) the major operation create / delete a binding list bound names add / delete a context each binding: name → attributes
Contexts hold bindings; resolve reads them. The client only ever presents a name; the name service holds one or more contexts, each a table from names to attributes, and answers with the attributes.

Why a separate name service?

The slides list three key benefits. Resource localisation: programs can find files, web pages, services and databases. Uniform naming: everything is named the same way. Device-independent addresses: when a site moves to another server, only the binding changes. That last benefit comes from the fact that name services defer binding: a name is resolved to an address only when it is needed, not when the program is written, so the address can change in between.

Naming is kept separate from other services for reasons of openness (a system's ability to be extended and to interwork, Part I). Separation allows unification: resources managed by different services can share one naming scheme, as URIs do. It also allows integration: resources created in different administrative domains may later need to be shared, and a common name service avoids clashing naming conventions.

The five general requirements exam

These were the design goals of two early large name services, Grapevine and GNS (§9.8). They are a favourite "list and explain" question, so learn each with its reason.

  1. Scale. The service must handle an essentially arbitrary number of names and serve an arbitrary number of administrative organisations. (The Internet has billions of names.)
  2. Long lifetime. Over the service's life, both the organisation of the name space and the components that implement it will change many times. The design must survive those changes.
  3. High availability. Most other systems depend on the name service, so they fail if it fails. If DNS is down, you cannot reach web sites by name.
  4. Fault isolation. Local failures must not bring down the whole service. A crashed server in one university should affect only that university's names.
  5. Tolerance of mistrust. In a large open system no component is trusted by all clients, so the service must work even though parts of it are run by people who do not trust each other.
Check yourselfList the general requirements of a name service.
  1. Scale: handle arbitrary numbers of names and organisations.
  2. Long lifetime: survive many changes to the name space organisation and to the implementation.
  3. High availability: other systems depend on it, so it must stay up.
  4. Fault isolation: local failures must not bring down the whole service.
  5. Tolerance of mistrust: cope with the fact that no component is trusted by all clients.
Check yourselfA name server at one university crashes, but names elsewhere on the Internet still resolve. Which requirement does this illustrate?
  1. High availability
  2. Fault isolation
  3. Long lifetime
  4. Tolerance of mistrust

B, fault isolation: a local failure stayed local. High availability (A) is the near miss: it is about the service as a whole staying up because everything depends on it, which is usually achieved by replication, not about confining a failure to one part.

Check yourselfWhat does it mean that a name service "defers binding", and which benefit does it give?

Names are resolved to addresses only when they are needed, at run time, rather than being fixed in advance. So if a resource moves, only the binding in the name service changes and every later lookup returns the new address. That is the benefit of device-independent addresses: a site can move to another server seamlessly.

In short

A name service holds naming contexts (sets of name → attribute bindings) and its main job is to resolve names. It gives resource localisation, uniform naming and device-independent addresses by deferring binding, and it is separate from other services for unification and integration. Its five requirements: scale, long lifetime, high availability, fault isolation, tolerance of mistrust.

9.4

Name Spaces

The problem. A name service must decide which strings even count as names, how they are organised, and who is allowed to hand them out. Those decisions define its name space, and they determine whether the service can grow to Internet size.

Definition · name space

A name space is the collection of all valid names recognised by a service. Validity is a matter of syntax: a syntactic definition separates valid names from invalid ones. A valid name may still be unbound, meaning it is legal but refers to nothing.

ALL STRINGS NAME SPACE: VALID NAMES BOUND NAMES ... invalid syntax www.cdk99.net valid, but unbound www.cdk5.net valid and bound
Valid is not the same as bound. Syntax decides membership of the name space (teal); a binding decides whether the name refers to anything (green). www.cdk99.net is a perfectly good name that nobody has registered.

Flat and hierarchical name spaces

Name spaces come in two shapes. The contrast to notice is that a flat space is finite and run by one authority, while a hierarchical one can grow indefinitely because its parts (contexts) can be managed separately by different organisations.

FLAT one table, one authority 0001 → … 0002 → … 0003 → … ⋮ 9999 → … one authority finite: names are at most 4 digits real examples: Ethernet addresses, UFIDs
Flat: every name lives in one big table, so size is capped by the maximum name length and one authority must manage it all.
HIERARCHICAL / a b x y x … managed by org 1 org 2 potentially infinite: add another level
Hierarchical: each context (colour) is managed by a different organisation, and a new level can always be added, so the space never fills up.
FlatHierarchical
FormNames drawn from a flat set of numeric or symbolic identifiersMulti-part names, each part resolved in a separate, smaller context
SizeFinite, limited by the maximum name lengthPotentially infinite, so it can grow indefinitely
ManagementOne authority, one large tableDifferent contexts managed by different people or organisations
ExampleEthernet addresses, UFIDs (unique file identifiers, Part VIII)File pathnames, DNS domain names

To see how a hierarchical name is resolved part by part, take /etc/passwd. First etc is looked up in the context /, which yields a new context; then passwd is looked up in the context /etc. Because each context is separate, the same simple name can mean different things in different contexts.

context / bin → context etc → context usr → context context /etc hosts → file passwd → file … attributes of passwd (where the file is, …) 1 · look up etc in / 2 · look up passwd in /etc each component is looked up in the context the previous one returned
One context per component. Each lookup returns either another context (the next table to search) or, at the end, the object's attributes.

DNS names

A DNS name is a sequence of labels separated by dots, with the highest-level domain on the right. Names are case-insensitive, so WWW.CDK5.NET and www.cdk5.net are the same name. DNS servers accept only absolute names (complete names, right up to the top-level domain), but client software appends default domains to single-component names: if your machine is in cdk5.net, typing www becomes www.cdk5.net before it is sent.

www what the user types client appends default domain www.cdk5.net absolute name DNS server accepts absolute names only and case does not matter: WWW.CDK5.NET is the same name
Short names are completed on the client. The server never sees www alone; the client's resolver software adds the default domain first.

Aliases

An alias is a name defined to denote the same information as another name, much like a symbolic link in a file system. URL shorteners (bit.ly/...) are aliases, and so are DNS CNAME records, such as one that makes www.cdk5.net stand for cdk5.net. Aliases give convenient names, and if the machine behind a name changes, only one record needs updating. Their risk is cycles, which make resolution loop forever.

AN ALIAS www.cdk5.net CNAME: "same as" cdk5.net A record IP address machine changes? update this one record
Alias: one extra hop, one place to update. Every alias leads to the same canonical name, which holds the only copy of the address.
A CYCLE alias1 alias2 alias3 loops forever Fixes: give up after a threshold number of steps, or administrators veto cyclic aliases
Cycle: resolution never ends unless the resolver counts steps or the cycle is refused when someone tries to create it.

Naming domains and delegation

A naming domain is a name space with a single overall administrative authority for assigning names in it. The authority may delegate subdomains to others. For example, cis.unimelb.edu.au is agreed with the authority for unimelb.edu.au, which in turn registered with edu.au. The authority normally also manages the corresponding data on an authoritative name server, the server whose answers for that domain are the official ones.

DOMAIN edu.au the authority for edu.au SUBDOMAIN unimelb.edu.au delegated to the university SUBDOMAIN cis.unimelb.edu.au delegated to the department it assigns names such as dsys.cis.unimelb.edu.au
Authority is handed down the tree. Each nested box is a naming domain with its own authority and its own authoritative name server. The parent only records that the child exists and who runs it.

Combining and customising name spaces

DNS is one global, homogeneous name space: a name means the same thing everywhere. Other services let name spaces be combined or tailored, in three ways.

Merging. Mounting, as in UNIX and NFS, embeds one name space inside another. Suppose you want to merge the file name spaces of two machines, red and blue. You can create a new super-root containing /red and /blue. But then old absolute names such as /etc/passwd break, because they no longer say which machine, so the old roots are kept as well, giving a hybrid name space. The moral: you can always merge under a new root, but you create backward-compatibility problems.

BEFORE: TWO MACHINES / etc users passwd red: /etc/passwd / etc users passwd blue: /etc/passwd AFTER: MERGED UNDER A SUPER-ROOT / super-root red blue etc users passwd etc users passwd /red/etc/passwd /blue/etc/passwd old absolute name /etc/passwd: which machine? fix: keep the old roots too, giving a hybrid name space
Merging is easy; compatibility is not. A new gold super-root joins the red and blue trees, but every existing absolute name now lacks the machine prefix. GNS (§9.8) is designed around exactly this problem.

Heterogeneity. DCE (the Distributed Computing Environment, an older middleware platform) names contain junctions, which are like mount points but lead into name spaces with a different syntax, as in /.../dcs.qmul.ac.uk/principals/Jean.Dollimore: the part after the junction follows the rules of a different naming system.

Customisation. Each client can mount remote file systems wherever it likes, so the same file may have different names on different computers. Spring and Plan 9 go further and give each process its own naming context.

Check yourselfWhy can a hierarchical name space grow indefinitely when a flat one cannot?

A flat space is a single set of identifiers whose size is limited by the maximum name length, and one authority manages one large table. A hierarchical space resolves each part of a name in a separate, smaller context, and different contexts can be managed by different organisations; a new level can always be added under any node. So the space is potentially infinite and its management is spread out.

Check yourselfwww.cdk99.net returns "no such name" from DNS. Is it outside the DNS name space?

No. It is syntactically valid, so it is in the name space; it is simply unbound. A name outside the name space would be one with invalid syntax, such as ....

Check yourselfWhat is the risk of aliases, and what are the two fixes?

Aliases can form cycles (a → b → a), which make resolution loop forever. The fixes are to abandon resolution after a threshold number of steps, or to have administrators veto (refuse to create) cyclic aliases.

Check yourselfYou merge two machines' file name spaces under a new super-root. What breaks, and how is it usually patched?

Old absolute names such as /etc/passwd break, because they no longer identify which machine's file is meant (it is now /red/etc/passwd or /blue/etc/passwd). The usual patch is to keep the old roots as well, giving a hybrid name space. The general lesson is that merging under a new root always works but creates backward-compatibility problems.

In short
  • A name space is the set of syntactically valid names; a valid name may be unbound.
  • Flat spaces are finite with one authority; hierarchical ones resolve part by part in separate contexts, can grow forever, and spread management across organisations.
  • DNS names: dot-separated labels, highest level on the right, case-insensitive, absolute at the server. Aliases (CNAME) are handy but can cycle.
  • A naming domain has one authority, which can delegate subdomains. Merging name spaces under a new root breaks old absolute names.
9.5

Name Resolution and Navigation exam

The problem. No single server can hold every name on the Internet. So when a client presents a name, the first server it asks often cannot answer alone, and someone has to find the server that can. This section is about how that search, called navigation, is organised. It is one of the most examined topics in the Part.

Resolution is a loop

Resolution is an iterative or recursive process. A name is presented to a naming context, which returns either the attributes or another context plus a derived name. The derived name is then presented to that context, and this repeats until the attributes come back. Aliases add extra rounds: for example, www.dcs.qmul.ac.uk resolves first to traffic.dcs.qmul.ac.uk, and only then to an IP address.

each round: a context returns the attributes, or another context plus a derived name www.dcs.qmul.ac.uk naming context traffic.dcs.qmul.ac.uk derived name (www is an alias) naming context attributes A 138.37.95.150 present → get a derived name → present again → … → attributes
Each round shortens the work left. The first context recognised an alias and handed back a new name (gold); presenting that name finally produced the address (green). With a hierarchical name, each round would instead strip off one more part of the name.

Why more than one server: partitioning and replication

A large name service's data is partitioned across many name servers, usually by domain, so that each organisation runs the servers for its own names. It is also replicated for availability: DNS, for instance, keeps each zone (a server's unit of data, §9.6) on at least two failure-independent servers. A local server therefore cannot answer every query alone.

rootzone · 2+ replicas auzone · 2+ replicas comzone · 2+ replicas edu.auzone · 2+ replicas unimelb.edu.auzone · 2+ replicas Partitioned: each domain's data on its own servers Replicated: each zone on 2+ failure-independent servers So: one name may need several servers
The data is spread out on purpose. Partitioning (one box per zone) is what lets the service scale and be locally administered; replication (two servers per box) is what keeps it available. Both mean a lookup may have to visit several servers.
Definition · navigation and resolver

Navigation is the act of locating naming data from more than one name server (chaining naming services) in order to resolve one name. It is carried out by client name-resolution software, called a resolver, which is either a library linked into clients (as in BIND, the UNIX DNS software) or a separate shared process (as in X.500).

The four navigation methods

There are four ways to navigate, and they differ in who drives the lookup: the client, a multicast group, or the servers themselves. The four steppers below use exactly the same cast and layout, so you can flip between them and see only the differences. Watch who sends each message, and whose activation bar stays open.

1 · Iterative navigation
Client NS1 NS2 NS3 1 · resolve(name) unknown here: try NS2 2 · resolve(name) try NS3 3 · resolve(name) attributes The client did all the work: three round trips. Each server answered at once and kept no state.
  1. The same cast in all four methods: one client and three name servers, NS1 to NS3. Only NS3 holds the name being resolved. In iterative navigation the client drives every step itself.
  2. 1 · resolve(name) goes to NS1, the first server the client knows (for DNS, usually a local server).
  3. NS1 does not hold the name, so it replies with a referral: "unknown here, try NS2". It forgets the request at once.
  4. The client, not NS1, sends 2 · resolve(name) to NS2.
  5. NS2 also refers the client onward: try NS3.
  6. The client sends 3 · resolve(name) to NS3.
  7. NS3 holds the name and returns the attributes. The client has finished.
  8. Summary: the client did all the work and all the round trips; the servers stayed simple and stateless, and the client can cache every referral it learned.
2 · Multicast navigation
Client NS1 NS2 NS3 1 · multicast resolve(name, type) not mine: silentnot mine: silent2 · attributes resolve(unbound name)no reply: is the nameunbound, or was a message lost? One round and no knowledge of the layout, but an unbound name gives silence. Fix: a member that answers for unbound names.
  1. The same cast in all four methods: one client and three name servers, NS1 to NS3. For this method, only NS2 holds the name being resolved. In multicast navigation the client asks them all at once.
  2. The client sends one multicast message (a single send delivered to every member of a group) carrying the name and the required object type.
  3. NS1 and NS3 do not hold the name and stay silent. Only NS2, the holder, replies with 2 · attributes.
  4. Now the weakness. The client asks for a name that is unbound. Nobody holds it, so nobody replies, and after a timeout the client cannot tell "unbound" from "the message was lost".
  5. Summary: one round, and the client needs no knowledge of the server layout. The fix for the silence is to add a group member whose job is to answer for unbound names.
3 · Non-recursive server-controlled navigation
Client NS1 NS2 NS3 1 · resolve(name) 2 · resolve(name) try NS3 3 · resolve(name) attributes 4 · attributes NS1 navigated on the client's behalf: a thin client, and NS1 can cache results for many clients.
  1. The same cast in all four methods: one client and three name servers, NS1 to NS3. Only NS3 holds the name being resolved. In non-recursive server-controlled navigation one server does the navigating.
  2. The client sends 1 · resolve(name) to NS1 (it could have been any server) and then simply waits.
  3. NS1 now acts as a client to its peers: it sends 2 · resolve(name) to NS2.
  4. NS2 bounces the next hop back to NS1: "try NS3". NS2 keeps no state.
  5. NS1 asks NS3: 3 · resolve(name).
  6. NS3 returns the attributes to NS1, not to the client.
  7. NS1 passes the result back: 4 · attributes. Notice NS1 stayed in charge of the whole lookup (its long activation bar).
  8. Summary: the same steps as iterative navigation, but done by NS1 for the client. Clients can be thin, and NS1 can cache results for many clients; the cost is that NS1 does all the navigation work.
4 · Recursive server-controlled navigation
Client NS1 NS2 NS3 1 · resolve(name) 2 · resolve(name) 3 · resolve(name) 4 · attributes attributes 5 · attributes Each server waited on the next: a thread was tied up in NS1 and NS2 until the answer came back.
  1. The same cast in all four methods: one client and three name servers, NS1 to NS3. Only NS3 holds the name being resolved. In recursive server-controlled navigation each server passes the request down the chain.
  2. The client sends 1 · resolve(name) to NS1.
  3. NS1 does not hold the name, so it forwards the request to a peer that stores a larger prefix of the name: 2 · resolve(name) to NS2.
  4. NS2 forwards in turn: 3 · resolve(name) to NS3. Now look at the gold bars: NS1 and NS2 each have a thread blocked, waiting for an answer.
  5. NS3 holds the name and replies to the server that asked it: 4 · attributes to NS2. The threads are still held.
  6. NS2 returns the attributes to NS1, along the same path the request came.
  7. NS1 returns 5 · attributes to the client. The client never learns which server actually held the name.
  8. Summary: works across security boundaries and hides where data is stored, but ties up a thread in every server on the chain until the answer returns, delaying other requests; servers may refuse.

Recursive navigation is required across administrative domains that forbid outside clients, or even outside name servers, from discovering how their naming data is spread. Authorised servers then request data from designated servers, which return the attributes without revealing where the data is stored.

1 · ITERATIVE Client NS1 NS2 NS3 1 try NS2 2 try NS3 3 attributes the client contacts every server itself 2 · MULTICAST Client NS1 NS2 NS3 1 · multicast (name, type) 2 · attributes silent silent only the holder replies; unbound = silence 3 · NON-RECURSIVE SERVER-CONTROLLED Client NS1 NS2 NS3 1 2 try NS3 3 attributes 4 NS1 navigates on the client's behalf 4 · RECURSIVE SERVER-CONTROLLED Client NS1 NS2 NS3 1 2 3 4 5 each server forwards; threads held on the chain
The four methods at a glance, the diagram an exam answer to "explain the four navigation methods, with a diagram each" wants. Count the arrows that touch the client: six in iterative, two in each server-controlled method.

Iterative navigation in DNS and in NFS

DNS and NFS (the Network File System, Part VIII) both navigate iteratively, but they present the name differently. In DNS, the client presents the entire name each time, starting at a local server; if that server can't resolve it, it suggests a server for a domain that includes the name. In NFS, the client splits the pathname into simple names and presents them one at a time, each with the handle of the directory that contains it. NFS must work this way, because only the client knows its own mount points and symbolic links. The lecturer's example is a path through /server1/mnt/ that points to /server2/mnt/file, a file on a different server.

DNS: THE WHOLE NAME EACH TIME Client Server A Server B 1 · whole name try server B 2 · whole name attributes e.g. dsys.cis.unimelb.edu.au, sent in full every time
DNS: the server sees the full name and refers the client to a server for a domain containing it.
NFS: ONE COMPONENT AT A TIME Client server1 server2 lookup(fh,"mnt") fh of mnt lookup(fh,"file") fh of file only the client knows its mount points and links
NFS: the client sends one simple name plus the directory's file handle (fh), and switches server itself when the path crosses a mount point.

Comparing the four methods

Each method moves the work between client and servers. Notice that recursive navigation's big cost is the thread it holds in every server on the chain.

MethodProsCons
Iterative (client-controlled)Simple stateless servers; no server threads held; the client controls and caches each stepThe client does all the work and all the network round trips; it needs access to every server
MulticastOne round; the client needs no knowledge of the server layoutSilence for unbound names; multicast traffic to all servers; limited to the multicast scope
Non-recursive server-controlledThin clients; the chosen server can cache results for many clientsThat server does all the navigation work
Recursive server-controlledWorks across security boundaries; hides where data is placed; caching all along the chainTies up a thread in every server on the chain until the answer returns, delaying other requests; servers may refuse
How this is examined

"Explain the navigation methods, with a diagram each" is a classic 5-mark question. For each method, draw the client and three servers as in the at-a-glance figure, number the messages, and write one sentence on who drives the lookup. Then add the trade-off that separates them: iterative loads the client; recursive holds server threads but crosses security boundaries; multicast cannot tell unbound from lost.

Common mistake

Iterative is not the same as recursive. In iterative navigation the client contacts each server in turn. In recursive server-controlled navigation each server forwards the request onward and the answer comes back along the chain. Non-recursive server-controlled sits in between: one server iterates on the client's behalf.

Caching exam

Resolvers and servers both cache (keep a local copy of) the results of previous resolutions. Caching greatly improves response time, because it saves server round trips. It also improves availability, because it removes high-level servers such as the root from the path, so resolution can proceed even if some of them have failed. And it works well here because naming data changes rarely: addresses typically stay the same for months.

COLD CACHE: START AT THE ROOT local server root au edu.au unimelb.edu.au cis.unimelb… five servers visited, five round trips WARM CACHE: THE NS RECORD FOR CIS IS ALREADY KNOWN local server root au edu.au unimelb.edu.au cis.unimelb… straight there: one round trip the faded servers are off the path, so the lookup works even if they are down
Caching buys speed and availability. Once the local server has cached where the cis servers are, later lookups skip the whole upper tree, including the root.

The cost is that cached attributes can be out of date: if the binding changes, a cache may go on returning the old value. DNS limits this staleness with a per-record time-to-live (TTL): a lifetime in seconds after which a cached copy must be thrown away. §9.6 traces a cache with real TTL values.

Check yourselfExplain the four navigation methods (the exam would want a diagram of each).
  1. In iterative navigation, the client asks NS1, gets a referral to NS2, asks NS2, and so on until a server returns the attributes. DNS and NFS work this way.
  2. In multicast navigation, the client multicasts the name (and object type) to a group of servers and only the holder replies, so an unbound name gives silence.
  3. In non-recursive server-controlled navigation, the client asks NS1, which navigates (iteratively or by multicast) on the client's behalf and returns the result.
  4. In recursive server-controlled navigation, each server forwards the request to the next, and the results return along the chain.

The diagrams are the four steppers above, or the at-a-glance figure.

Check yourselfWhen must recursive navigation be used, and what is its cost?

It must be used across administrative domains that forbid clients or outside servers from learning where their naming data lives. The designated server then returns the attributes without revealing where they are placed.

Its cost is that a thread is held in every server on the chain until the answer returns, which delays other requests.

Check yourselfA client gets no reply to a name query, and cannot tell whether the name is unbound or a message was lost. Which navigation method was it using?
  1. Iterative
  2. Multicast
  3. Non-recursive server-controlled
  4. Recursive server-controlled

B, multicast. Only the server holding a name replies, so an unbound name produces silence, which looks the same as a lost message. In the other three methods some server always answers, even if only to say "unknown" or "try elsewhere".

Check yourselfGive two reasons why caching helps a name service, and the price paid for it.

It improves response time (fewer server round trips) and it improves availability (high-level servers such as the root are taken off the path, so lookups succeed even if they fail). It suits naming because naming data changes rarely. The price is staleness: a cached binding may be out of date, which DNS bounds with a per-record TTL.

In short
  • Resolution repeats "present a name, get attributes or a context plus a derived name". Navigation is resolution that crosses several servers, done by a resolver.
  • Iterative: the client asks each server. Multicast: ask all, only the holder answers. Non-recursive server-controlled: one server iterates for the client. Recursive: servers forward down the chain.
  • Recursive navigation hides data placement across domains but holds a thread on every server in the chain.
  • Caching speeds lookups and takes the root off the path, at the cost of stale data bounded by the TTL.
9.6

The Domain Name System (DNS) exam

The problem. Every computer on the Internet needs to turn host names into IP addresses, billions of times a day, and the names are owned by millions of different organisations. DNS (designed by Mockapetris; specified in RFC 1034 and RFC 1035) is the distributed naming database that does this. It is the case study for everything in the previous sections.

Why DNS replaced a single hosts file

Before DNS, all host names and addresses were kept in one central master file, and every computer that needed it downloaded a copy by FTP (the File Transfer Protocol). That approach had three problems: it did not scale to large numbers of computers; it did not allow local administration, though organisations wanted to manage their own names; and it was not a general name service, only a way to look up computer addresses.

BEFORE: ONE MASTER FILE all names, one file every computer downloads the whole file by FTP no scaling · no local administration · not a general name service
Centralised: one file, one authority, copied everywhere.
AFTER: A TREE OF SERVERS root au com unimelb.edu.au partitioned · locally run · replicated · cached
Distributed: each organisation runs the servers for its own part of the tree.

The structure of DNS names reflects the administrative structure of the Internet. DNS mainly names computers, along with mail hosts and name servers. It is fast (a typical query takes about 100 ms) because of heavy caching; it scales by partitioning the database; and it is resilient through replication. In Java, InetAddress.getByName() invokes DNS, as the code at the end of this section shows.

Domain names

The domain name space is partitioned both organisationally and geographically. The original generic top-level domains are com (commercial), edu (universities), gov (US government), mil (US military), net (network support centres), org (other organisations) and int (international organisations). Alongside them are the country domains, such as .au, .uk and .cn, which often have their own subdomains, for example edu.au, com.au and ac.uk.

. root com edu gov mil net org int au uk cn edu.au com.au ac.uk co.uk unimelb cis dsys.cis.unimelb.edu.au: a computer cdk5 ORIGINAL GENERIC TLDS generic top-level domain country domain and its subdomains geography is only a convention: a .co.uk name may be a computer in Spain
Two kinds of top-level domain. Grey boxes are the original generic TLDs; violet are country domains, which often have their own second level (edu.au, ac.uk). The teal path spells cis.unimelb.edu.au, a domain, while dsys.cis.unimelb.edu.au names a computer inside it.

The geographic-sounding names are conventional only: a .co.uk name may refer to a computer in Spain. A domain's name is the common suffix of the names in it, but only some domain names denote domains; others denote computers. cis.unimelb.edu.au is a domain, while dsys.cis.unimelb.edu.au is a computer.

What you can ask DNS exam

DNS answers five kinds of query. A query names a domain name, a class (IN for Internet) and a type (A, MX, NS and so on, see the record table below), and one message can carry several queries.

1 · host name resolution

Name → IP address

Used by browsers, FTP and SMTP (mail) clients. www.unimelb.edu.au → its IP address.
2 · mail host location

Domain → mail hosts

For mail to someone@cis.unimelb.edu.au, ask for cis.unimelb.edu.au with type mail. The reply is a list of mail hosts with preference values, so alternatives can be tried. Demo: nslookup -type=MX unimelb.edu.au.
3 · reverse resolution

IP address → name

128.250.1.22 → mulga.cis.unimelb.edu.au, via the special domain in-addr.arpa. A server answers only for IP addresses in its own domain.
4 · host information

Architecture and OS

The machine type and operating system. Not recommended in public, because it helps attackers.
5 · other attributes

Services, text, location

DNS can store arbitrary attributes (TXT and LOC records), but the lecturer advises against it: DNS is busy enough resolving names.

Name servers, zones and authoritative data exam

The DNS database is spread across a logical network of servers. Each server holds part of it, mainly the data for its local domain, so local queries are answered locally. So that names outside its domain can be resolved, each server also records the names and addresses of other name servers: at least the root servers, and usually its parent domain's server.

Definition · zone

A zone is the unit of naming data held by a server. It contains four things:

  1. attribute data for the names in a domain, less any subdomains delegated to lower authorities (for example, unimelb.edu.au minus cis.unimelb.edu.au);
  2. the names and addresses of at least two authoritative name servers for the zone;
  3. the names of the name servers for delegated subdomains, plus "glue" records giving their IP addresses;
  4. zone-management parameters, such as those for caching and replication (these are in the SOA record).
ZONE unimelb.edu.au ZONE cis.unimelb.edu.au unimelb.edu.au www abc NS for cis → ns.cis.unimelb… + glue A record cis dsys ns the parent zone keeps only a pointer (NS + glue) to the delegated child domain = the whole subtree · zone = the part one authority's servers hold
A zone is a domain minus its delegated subdomains. The gold zone holds unimelb.edu.au's own names plus a pointer to the servers for cis; everything under cis lives in a separate teal zone run by the department.

Authoritative and cached data

Authoritative data comes from the zone's own servers and is reasonably up to date. It is held by two kinds of server. The primary (master) server reads the zone data from a local master file that administrators edit. Secondary servers download the whole zone from the primary (a zone transfer) and then periodically check whether their copy still matches, typically once or twice a day, as set in the SOA record. A secondary whose copy is out of date is sent the latest version. Each zone must be replicated on at least two servers so that it survives a server failure.

Cached (non-authoritative) data. Any server may cache data it obtained from other servers, but it must tell clients that the data is non-authoritative. Each record has a TTL, and a caching server serves the record only until the TTL expires; after that it must go back to an authoritative server. Administrators set long TTLs for stable data and shorten the TTL before a planned change, which balances traffic against flexibility.

admin edits master file reads Primary (master) server Secondary 1 Secondary 2 zone transfer re-check once or twice a day (SOA); if stale, get the latest version AUTHORITATIVE DATA: the zone on 2+ servers Caching-only server stores only what it learns while resolving answers marked non-authoritative each record kept until its TTL expires CACHED DATA: fast, possibly stale
Two sources of answers. On the left, the authoritative servers for a zone, kept in step by zone transfers. On the right, a caching server, whose answers are quicker but must be flagged non-authoritative and expire with their TTL.

BIND (Berkeley Internet Name Domain), the standard UNIX implementation, consists of a resolver library plus the named daemon (a background server process). A server is configured as primary, secondary or caching-only, where a caching-only server stores only what it learns while resolving. A typical organisation runs one primary, several secondaries, and caching-only servers on hosts.

Common mistake

"Authoritative" means the primary's or a secondary's copy of the zone, not cached data, however fresh. And remember that a zone excludes its delegated subdomains: the unimelb.edu.au servers are not authoritative for dsys.cis.unimelb.edu.au.

Resource records exam

DNS stores its data as resource records of different types. Several of them match the queries above: A and AAAA serve host name resolution, MX serves mail host location, PTR serves reverse lookups, and HINFO holds host information.

TypeMeaningMain contents
AComputer address (IPv4)IPv4 number
AAAAComputer address (IPv6)IPv6 number
NSAuthoritative name serverDomain name of the server
CNAMECanonical name for an aliasCanonical (target) domain name
SOAStart of authority: marks the start of a zone's dataZone parameters (version, refresh interval, …)
PTRDomain name pointer (reverse lookups)Domain name
HINFOHost informationArchitecture and OS
MXMail exchangeList of ⟨preference, host⟩ pairs
TXTText stringArbitrary text

The zone data below is the CDK example for dcs.qmul.ac.uk (Queen Mary, University of London). A zone starts with its SOA record (omitted here), followed by NS and then MX records, and most of the remaining records are A records. Each line reads: name, TTL, class, type, value.

dcs.qmul.ac.uk   1D  IN  NS     dns0
dcs.qmul.ac.uk   1D  IN  MX     1 mail1.qmul.ac.uk
dcs.qmul.ac.uk   1D  IN  MX     2 mail2.qmul.ac.uk
www              1D  IN  CNAME  traffic
traffic          1D  IN  A      138.37.95.150
  • 1D is a TTL of one day: a cache may keep any of these records for up to a day.
  • The NS line names dns0 (short for dns0.dcs.qmul.ac.uk) as an authoritative name server for the zone.
  • In the MX records a lower preference number is tried first, so mail goes to mail1 and falls back to mail2.
  • www is an alias (CNAME) for traffic, whose A record gives the IPv4 address 138.37.95.150. This is the alias step you saw in §9.5.

Because dcs is a delegated subdomain, the parent zone qmul.ac.uk holds dcs NS dns0.dcs plus a glue A record for dns0.dcs.

PARENT ZONE qmul.ac.uk … its own records … dcs NS dns0.dcs dns0.dcs A (its IP address) ↑ the glue record delegation CHILD ZONE dcs.qmul.ac.uk dcs.qmul.ac.uk 1D IN NS dns0 dcs.qmul.ac.uk 1D IN MX 1 mail1.qmul.ac.uk dcs.qmul.ac.uk 1D IN MX 2 mail2.qmul.ac.uk www 1D IN CNAME traffic traffic 1D IN A 138.37.95.150
Why the parent needs glue. The NS record says which server holds the child zone, but that server's name, dns0.dcs.qmul.ac.uk, is itself inside the child zone. Without the glue A record in the parent, nobody could find its address without already being able to ask it.
Check yourselfWhat is a DNS zone, and how is zone data kept available and up to date?

A zone holds the domain's data minus any delegated subdomains, at least two authoritative name servers, the NS and glue records for its subdomains, and the management parameters in the SOA record.

Zone data is kept available and current by replication. The primary server reads it from a master file, and the secondaries obtain it by zone transfer and check once or twice a day that their copy is current. Every zone is held on at least two servers. Other servers may cache the data with a TTL, but they must mark it as non-authoritative.

Check yourselfWhich record type would you query to find where to deliver mail for cis.unimelb.edu.au, and which for turning 128.250.1.22 back into a name?
  1. A and CNAME
  2. MX and PTR
  3. NS and SOA
  4. MX and HINFO

B. MX gives the list of ⟨preference, mail host⟩ pairs. Reverse resolution uses PTR records in the special in-addr.arpa domain. HINFO (D) is host information, the record you should not publish.

Check yourselfA server answers a query from its cache, two minutes after fetching the record. Is the answer authoritative?

No. Only the zone's own primary and secondary servers give authoritative answers. Cached data is non-authoritative however recent it is, and the server must say so. It may serve the record only until the record's TTL expires.

Navigation and query processing

A DNS client is a resolver, which is library code linked into the program. It formats queries and sends them using a simple request-reply protocol over UDP (the connectionless datagram protocol, Part III) to a well-known port. Because UDP may lose messages, the resolver times out and resends when no reply arrives. It can be configured with a list of initial servers in order of preference.

Iterative navigation is the standard in DNS. Recursive navigation is optional: the resolver asks for it, and servers may decline, because it ties up threads. Recursive navigation must be used in domains that restrict client access to their DNS data for security reasons.

In practice, according to the lecturer's notes, a lookup happens in three stages:

  1. The resolver looks in its local cache.
  2. It asks its local or ISP DNS server, which navigates on its behalf.
  3. That server consults root and authoritative servers as needed. Each server returns either a referral to another server or the answer.

Root servers hold entries for several levels of the tree to cut the number of navigation steps, so a name like www.berkeley.edu takes at worst two steps even with an empty cache.

Walk-through: resolving dsys.cis.unimelb.edu.au exam

This is the slide example, and any host such as a.cis.unimelb.edu.au resolves the same way. It brings together referrals down the tree, delegation with glue records, and caching. Step through it slowly: this is the picture to reproduce if asked to "explain how a name is resolved in DNS".

Resolving dsys.cis.unimelb.edu.au, message by message
query: the A record for dsys.cis.unimelb.edu.au, with every cache empty Resolveron the client Local DNSserver (cache) root (.)a.root-servers.net auns1.nic.au edu.auedu.au server unimelb.edu.auabc.unimelb.edu.au cis.unimelb.edu.auns.cis.unimelb.edu.au 1 · querycache miss 2 · query 3 · NS au 4 · query 5 · NS edu.au 6 · query 7 · NS unimelb 8 · query 9 · NS cis + glue 10 · query 11 · A + TTL 12 · IP addr local cache now holds: NS au · NS edu.au · NS unimelb.edu.au · NS cis + glue A · A dsys, each with its TTLlater query for x.cis.unimelb.edu.au: straight to ns.cis.unimelb.edu.au
  1. The cast: the resolver on the client, the local DNS server (with its cache), and five name servers, one per level of the name dsys.cis.unimelb.edu.au. Every cache starts empty.
  2. 1 · query. The resolver checks its own cache, finds nothing, and asks the local server for the A record. The local server also has a cache miss, so it must navigate.
  3. 2 · query. The local server starts at a root server, whose address every server knows, and presents the whole name.
  4. 3 · referral. The root cannot answer, but it knows who runs au: it returns the NS records for au.
  5. 4 · query. The local server asks ns1.nic.au, which serves the zone au.
  6. 5 · referral to the edu.au servers.
  7. 6 · query. The local server asks the edu.au server.
  8. 7 · referral to the unimelb.edu.au server, abc.unimelb.edu.au.
  9. 8 · query. The local server asks abc.unimelb.edu.au.
  10. 9 · referral with glue. cis.unimelb.edu.au is a delegated subdomain, so the unimelb.edu.au zone holds only its NS record and a glue A record (the IP address of ns.cis.unimelb.edu.au). It refers the query there.
  11. 10 · query to ns.cis.unimelb.edu.au, the authoritative server for the zone that actually contains dsys.
  12. 11 · answer. That authoritative server returns the A record, with its TTL.
  13. 12 · answer to the resolver. The local server returns the IP address. Notice the mix of methods: the resolver-to-local-server leg was server-controlled (the resolver asked once and waited), while the local server's own walk down the tree was iterative (it contacted each server itself).
  14. Caching pays off. Every record learned on the way is cached with its TTL. A later query for x.cis.unimelb.edu.au goes straight to ns.cis.unimelb.edu.au: one round trip instead of five, and the root is not involved.
Check yourselfWalk through resolving a.cis.unimelb.edu.au with an empty cache.

The resolver asks the local server, which starts at a root server. The root refers it to the au name servers, ns1.nic.au refers it to edu.au, and the edu.au server refers it to unimelb.edu.au. The unimelb.edu.au server holds only the NS and glue records for cis.unimelb.edu.au, so it refers the query to ns.cis.unimelb.edu.au, which returns the authoritative A record.

Each result is cached with its TTL, so later queries skip the upper levels.

Tracing a cache with TTLs exam

Caching makes DNS fast, but a cached copy is a snapshot. If the authoritative data changes, a cache goes on serving the old value until the record's TTL runs out. The 2026 practice exam tested exactly this with concrete numbers, so step through its scenario.

Sample exam 2026 · Q8 · 5 marks

At t = 0 a local DNS server caches 192.0.2.10 for files.example.com with a TTL of 300 seconds. At t = 120 the authoritative server changes the address to 192.0.2.20. Clients do not cache, no other queries occur, and expired entries are not used. (a) Clients query the local server at t = 180 and t = 360. Which address is returned each time, and does the local server use its cached address or perform a fresh lookup? (3 marks) (b) The administrator proposes a shorter TTL for future records. Explain one benefit and one drawback. (2 marks)

The worked answers below are this site's, following the study guide. Staff released no official solutions to the practice exam.

A cached record over time (practice exam values)
authoritative server local server cache clients time (s) 0 120 180 300 360 192.0.2.10 cached 192.0.2.10 · TTL 300 s · valid until t = 300 192.0.2.20 t = 120: the address changes stale: the cache says .10, the truth is .20 t = 180: query → 192.0.2.10 cache hit (180 < 300), stale expires at t = 300 .20 (new) t = 360: query → 192.0.2.20 expired, so a fresh lookup After a change, a cache can serve the old value for up to one TTL. Here it was stale from t = 120 to t = 300.
  1. Three lanes share one time axis: the authoritative server (the truth), the local server's cache, and the clients, who never cache. At the start the authoritative address is 192.0.2.10.
  2. t = 0. The local server caches 192.0.2.10 with a TTL of 300 s, so the entry is valid until t = 0 + 300 = 300.
  3. t = 120. The authoritative server changes the address to 192.0.2.20. Nobody tells the local server: DNS does not detect staleness. From now on its cached copy is stale.
  4. t = 180. A client queries. The entry is still valid (180 < 300), so the local server answers from its cache, without contacting the authoritative server, and returns 192.0.2.10, which is now stale. It marks the answer non-authoritative.
  5. t = 300. The TTL runs out and the entry expires. Expired entries are not used.
  6. t = 360. A client queries again. There is no valid entry, so the local server performs a fresh lookup, navigating to the authoritative server, and returns 192.0.2.20. It caches the new address under the new record's TTL.
  7. The lesson: the TTL is the upper bound on staleness. In this trace, clients could be given the old address for any query between t = 120 and t = 300.
Worked answer · (a), 3 marks

The entry was cached at t = 0 with a TTL of 300 s, so it is valid until t = 300.

  • At t = 180 the entry is still valid (180 < 300). The local server answers from its cache, without contacting the authoritative server, and returns 192.0.2.10. That address is stale, because it changed at t = 120, but DNS does not detect staleness: a cached record is served, marked non-authoritative, until its TTL expires.
  • At t = 360 the entry has expired (at t = 300), and expired entries are not used. The local server performs a fresh lookup, navigating to the authoritative server for the name, and returns 192.0.2.20. It then caches the new address under the new record's TTL.
LONG TTL one cached copy lookuplookup change long stale window few lookups: light load on servers changes take long to be seen
Long TTL: cheap, but slow to notice a change.
SHORT TTL a lookup at every expiry change short stale window changes reach clients sooner many more lookups: more traffic and load
Short TTL: fresh, but every expiry costs a lookup.
Worked answer · (b), 2 marks

The benefit of a shorter TTL is that changes reach clients sooner. Cached copies expire quickly, so after an address change, a failover, or a change to DNS-based load sharing, stale data is served for at most the shorter TTL.

The drawback is extra lookup traffic. Entries expire sooner, so local servers must query the authoritative servers more often, which raises the load on those servers and on the network, and more client queries wait for a full resolution instead of getting a cached answer. That is why administrators normally give stable data long TTLs and shorten them only before a planned change.

Check yourselfSame setup, but the cached TTL is 100 s instead of 300 s. What does the client get at t = 180?

The entry cached at t = 0 is valid only until t = 100, so at t = 180 it has expired. The local server does a fresh lookup and returns the new address, 192.0.2.20. With this TTL the cached copy expired at t = 100, before the change at t = 120, so no client could have been given the stale address for this change.

Load sharing with DNS

Heavily used services such as web and FTP can run on a group of computers that share one domain name, with one A record per computer. The name server returns all the addresses in rotated (round-robin) order, and because clients usually use the first address, successive clients go to different servers.

Name server one name, three A records addr1 addr2 addr3 addr2 addr3 addr1 addr3 addr1 addr2 reply lists, rotated each time client 1 client 2 client 3 uses the first address server 1 (addr1) server 2 (addr2) server 3 (addr3) but a resolver that cached one answer keeps sending its clients to the same server
Rotation spreads the clients. Each reply (gold outline marks the address used) starts with a different A record, so three successive clients land on three different servers.

Caching spoils this, since a resolver keeps using the answer it cached, so these records are given a short TTL. Even so, client selection and caching mean that an even load is not guaranteed, and DNS is unaware of server load or failure: it will keep handing out the address of a crashed server.

Past exam 2016 · Q8(b) · 2 marksExplain how DNS can be used to distribute the load of incoming requests over a set of servers.
  • Register several A records under the same domain name, one for each server.
  • On successive queries, the name server returns the addresses in rotated (round-robin) order. Clients normally use the first address, so successive clients reach different servers.
  • Give these records a short TTL, because cached answers keep sending a resolver's clients to the same server.
  • One caveat is that caching and client choice mean the load is not evenly balanced, and DNS knows nothing about server load or failures.

DNS issues and discussion exam

DNS has three weaknesses worth being able to discuss.

1 · stale data

Caches can lie for up to a TTL

Mappings change rarely, but when they do (a service moves to a new IP address), caches can deliver stale data for up to the TTL, sometimes days, and connections then fail. DNS does not detect staleness and uses no strong replica consistency; the inconsistency only matters when a client actually uses the stale record.
2 · rigid structure

Hard to restructure

Changing the structure of the name space is hard. Merging separate domain trees under a new root breaks old absolute names and creates duplicates. Moving subtrees is also hard: if Scotland became independent, its domains would have to move to a new country domain. GNS tackles this (§9.8).
3 · limited data

Lowest common denominator

DNS stores only a small, common set of data. It assumes one mail service per domain, and it coexists with local name and directory services such as NIS and Active Directory for everything else.

DNS from Java

You rarely talk to DNS directly. In Java, the class InetAddress calls the resolver for you. The example shows host name resolution, a name with several A records (the load-sharing case), and reverse resolution.

import java.net.InetAddress;
import java.net.UnknownHostException;

public class DnsDemo {
    public static void main(String[] args) {
        try {
            // Host name resolution: local cache first, then DNS
            InetAddress a = InetAddress.getByName("www.unimelb.edu.au");
            System.out.println(a.getHostAddress());
            // A name shared by several servers may return several A records
            for (InetAddress x : InetAddress.getAllByName("www.google.com"))
                System.out.println(x.getHostAddress());
            // Reverse resolution (PTR record via in-addr.arpa)
            System.out.println(InetAddress.getByName("128.250.1.22").getCanonicalHostName());
        } catch (UnknownHostException e) {         // unbound name or DNS unreachable
            System.err.println("Lookup failed: " + e.getMessage());
        }
    }
}
  • InetAddress.getByName("www.unimelb.edu.au") is host name resolution: it checks the local cache first, then asks DNS for the A record, and returns an InetAddress. getHostAddress() prints it as a dotted string.
  • getAllByName("www.google.com") returns every address bound to the name. A popular service shared by several servers has several A records, which is exactly the load-sharing set-up above.
  • getByName("128.250.1.22") given a literal IP address just wraps it; getCanonicalHostName() then does reverse resolution, a PTR lookup in in-addr.arpa.
  • UnknownHostException is thrown when the name is unbound or DNS cannot be reached, so lookups must always be wrapped in try/catch.

Designing a name for speed

The 2016 exam turned the ideas of this Part around: instead of resolving names, design one.

Past exam 2016 · Q8(c) · 3 marksResource objects are stored across a multi-server system. Given an object's name, the object must be accessible as fast as possible. Describe a name space and name format best suited to this, and explain why. Is your name a pure name?
  • Use a flat, two-part, location-bearing name of the form serverID:objectID. The serverID identifies the storage server, and is mapped to an address by a small, locally cached table, or could even be the IP and port itself. The objectID is unique within that server, for example a local index or file handle.
  • This is fast because the client extracts the server directly from the name and sends one request to the right server. There is no name-service lookup and no navigation through a hierarchy of name servers, either of which would cost extra round trips, and the server can use the objectID as a direct index.
  • It is a non-pure name, because it contains information about the object's location. A pure name would carry no location, so it would always need a lookup (resolution) before access, which is slower.
  • The trade-off is that the scheme loses mobility/location transparency. If an object moves, its name changes or a forwarding pointer must be left behind, as with dangling URLs.
  • An alternative is a flat ID hashed to a server (for example, hash(id) mod N). This also avoids lookups, at the cost of rehashing when the servers change.
Check yourselfWhich statement about DNS is correct?
  1. Recursive navigation is the DNS standard, and servers must accept it.
  2. A secondary server's copy of a zone is non-authoritative.
  3. DNS detects stale cached data and refreshes it when the authoritative record changes.
  4. The resolver uses request-reply over UDP and retransmits after a timeout.

D. A is backwards: iterative is the standard and servers may decline recursion. B is wrong: secondaries hold authoritative data, obtained by zone transfer. C is wrong: DNS does not detect staleness; a cached record is simply served until its TTL expires.

In short
  • DNS replaced one hosts file with a partitioned, replicated, heavily cached tree of servers; names follow the administrative structure (generic TLDs and country domains).
  • A zone is a domain minus delegated subdomains, plus NS/glue for those subdomains and SOA parameters; primary and secondaries are authoritative, caches are not and expire with the TTL.
  • Know the record types (A, AAAA, NS, CNAME, SOA, PTR, HINFO, MX, TXT) and the full walk from root to ns.cis.unimelb.edu.au.
  • A cache can be stale for up to one TTL after a change; short TTLs trade freshness for traffic. Round-robin A records share load, imperfectly.
9.7

Directory and Discovery Services

The problem. A name service answers "what are the attributes of this name?". Often you don't know the name; you know what you want. "Who has phone number 03-8344 1344?" "Where can I print a high-resolution colour image?" Directory and discovery services start from attributes instead of names.

Definition · directory service

A directory service stores bindings between names and attributes and looks up entries that match attribute-based specifications, which makes it the dual of a name service. It returns the attribute sets of the matching objects, optionally only some of their attributes.

NAME SERVICE · "WHITE PAGES" · NAME → ATTRIBUTES www.cdk5.net name service the attributes of that one object (e.g. its address) DIRECTORY SERVICE · "YELLOW PAGES" · ATTRIBUTES → MATCHING ENTRIES type = printer, colour, high resolution directory service printer P name + chosen attributes printer R name + chosen attributes
Same data, opposite direction. A name service goes from one name to its attributes; a directory goes from a description to every entry that fits it, possibly several.

Directory services are also called yellow pages or attribute-based name services, while name services are the white pages (after the two printed telephone books). Examples are X.500, LDAP and Microsoft Active Directory; UDDI (a registry for web services) provides both white and yellow pages. Attributes have two advantages: they allow more powerful selection, and they don't expose organisational structure the way hierarchical names do. Their drawback is that textual names are simpler, so names remain dominant.

Discovery services

A discovery service is a directory service for spontaneous networks, where devices come and go without any administrator. It is automatically updated as devices join and leave, and it finds the services that a client, possibly a mobile one, needs within the current scope, such as the best printer after you arrive at a hotel. An ordinary directory's address is preconfigured, but a newcomer to a spontaneous network must use multicast to find the discovery service, at least the first time. Examples are Jini discovery, Service Location Protocol (SLP), Bonjour and SSDP (used by media devices). DNS itself should stay a plain name-to-IP service.

SPONTANEOUS NETWORK (E.G. A HOTEL) newcomer laptop 1 · multicast: find it 2 · here I am 3 · colour printer? 4 · printer P, address Discovery service updated automatically printer P (colour) printer Q (b/w) projector devices register on joining arrives with no configuration
Multicast first, then an ordinary lookup. The newcomer does not know where the discovery service is, so message 1 is a multicast; after that, it asks by attributes, like any directory. Devices keep the service current by registering as they join.

X.500 and LDAP (brief)

X.500 is an ITU/ISO standard directory service. Its entries are sets of typed attributes arranged in a tree, the Directory Information Tree (DIT), and the whole database is the Directory Information Base (DIB). Servers are DSAs (Directory Service Agents) and clients are DUAs (Directory User Agents). A DSA that cannot answer either chains the query to other DSAs or refers the client to another DSA, the server-controlled and iterative styles of §9.5. There are two types of access: read, which looks up an entry by its name, and search, which takes a base node plus a filter on attributes.

DUA Directory User Agent DSA 1 DSA 2 country organisation unit person entry typed attributes: name, phone, email, … read / search or: referral chain the DIT is split across DSAs; together they hold the DIB
A directory tree spread over servers. The DUA asks one DSA. If the data is elsewhere, that DSA chains the request onward (teal) or hands back a referral (dashed) so the DUA asks the other DSA itself.

X.500 is complex and saw little uptake. LDAP (the Lightweight Directory Access Protocol) lets a DUA access a directory directly over TCP/IP, with a simpler API and a textual encoding instead of ASN.1 (X.500's binary data-description notation). LDAP does not require X.500 behind it (Active Directory, for example, has an LDAP interface), and it is widely used in intranets for authenticated directory access.

Check yourselfName service vs directory service vs discovery service?

A name service (white pages) maps a name to attributes. A directory service (yellow pages) works the other way, taking an attribute specification and returning the matching entries; X.500, LDAP and Active Directory are examples. A discovery service is a directory that is updated automatically in spontaneous networks, and clients find it by multicast; examples are Jini, SLP and Bonjour.

Check yourselfYou arrive at a conference venue and your phone finds the nearest projector without any setup. Which kind of service did it use, and how did it find that service?
  1. DNS, by asking its configured local name server
  2. A directory service, at an address configured by the venue's administrator
  3. A discovery service, located by multicast on the local network
  4. LDAP over TCP/IP to the venue's X.500 directory

C. A spontaneous network has no preconfigured addresses, so a newcomer must multicast to find the discovery service, which is kept current automatically as devices join and leave. B describes an ordinary directory, whose address is preconfigured.

In short

Name services are white pages (name → attributes); directory services are yellow pages (attributes → matching entries), e.g. X.500, LDAP, Active Directory. Discovery services are self-updating directories for spontaneous networks, found by multicast. X.500 spreads its DIT over DSAs that chain or refer; LDAP is the lightweight TCP/IP, text-based way in.

9.8

Global Name Service (Brief)

The problem. DNS is rigid: merging two trees or moving a subtree breaks names (§9.6). GNS, the Global Name Service from DEC and a descendant of Grapevine, targets the requirements of §9.3, especially restructuring over a long lifetime. It is only briefly examinable, so focus on the idea of the directory identifier.

Its structure is a directory tree in which each directory has a unique directory identifier (DI), a unique number that identifies the directory itself rather than its position in the tree. Names have the form ⟨directory, value name⟩: a path to a directory, plus a simple name inside it.

GNS: merging trees and moving subtrees without breaking names
WORLD new root another tree … EC #599 UK AC QMUL Peter.Smith value name name used by a client whose working root is EC </UK/AC/QMUL, Peter.Smith> <#599/UK/AC/QMUL, Peter.Smith> DI prefixed WELL-KNOWN DIRECTORIES TABLE #599 → /EC so the path is /EC/UK/AC/QMUL MOVING A SUBTREE old place new place symbolic link left behind Drawback: the well-known directories table must be replicated everywhere, which hurts scalability.
  1. An existing GNS tree. Its root directory, EC, has the directory identifier #599. A client whose working root is EC names a user as ⟨/UK/AC/QMUL, Peter.Smith⟩: the directory path, then the value name.
  2. Merging trees: a new root, WORLD, is placed above the old roots, EC and another tree. Now the absolute name /UK/AC/QMUL is ambiguous: from WORLD, the path should start /EC.
  3. GNS keeps old names working: the client prefixes its working root's DI, so ⟨/UK/AC/QMUL, Peter.Smith⟩ becomes ⟨#599/UK/AC/QMUL, Peter.Smith⟩. Nobody had to rename anything.
  4. To resolve the DI, GNS keeps a table of well-known directories, mapping each DI to its current path: #599 → /EC. So the name resolves through /EC/UK/AC/QMUL.
  5. Moving a subtree: when a subtree moves, a symbolic link is left at the old location pointing to the new one, so old names still lead to it.
  6. On consistency, updates propagate asynchronously, so replicas are only eventually consistent. The drawback of the design is that the well-known directories table must be replicated everywhere, which hurts scalability.
Check yourselfHow does GNS keep old absolute names working after two trees are merged under a new root?

Every directory has a permanent directory identifier (DI). When a new root (e.g. WORLD) is placed above old roots, a client prefixes the DI of its working root to its old names, so ⟨/UK/AC/QMUL, Peter.Smith⟩ becomes ⟨#599/UK/AC/QMUL, Peter.Smith⟩. A table of well-known directories maps #599 to its current path, /EC. Moved subtrees leave symbolic links behind. The cost is that the well-known directories table must be replicated everywhere.

In short

GNS gives every directory a permanent DI. Trees merge under a new root while clients prefix their working root's DI to old names; a well-known directories table maps DIs to paths; moved subtrees leave symbolic links. Replicas are eventually consistent, and the replicated table limits scalability.

9.9

Pitfalls and Tutorial 9

This last section collects the mistakes that cost marks on this topic and the official Tutorial 9 answers. The tutorial answers are from the tutors on Ed (Tutorial 09, Week 10); staff confirmed that tutorial content is examinable, so treat these as model answers. (The TLS part of that tutorial belongs to Part X.)

Common pitfalls

Avoid these
  • A URL is a kind of URI. On its own, www.google.com is a domain name, not a URL.
  • Iterative is not the same as recursive. In iterative navigation the client contacts each server; in recursive server-controlled navigation each server forwards the request onward.
  • Caching improves availability as well as speed, but it brings staleness, which DNS bounds with the TTL.
  • "Authoritative" means primary or secondary data for the zone, not cached data. And a zone excludes its delegated subdomains.

Tutorial 9 official answers

Tutorial 9 · Q1Define and discuss uniform resource identifiers.

URIs identify resources on the Web and other Internet resources, such as electronic mailboxes. They give a generic way to write identifiers, so common software can process any identifier. As a result, new types of identifier can be introduced easily, and existing ones can be used by many different programs and services.

A URL is a URI that includes a network location: the protocol (how) and the remote name (where). URLs suffer when a resource is renamed or moved, because the links to it break. A URN, by contrast, is a URI that holds a name within a given name space but no location.

Tutorial 9 · Q2What are name services and why do we need them?

Definition: a name service is a service that gives resources a consistent and uniform naming, so other programs or services can locate them and obtain the metadata they need to interact with them. Its main operation is to resolve a name, that is, to look up the attributes bound to it.

Naming is a separate service because distributed systems are open. Separating it gives unification: resources managed by different services use the same naming scheme, as with URIs. It also supports integration: sharing resources created in different administrative domains needs a common naming service, because without one each domain may use an entirely different name format.

The key benefits are that resources can be located (files, web pages, services, databases), that naming is uniform, and that addresses are device-independent, so that, for example, a website can move to another server seamlessly. A name service also returns other attributes of a resource, such as its domain and type.

Tutorial 9 · Q3What is navigation, and what are the approaches?

When a name service is distributed, one server may not be able to resolve a name, so the request is passed from server to server. This is called navigation, and there are four approaches (§9.5):

  • Iterative. The client asks servers one at a time, usually following the domain hierarchy. Always starting at the root would put excessive load on the root.
  • Multicast. The client multicasts the request to the group of name servers, and only the server holding the name replies.
  • Non-recursive server-controlled. The client sends the request to one server, which continues iteratively on the client's behalf.
  • Recursive server-controlled. Each server passes the request on to the next server itself, recursively.
Tutorial 9 · Q4What is DNS, and how does it improve on a file-based implementation?

DNS is a name service design whose main naming database is used across the Internet. Before DNS, all host names and addresses were held in one central master file, which every computer that needed it downloaded by FTP. That approach had three problems: it did not scale to large numbers of computers; local organisations wanted to administer their own names; and a general name service was needed, not one only for looking up computer addresses.

DNS is designed for use in multiple implementations, each with its own name space, although in practice the Internet DNS name space is the one in widespread use.

The tutors' figure is the partial DNS tree (CDK Fig. 13.4) with Australian domains. The authoritative path for xyz.cis.unimelb.edu.au runs from the root to au, then to edu.au and unimelb.edu.au, and finally to cis.unimelb.edu.au. Each zone has its own name server, which holds entries pointing to the servers for the next level down (see the figure below).

rootzone server auzone server edu.auzone server unimelb.edu.auzone server cis.unimelb…zone server xyz → address each arrow: "the servers for the next level down are …" (NS records, plus glue where needed) authoritative path for xyz.cis.unimelb.edu.au
One zone server per level. Each server knows only its own zone and where the next level's servers are, which is why an empty-cache lookup visits them in order (the walk-through in §9.6).
How this Part is examined
  • Definitions (name / identifier / address, pure name, name service, zone, URL vs URN) appear as MCQs and short answers. One near-miss word decides the mark.
  • Navigation: "explain the four methods with diagrams", or "when must recursive navigation be used, and at what cost".
  • DNS mechanics: the resolution walk from the root, zones and authoritative data, record types, and load sharing (2016 Q8(b)).
  • Caching traces: given a TTL and a change time, say what each query returns and whether it was a cache hit (2026 practice Q8), then the trade-off of shorter TTLs.
  • Design: choose a name format for fast access and say whether it is pure (2016 Q8(c)).
In short

Names are for people, addresses for locations; name services hold bindings and resolve names, ideally with scale, long life, availability, fault isolation and tolerance of mistrust. DNS meets these with a partitioned, replicated, cached tree, navigated iteratively from the root, with TTLs bounding staleness. Directories and discovery services search by attributes instead, and GNS shows how DIs let a name space be restructured.