Domain Name System (DNS) Joe Abley AfNOG Workshop, AIS 2014, Djibouti Session 2: Resolver Operation and debugging.

Slides:



Advertisements
Similar presentations
1 Dynamic DNS. 2 Module - Dynamic DNS ♦ Overview The domain names and IP addresses of hosts and the devices may change for many reasons. This module focuses.
Advertisements

School of Electrical Engineering and Computer Science, 2004 Slide 1 Autonomic DNS Experiment Architecture, Symptom and Fault Identification.
2.1 Installing the DNS Server Role Overview of the Domain Name System Role Overview of the DNS Namespace DNS Improvements for Windows Server 2008 Considerations.
Domain Name System. DNS is a client/server protocol which provides Name to IP Address Resolution.
DNS Session 4: Delegation and reverse DNS Joe Abley AfNOG 2006 workshop.
DNS server & Client Objectives Contents
DNS Domain Name System –name servers –Translates FDQN to IP address List of fully qualified domain names (FDQN) and their IP addresses, FDQN has three.
DNS Domain name server – a server to translate IP aliases to addresses As you know, IP (internet protocol) works by providing every Internet machine with.
DNS. DNS is a network service that enables clients to resolve names to IP address and vice-versa. Allows machines to be logically grouped by domain names.
1 DNS. 2 BIND DNS –Resolve names to IP address –Resolve IP address to names (reverse DNS) BIND –Berkeley Internet Name Domain system Version 4 is still.
The Domain Name System Overview Introduction DNS overview How DNS helps us? Summary.
The Domain Name System. CeylonLinux DNS concepts using BIND 2 Hostnames IP Addresses are great for computers –IP address includes information used for.
DNS Domain Name Service america.pcs.cnu.edu->
Recursive Server. Overview Recursive Service Root server list localhost in-addr.arpa named.conf.
Hands-On Microsoft Windows Server 2003 Networking Chapter 6 Domain Name System.
The Domain Name System Unix System Administration Download PowerPoint Presentation.
70-293: MCSE Guide to Planning a Microsoft Windows Server 2003 Network, Enhanced Chapter 7: Planning a DNS Strategy.
Domain Name Services Oakton Community College CIS 238.
Copyright line. Configuring DNS EXAM OBJECTIVES  An Introduction to Domain Name System (DNS)  Configuring a DNS Server  Creating DNS Zones  Configuring.
Host Name Resolution. Overview Name resolution Name resolution Addressing a host Addressing a host Host names Host names Host name resolution Host name.
11.1 © 2004 Pearson Education, Inc. Exam Managing and Maintaining a Microsoft® Windows® Server 2003 Environment Lesson 11: Introducing WINS, DNS,
Module 10 Advanced Topics. DNS and DHCP DHCP can be configured to auto- update (using DDNS) the forward and reverse map zones Can be secured using allow-update.
Domain Name System (DNS) Ayitey Bulley Session-1: Fundamentals.
NET0183 Networks and Communications Lecture 25 DNS Domain Name System 8/25/20091 NET0183 Networks and Communications by Dr Andy Brooks.
Module 3 DNS Types.
Test cases for domain checks – a step towards a best practice Mats Dufberg,.SE Sandoche Balakrichenan, AFNIC.
70-291: MCSE Guide to Managing a Microsoft Windows Server 2003 Network Chapter 7: Domain Name System.
DNS Related Commands Sayed Ahmed Computer Engineering, BUET, Bangladesh (Graduated on 2001 ) MSc, Computer Science, U of Manitoba, Canada
October 8, 2015 University of Tulsa - Center for Information Security Microsoft Windows 2000 DNS October 8, 2015.
Chapter 16 – The Domain Name System (DNS) Presented by Shari Holstege Tuesday, June 18, 2002.
Module 8 DNS Tools & Diagnostics. Objectives Understand dig and nslookup Understand BIND toolset Understand BIND logs Understand wire level messages.
Secured Dynamic Updates. Caution Portions of this slide set present features that do not appear in BIND until BIND 9.3 –Snapshot code is available for.
BIND THE DNS SERVER TO USE !. DNS Domain Name Services Name to IP resolving /etc/hosts /etc/resolv.conf.
Internet and Intranet Protocols and Applications Lecture 5 Application Protocols: DNS February 20, 2002 Joseph Conron Computer Science Department New York.
1 Internet Network Services. 2 Module - Internet Network Services ♦ Overview This module focuses on configuring and customizing the servers on the network.
Module 8 DNS Tools & Diagnostics. Dig always available with BIND (*nix) and windows Nslookup available on windows and *nix Dig on windows – unpack zip,
DNS Session 1: Fundamentals ccTLD workshop February 2007 Georgetown, Guyana Based on Brian Candler's materials ISOC CCTLD workshop.
DNS Session 1: Fundamentals Based on Brian Candler's materials ISOC CCTLD workshop.
CIS 192B – Lesson 2 Domain Name System. CIS 192B – Lesson 2 Types of Services Infrastructure –DHCP, DNS, NIS, AD, TIME Intranet –SSH, NFS, SAMBA Internet.
DNS server & Client Objectives –to learn how to setup dns servers Contents –An Introduction to DNS –How To Download and Install The BIND Packages –How.
Linux Operations and Administration
DNS/Proxy Babu Ram Dawadi. Introduction - DNS Domain Name Server Domain Name Server –programs that store information about the domain name space –largest.
DNS - BIND9 Přednášející Vaše jméno. Master and caching name server options { directory "/var/named"; allow-transfer {“none”;}; }; zone "." { type hint;
DNS Session 1: Fundamentals Based on Brian Candler's materials ISOC CCTLD workshop.
DNS Session 4: Delegation and Reverse DNS Joe Abley AfNOG 2012, Serekunda, The Gambia.
Configuration of Authoritative Nameservice AfCHIX 2011 Blantyre, Malawi (based on slides from Brian Candler for NSRC)
Web Server Administration Chapter 4 Name Resolution.
1 CMPT 471 Networking II DNS © Janice Regan,
OPTION section It is the first section of the named.conf User can use only one option statement and many option-value pair under the section. Syntax is.
2/26/2003 Lecture 4 Computer System Administration Lecture 4 Networking Startup/DNS.
Domain Name System (DNS) Joe Abley AfNOG Workshop, AIS 2014, Djibouti Session-1: Fundamentals.
TCP/IP Protocol Suite 1 Chapter 17 Upon completion you will be able to: Domain Name System: DNS Understand how the DNS is organized Know the domains in.
WHAT IS DNS??????????.
Basics of the Domain Name System (DNS) By : AMMY- DRISS Mohamed Amine KADDARI Zakaria MAHMOUDI Soufiane Oujda Med I University National College of Applied.
AfNOG-2003 Domain Name System (DNS) Ayitey Bulley Setting up an Authoritative Name Server.
1 Lecture A.3: DNS Security r Domain Name Service r Security Problems in DNS.
DNS Session 3: Configuration of Authoritative Nameservice Joe Abley AfNOG 2013, Lusaka, Zambia.
Configuration of Authoritative Nameservice ccTLD workshop November th 2007 Amman, Jordan based on slides from Brian Candler for NSRC.
1 Internet Service DNS & BIND OPS335 Seneca College of Applied Technology.
DNS Session 1: Fundamentals ccTLD workshop February 2007 Georgetown, Guyana Based on Brian Candler's materials ISOC CCTLD workshop.
DNS Session 1: Fundamentals Based on Brian Candler's materials ISOC CCTLD workshop.
Track E0 AfNOG workshop April Abuja, Nigeria Introduction to the DNS.
DNS Domain name server a server to translate IP aliases to addresses
Domain Name System (DNS)
Created by : Ashish Shah, J.M.Patel College, Goregoan West
IMPLEMENTING NAME RESOLUTION USING DNS
DNS Session 4: Delegation and Reverse DNS
Configuration of Authoritative Nameservice
DNS Session 4: Delegation and Reverse DNS
Presentation transcript:

Domain Name System (DNS) Joe Abley AfNOG Workshop, AIS 2014, Djibouti Session 2: Resolver Operation and debugging

DNS Resolver Operation

How Resolvers Work (1) ● If we've dealt with this query before recently, answer is already in the cache - easy! Stub Resolver Resolver Query Response

What if the answer is not in the cache? ● DNS is a distributed database: parts of the tree (called "zones") are held in different servers ● They are called "authoritative" for their particular part of the tree ● It is the job of a caching nameserver to locate the right authoritative nameserver and get back the result ● It may have to ask other nameservers first to locate the one it needs

How caching NS works (2) Stub Resolver Query 1 Auth NS 2 Auth NS 3 Auth NS 4 Response 5

How does it know which authoritative nameserver to ask? ● It follows the hierarchical tree structure ● e.g. to query " (root) uk co.uk tiscali.co.uk 1. Ask here 2. Ask here 3. Ask here 4. Ask here

Intermediate nameservers return "NS" resource records ● "I don't have the answer, but try these other nameservers instead" ● Called a REFERRAL ● Moves you down the tree by one or more levels

Eventually this process will either: ● Find an authoritative nameserver which knows the answer (positive or negative) ● Not find any working nameserver: SERVFAIL ● End up at a faulty nameserver - either cannot answer and no further delegation, or wrong answer! ● Note: the resolver may happen also to be an authoritative nameserver for a particular query. In that case it will answer immediately without asking anywhere else. We will see later why it's a better idea to have separate machines for caching and authoritative nameservers

How does this process start? ● Every caching nameserver is seeded with a list of root servers zone "." { type hint; file "named.root"; } NS A.ROOT-SERVERS.NET. A.ROOT-SERVERS.NET A NS B.ROOT-SERVERS.NET. B.ROOT-SERVERS.NET A NS C.ROOT-SERVERS.NET. C.ROOT-SERVERS.NET A ;... etc /etc/namedb/named.conf /etc/namedb/named.root

Where did named.root come from? ● ftp://ftp.internic.net/domain/named.cache ● Worth checking every 6 months or so for updates

Demonstration ● dig +trace ● Instead of sending the query to the cache, "dig +trace" traverses the tree from the root and displays the responses it gets – dig +trace is a bind 9 feature – useful as a demo but not for debugging

Distributed systems have many points of failure! ● So each zone has two or more authoritative nameservers for resilience ● They are all equivalent and can be tried in any order ● Trying stops as soon as one gives an answer ● Also helps share the load ● The root servers are very busy – There are currently 13 of them – Individual root servers are distributed all over the place using anycast

Caching reduces the load on auth nameservers ● Especially important at the higher levels: root servers, GTLD servers (.com,.net...) and ccTLDs ● All intermediate information is cached as well as the final answer - so NS records from REFERRALS are cached too

Example 1: (on an empty cache) root server (A) referral to 'uk' nameservers uk server (A) referral to 'tiscali.co.uk' nameservers tiscali.co.uk server (A) Answer:

Example 2: smtp.tiscali.co.uk (after previous example) tiscali.co.uk server smtp.tiscali.co.uk (A) Answer: Previous referrals retained in cache

Caches can be a problem if data becomes stale ● If caches hold data for too long, they may give out the wrong answers if the authoritative data changes ● If caches hold data for too little time, it means increased work for the authoritative servers

The owner of an auth server controls how their data is cached ● Each resource record has a "Time To Live" (TTL) which says how long it can be kept in cache ● The SOA record says how long a negative answer can be cached (i.e. the non-existence of a resource record) ● Note: the cache owner has no control - but they wouldn't want it anyway

A compromise policy ● Set a fairly long TTL - 1 or 2 days ● When you know you are about to make a change, reduce the TTL down to 10 minutes ● Wait 1 or 2 days BEFORE making the change ● After the change, put the TTL back up again

Any questions? ?

DNS Debugging

What sort of problems might occur when resolving names in DNS? ● Remember that following referrals is in general a multi-step process ● Remember the caching

(1) One authoritative server is down or unreachable ● Not a problem: timeout and try the next authoritative server – Remember that there are multiple authoritative servers for a zone, so the referral returns multiple NS records

(2) *ALL* authoritative servers are down or unreachable! ● This is bad; query cannot complete ● Make sure all nameservers not on the same subnet (switch/router failure) ● Make sure all nameservers not in the same building (power failure) ● Make sure all nameservers not even on the same Internet backbone (failure of upstream link) ● For more detail read RFC 2182

(3) Referral to a nameserver which is not authoritative for this zone ● Bad error. Called "Lame Delegation" ● Query cannot proceed - server can give neither the right answer nor the right delegation ● Typical error: NS record for a zone points to a caching nameserver which has not been set up as authoritative for that zone ● Or: syntax error in zone file means that nameserver software ignores it

(4) Inconsistencies between authoritative servers ● If auth servers don't have the same information then you will get different information depending on which one you picked (random) ● Because of caching, these problems can be very hard to debug. Problem is intermittent.

(5) Inconsistencies in delegations ● NS records in the delegation do not match NS records in the zone file (we will write zone files later) ● Problem: if the two sets aren't the same, then which is right? – Leads to unpredictable behaviour – Caches could use one set or the other, or the union of both

(6) Mixing caching and authoritative nameservers ● Consider when caching nameserver contains an old zone file, but customer has transferred their DNS somewhere else ● Caching nameserver responds immediately with the old information, even though NS records point at a different ISP's authoritative nameservers which hold the right information! ● This is a very strong reason for having separate machines for authoritative and caching NS ● Another reason is that an authoritative-only NS has a fixed memory usage

(7) Inappropriate choice of parameters ● e.g. TTL set either far too short or far too long

These problems are not the fault of the resolver! ● They all originate from bad configuration of the AUTHORITATIVE name servers ● Many of these mistakes are easy to make but difficult to debug, especially because of caching ● Running a resolver is easy; running authoritative nameservice properly requires great attention to detail ● But nothing makes the helpdesk phone ring quite like a broken resolver

How to debug these problems? ● We must bypass caching ● We must try *all* N servers for a zone (a caching nameserver stops after one) ● We must bypass recursion to test all the intermediate referrals ● "dig +norec" is your friend dig foo.bar. a Server to queryDomainQuery type

How to interpret responses (1) ● Look for "status: NOERROR" ● "flags... aa" means this is an authoritative answer (i.e. not cached) ● "ANSWER SECTION" gives the answer ● If you get back just NS records: it's a referral ;; ANSWER SECTION foo.bar IN A Domain nameTTLAnswer

How to interpret responses (2) ● "status: NXDOMAIN" – OK, negative (the name does not exist). You should get back an SOA ● "status: NOERROR" with an empty answer section – OK, negative (name exists but no RRs of the type requested). Should get back an SOA ● Other status may indicate an error ● Look also for Connection Refused (DNS server is not running or doesn't accept queries from your IP address) or Timeout (no answer)

How to debug a domain using "dig +norec" (1) 1.Start at any root server: [a-m].root- servers.net. 1.For a referral, note the NS records returned 2.Repeat the query for *all* NS records 3.Go back to step 2, until you have got the final answers to the query dig a Remember the trailing dots!

How to debug a domain using "dig +norec" (2) 1.Check all the results from a group of authoritative nameservers are consistent with each other 2.Check all the final answers have "flags: aa" 3.Note that the NS records point to names, not IP addresses. So now check every NS record seen maps to the correct IP address using the same process!!

How to debug a domain using "dig +norec" (3) ● Tedious, requires patience and accuracy, but it pays off ● Learn this first before playing with more automated tools – Such as: ● ● – These tools all have limitations, none is perfect

Practical Worked examples

Building your own resolver ● Most common software is “BIND” (Berkeley Internet Name Domain) from ISC, – There are other options, e.g. unbound, ● Most Unixes have it, and already configured as a resolver – FreeBSD: need to install the bind910 package – Red Hat: "bind" and "caching-nameserver" RPM packages ● Question: what sort of hardware would you choose when building a resolver?

Improving the configuration ● Limit client access to your own IP addresses only – No reason for other people on the Internet to be using your cache resources ● Make cache authoritative for queries which should not go to the Internet – localhost  A – in-addr.arpa  PTR localhost – RFC 1918 addresses (10/8, /12, /16) – Gives quicker response and saves sending unnecessary queries to the Internet

Access control acl afnog_sse { ; /24; }; options { directory "/etc/namedb"; recursion yes; # this is the default allow-query { afnog_sse; }; # note: use 'allow-recursion' instead if your # nameserver is both caching and authoritative }; zone "." { type hint; file "named.root"; }; /etc/namedb/named.conf

localhost -> zone "localhost" { type master; file "master/localhost-forward.db"; allow-update { none; }; }; /etc/namedb/named.conf SOA localhost. root.localhost. ( ; serial 8h ; refresh 1h ; retry 4w ; expire 1h ) ; negative TTL NS localhost. A

> localhost zone " in-addr.arpa" { type master; file "master/localhost-reverse.db"; allow-update { none; }; }; /etc/namedb/named.conf SOA localhost. root.localhost. ( ; serial 8h ; refresh 1h ; retry 4w ; expire 1h ) ; negative TTL NS localhost. 1 PTR localhost. ; Don't forget the trailing dots!

RFC1918 reverse lookups zone " in-addr.arpa" { type master; file "master/empty.db"; }; zone "10.in-addr.arpa" { type master; file "master/empty.db"; }; # repeat for in-addr.arpa #... to in-addr.arpa /etc/namedb/named.conf SOA localhost. root.localhost. ( ; serial 8h ; refresh 1h ; retry 4w ; expire 1h ) ; negative TTL NS localhost.

FreeBSD resolver ● named_enable="YES" # in /etc/rc.conf ● For improved security, by default named is run inside a "chroot jail" under /var/named – accesses to /foo are actually to /var/named/foo – There is a symlink from /etc/namedb to /var/named/etc/namedb to make life easier

Managing a resolver ● /etc/rc.d/named start ● rndc status ● rndc reload – After config changes; causes less disruption than restarting the daemon ● rndc dumpdb – dumps current cache contents to /var/named/var/dump/named_dump.db ● rndc flush – Destroys the cache contents; don't do on a live system!

Absolutely critical! ● tail /var/log/messages – after any nameserver changes and reload/restart ● A syntax error may result in a nameserver which is running, but not in the way you wanted ● bind is very fussy about syntax – Beware } and ; – Within a zone file, comments start with semicolon (;) NOT hash (#)

Practical ● Build a resolver ● Examine its operation