Domain Name Service, Sec 4.17–4.25
  1. Domain Name Service (DNS)
    1. The protocol
      1. A client is configured with a DNS server to which it sends requests.
      2. Requests are sent by UDP. Answers return the same way.
      3. Clients may have up to three servers, and send any request to all. Take the first response.
      4. Requests and responses are binary messages.
    2. Multiple servers
      1. Too much load for one.
      2. Single point of failure.
    3. Hierarchical
      1. Distributed Authority
      2. Distributed Effort
    4. Processing a request
      1. A server is assigned to each domain, plus a root server which knows the servers for all the top-level domains.
      2. Clients must know at least the root server ahead of time.
      3. Look up bills.accounting.mega.com.
        1. Ask the root server the address of bills.accounting.mega.com. It will tell you the address of a com server.
        2. Ask the com server if it knows bills.accounting.mega.com. It will tell you the address of a name server for mega.com
        3. Ask the mega.com server if it knows bills.accounting.mega.com. It might be configured to tell you, or might refer to a server for the accounting department.
        4. If the later, one more request should do it.
    5. Recursive and non-recursive requests.
      1. A recursive request asks the server to run through the whole chain and tell the final answer.
      2. A non-recursive request just asks for as much a the server already knows.
      3. Clients may mark their request recursive or not.
      4. A server may ignore the recursive mark if so configured.
      5. If a server tells the next step instead of the answer, that is called a “referral.”
    6. Practical Deployment
      1. Root and Top-Level Domain (TLD) servers organized by IANA and its licensees.
      2. Second-level servers provided by the domain owner or their ISP.
        1. Public, non-recursive service for outside requests.
        2. Recursive, caching service for internal requests.
      3. Local host resolver.
        1. Usually a library to implement DNS client operations.
        2. DNS server to use configured by DHCP, modifiable by hand.
        3. There are public DNS servers if you don't like the one from your ISP or organization.
    7. Efficiencies
      1. Caching and caching support in DNS.
        1. Clients cache final results so they don't have to be run again.
        2. Servers doing recursive lookups cache at each level, and can process new requests with last known part.
        3. DNS responses specify how long they should be cached.
      2. A response from owning domain server, instead of something that cached it along the way is “authoritative.”
      3. Many requests are local.
      4. A name may map to several IP addresses.
        1. The DNS server may return them in rotation.
        2. The DNS server may return all of them and the client picks one.
        3. This allows load balancing.
    8. Security issues.
      1. Clients are generally assigned a local caching DNS server.
      2. Usually assigned by DHCP, which the machine trusts.
        1. The server you're assigned might be full of lies. (The coffee shop just might have a hacker running its DHCP).
        2. DHCP server identity is not verified. Another customer at the coffee shop might be running the one you get.
      3. Hackers can send unsolicited DNS responses in hopes of being believed. If so, these will be cached.
      4. A system using signed DNS records has been standardized, but is not widely deployed.
      5. In practice, the main defense against false DNS records seems to be the TLS certificate check in https.
        1. The contacted server must prove it is who it says.
        2. But most TLS services other than https do not use a certificate check.
    9. Record types.
      1. There are many record types for different information DNS can hold.
      2. Major ones:
        ARecords the IP address for a given name.
        PTRMap an IP address to a host name.
        MXWhere to send mail addressed to a host.
        CNAMEName is an alias for another.
      3. There may be multiple A records pointing to the same IP.
      4. A PTR record can denote any name that points to its IP, or one that doesn't.
    10. International Domains.
      1. The DNS standard allows host names to be made of ASCII.
      2. International names are coded with a complicated scheme called Punycode.
        1. www.xn--zrich-kva.com codes www.zürich.com
        2. A converter.
        3. The xn-- introduces a coded name.
        4. The first part holds the regular ASCII characters.
        5. The last part is an odd sort of base-36 number which gives the position and Unicode value for each non-ASCII character.
        6. The DNS server stores www.xn--zrich-kva.com, and it must be looked up under that form. The client converts and displays www.zürich.com.