DNS Explained. Hentzenwerke Whitepaper Series. By Whil Hentzen



Similar documents
- Domain Name System -

DNS based Load Balancing with Fault Tolerance

DNS Session 4: Delegation and reverse DNS. Joe Abley AfNOG 2006 workshop

Creating a master/slave DNS server combination for your Grid Infrastructure

Advanced DNS Course. Module 4. DNS Load Balancing

How To Manage Dns On An Elfiq Link Load Balancer (Link Balancer) On A Pcode (Networking) On Ipad Or Ipad (Netware) On Your Ipad On A Ipad At A Pc Or Ipa

HTG XROADS NETWORKS. Network Appliance How To Guide: DNS Delegation. How To Guide

DNS zone transfers from FreeIPA to non-freeipa slave servers

Application and service delivery with the Elfiq idns module

DNS and BIND Primer. Pete Nesbitt linux1.ca. April 2012

ECE 4321 Computer Networks. Network Programming

Wireshark DNS. Introduction. nslookup

Local DNS Attack Lab. 1 Lab Overview. 2 Lab Environment. SEED Labs Local DNS Attack Lab 1

DNS. Computer Networks. Seminar 12

DNS/DHCP Administration Guide for Linux

DNS and BIND. David White

Domain Name System (DNS) Services

Wireshark Lab: DNS v6.01

Wireshark Lab: DNS. 1. nslookup

Names vs. Addresses. Flat vs. Hierarchical Space. Domain Name System (DNS) Computer Networks. Lecture 5: Domain Name System

Domain Name Servers. Domain Types WWW host names. Internet Names. COMP476 Networked Computer Systems. Domain Name Servers

How to set up the Integrated DNS Server for Inbound Load Balancing

Copyright 2013 wolfssl Inc. All rights reserved. 2

Configuring DNS. Finding Feature Information

South East of Process Main Building / 1F. North East of Process Main Building / 1F. At 14:05 April 16, Sample not collected

DNS/DHCP Services Administration Guide for Linux

Domain Name Server. Training Division National Informatics Centre New Delhi

DNS ROUND ROBIN HIGH-AVAILABILITY LOAD SHARING

Domain Name System :49:44 UTC Citrix Systems, Inc. All rights reserved. Terms of Use Trademarks Privacy Statement

Reduce your downtime to the minimum with a multi-data centre concept

H3C Firewall and UTM Devices DNS and NAT Configuration Examples (Comware V5)

Understanding DNS (the Domain Name System)

netkit lab Università degli Studi Roma Tre Dipartimento di Informatica e Automazione Computer Networks Research Group Version 1.

The Domain Name System

How-to: DNS Enumeration

How To Create A Toecdn (Open Edge Content Delivery Network) From Scratch On A Microsoft Ipad Or Ipad (For Free) On A Pc Or Ipa (For A Free) With A Free Ipad) On An Ip

Enterprise Architecture Office Resource Document Design Note - Domain Name System (DNS)

IPv6 support in the DNS

DNS + DHCP. Michael Tsai 2015/04/27

Dual DHCP/DNS Server

The secret life of a DNS query. Igor Sviridov <sia@nest.org>

Domain Name System. Heng Sovannarith

Work No. 1 Samba. What is Samba?

Agenda. Network Services. Domain Names. Domain Name. Domain Names Domain Name System Internationalized Domain Names. Domain Names & DNS

Remote DNS Cache Poisoning Attack Lab

Application Protocols in the TCP/IP Reference Model. Application Protocols in the TCP/IP Reference Model. DNS - Concept. DNS - Domain Name System

CSIS 3230 Computer Networking Principles, Spring 2012 Lab 7 Domain Name System (DNS)

Sample Configuration Using the ip nat outside source static

Application Protocols in the TCP/IP Reference Model

CS3250 Distributed Systems

DNS ActiveX Control for Microsoft Windows. Copyright Magneto Software All rights reserved

Ethereal Lab: DNS. 1. nslookup

EE 7376: Introduction to Computer Networks. Homework #3: Network Security, , Web, DNS, and Network Management. Maximum Points: 60

Send document comments to

The Survey Report on DNS Cache & Recursive Service in China Mainland

walkthrough Università degli Studi Roma Tre Dipartimento di Informatica e Automazione Computer Networks Research Group Version 1.

Lecture 2 CS An example of a middleware service: DNS Domain Name System

DNS. Computer networks - Administration 1DV202. fredag 30 mars 12

Application Protocols in the TCP/IP Reference Model. Application Protocols in the TCP/IP Reference Model. DNS - Domain Name System

THE MASTER LIST OF DNS TERMINOLOGY. v 2.0

Sample Configuration Using the ip nat outside source list C

Introduction to the Domain Name System

Services: DNS domain name system

DNS Pharming Attack Lab

IPv6 Support in the DNS. Workshop Name Workshop Location, Date

LAB: Concept of DNS. Completed by: Learning the basics of DNS. Lab preparation: Boot a Linux OS Document version: Class: Name: Surname:

Configuring DHCP and DNS Services

The Domain Name System

THE MASTER LIST OF DNS TERMINOLOGY. First Edition

F5 and Infoblox DNS Integrated Architecture Offering a Complete Scalable, Secure DNS Solution

Part 5 DNS Security. SAST01 An Introduction to Information Security Martin Hell Department of Electrical and Information Technology

MS Skype for Business and Lync. Integration Guide

Lab Diagramming External Traffic Flows

PowerLink Bandwidth Aggregation Redundant WAN Link and VPN Fail-Over Solutions

DNS Service on Linux. Supawit Wannapila CCNA, RHCE

Reverse Proxy Guide. Version 2.0 April 2016

Internet Security [1] VU Engin Kirda

Lab Configuring the PIX Firewall as a DHCP Server

Module 11. Configuring Domain Name System. Contents: Lesson 1: Install and Configure DNS in an AD DS Domain Lab A: Install the DNS Service 11-11

netkit lab load balancer dns 1.2 Massimo Rimondini Version Author(s)

Domain Name System (DNS) Fundamentals

Configuring Basic Settings

Web Application Hosting Cloud Architecture

z/os V1R11 Communications Server system management and monitoring

Designing and Implementing a Server Infrastructure

Migration Technical Guide

Understanding DNS By Robert Sterler

Computer Networks: Domain Name System

NET0183 Networks and Communications

The Posadis DNS server

Simple DNS Plus. Version Copyright JH Software

SI455 Advanced Computer Networking. Lab2: Adding DNS and Servers (v1.0) Due 6 Feb by start of class

Transcription:

HentzenwerkeWhitepaperSeries DNSExplained ByWhilHentzen DNS. In a general sense, it's what tells your computer that www.example.com is attached to 192.0.34.166, so that you can enter 'www.example.cominyourwebbrowserinsteadoftheipaddressitself. YoucanlivealongtimewithoutknowinganythingaboutDNS,and,ina perfectworld,that'showitshouldbe,justasyoudon'thavetoknowthe mixoffueltooxygenthatyourcarburetordeliverstoletyourcarengine run. But it's not a perfect world, not quite yet, and so there are times, particularlyasawebsitedeveloper,thatyou'llneedtoknowabit,oralot, aboutdns. www.hentzenwerke.com

Page2 DNSExplained 1.Preface 1.1Copyright Copyright2006WhilHentzen.Somerightsreserved.ThisworkislicensedundertheCreativeCommonsAttribution NonCommercial NoDerivsLicense,whichbasicallymeansthatyoucancopy,distribute,anddisplayonlyunalteredcopies ofthiswork,butinreturn,youmustgivetheoriginalauthorcredit,youmaynotdistributetheworkforcommercialgain, norcreatederivativeworksbasedonitwithoutfirstlicensingthoserightsfromtheauthor.toviewacopyofthislicense, visithttp://creativecommons.org/licenses/by nc nd/2.0/. 1.2Revisions 1.2.1History Version Date Synopsis Author 1.0.0 2006/11/21 Original WH 1.2.2Newversion Thenewestversionofthisdocumentwillbefoundatwww.hentzenwerke.com. 1.2.3Feedbackandcorrections Ifyouhavequestions,comments,orcorrectionsaboutthisdocument,pleasefeelfreetoemailmeat 'articles@hentzenwerke.com'.ialsowelcomesuggestionsforpassagesyoufindunclear. 1.3Referencesandacknowledgments ThankstothefolksontheMilwaukeeLinuxUserGrouplist(www.milwaukeelug.org),particularlyAaronSchrab,who reviewedmultiplecopiesofthisdocument,aswellasallthatamazingstuffthatonecanfindontheinternet. 1.4Disclaimer Nowarranty!Thismaterialisprovidedasis,withnowarrantyoffitnessforanyparticularpurpose.Usetheconcepts, examplesandothercontentatyourownrisk.theremaybeerrorsandinaccuraciesthatinsomeconfigurationsmaybe damagingtoyoursystem.theauthor(s)disavowsallliabilityforthecontentsofthisdocument. Beforemakinganychangestoyoursystem,ensurethatyouhavebackupsandotherresourcestorestorethesystemto itsstatebeforemakingthosechanges. Allcopyrightsareheldbytheirrespectiveowners,unlessspecificallynotedotherwise.Useofaterminthisdocument shouldnotberegardedasaffectingthevalidityofanytrademarkorservicemark.namingofparticularproductsorbrands shouldnotbeseenasendorsements. 1.5Prerequisites ThisdocumentwaswrittenforfolkswhowanttodevelopWebsitesandputthemontheInternet.Itisnotintendedforfolks whowouldbeadministeringadnsserver,say,foranisp.rather,itprovidesahigh leveloverviewofthetechnologyand whatawebsitedeveloperneedstoknow.assuch,itglossesoversomeofthein depthtechnicalissuesandsimplifies others,eliminatingdetailsthatareunimportantforthislevelofdiscussion. www.hentzenwerke.com

DNSExplained Page3 2.ThefourplayersintheDNSarchitecture Strictlyspeaking,DNS=DomainNameService,thearchitectureformappingIPaddressestohostnames.Unfortunately, sloppiness,slang,andjargonhasusurpedthetermtomeaneverythingfromthearchitecturetothesoftwarethatimplements thearchitecturetothedatabasethatholdstheactualhostname IPaddressmappings. Thereareseveralplayersinvolvedinthearchitecture thednsdatabase,adnsserver,andadnsclient. Thefirstplayeristhe"DNSdatabase",thedatabasewheretheactualmappingsofhostnamesandIPaddressesare stored.thesecondplayerisadnsserver,thesoftwarethatdishesoutinfofromthednsdatabasewhenasked.thedns databaseandthednsserversoftwarebothreside,obviously,onadnsservermachine.thednsclientistheprogram(in aloosesenseoftheword)thatsitsonanend user'scomputerthatdoestheaskingofadnsserverwhentheend useris tryingtoconnecttoanothercomputer. 2.1DNSdatabase Eachmappingisstoredina(verylarge)databasethatisdistributedacrossacollectionofspecialserversconnectedtothe Internet,sothatonlypartofthedatabaseisonanyoneserver.TheseserversarecalledDNSservers,or,sometimes,DNS nameservers.therearedifferentdnsserversfordifferenttopleveldomains thoseendingin'.com'arelocatedinone database,forexample,whilethoseendingin'.edu'arelocatedinanotherdatabase.whenyouwanttoaccesscontenton example.com,you'lltypethaturlintoyourbrowser.yourbrowserlooksuptheipaddressofexample.com'shostviathe appropriatednsdatabase.thisprocessiscalled'resolving'anaddress.ifeverythingworks(allthecorrectdataisfound), voila,yourbrowserisnowdisplayingdatasentfromexample.com'swebserversoftware. IntheearlydaysoftheInternet,therewereonlyafewDNSservers.TheentirelistofdomainnamesandIPaddresses wascontainedinasimpletextfile,andeverycomputerontheinternethadacopyofthattextfile.itwasrelativelyeasyto keepallofthecopiesofthistextfileinsync.decadeslater,however,thingshadgottenbusier.imagineifthetensof millionsofdomainsontheinternetwerealllistedinasingletextfile,andeveryoneofthe"billyunsandbillyuns"of computersontheinternethadtokeepanup to datecopyofthatenormoustextfile. 2.2DNSserver architecture EvenaftersplittinguptheDNSdatabaseintosubsetsforthevariousdomains,itcouldgetverycrowdedateachoftheDNS serversiftherewasonlyoneset particularlyiftherewasonlyonednsserverfor.comdomains!inaddition,havingallof thednsinformationinoneplacewouldcreateasinglepointoffailurethat,ifitdidindeedfail,wouldbringtheentire Internettoacrashinghalt.Asaresult,thearchitectsoftheInternetcreatedtheabilityformultiplecopiesoftheDNS databasestobeavailabletousersaroundtheworld.thatmeanstherearemanydnsserversscatteredaroundtheinternet. SowhenyourcomputertriestoresolveaURL,itlikelyusesacopy(or'mirror',or'slave')oftheprimaryDNSserverforthe typeofdomaininquestion,insteadofgoingtothemastercopy.thissystemofmultiplednsserversalsoprovides redundancy ifoneofthemgoesdown,yourcomputercanuseadifferentdnsserverinsteadofgettingstalled.kindof likehavingasparecopyofthephonebookathomewhenthemastercopyhasdisappearedsomewhereinyourteenager's room. TherearelogicallytwotypesofDNSservers authoritativeandcaching(alsoknownas'recursive').asinglephysical DNSservercanservebothrolesatonce,butforsimplicity'ssake,let'sassumethatahostisoneortheother. 2.2.1.Authoritative AuthoritativeserversaretheDNSserversoflastresort,sotospeak.Apurelyauthoritativeservergetsenteredwithdata abouthostname IPaddressmappings(called'zonefiles',whichI'lldiscussshortly)andthenrespondstorequestsforthat information itneverreliesonotherdnsserversforinformationthatitismissing.twospecialcasesofauthoritative serversarerootandtldservers. TherootserversformwhatyoumightthinkofastheapexoftheDNSpyramidofservers.Theycontaininformation aboutthetld topleveldomain servers.thenextlevelaretheparent,ortld topleveldomain servers.eachofthese www.hentzenwerke.com

DNSExplained Page4 isauthoritativeforoneormoretopleveldomains.forexample,.comand.netarebothhandledby*.gtld servers.net.when youregisteryourdomain,oneofthetldserverswillknowwheretofindinformationforyourdomain. 2.2.2.Caching Caching/recursiveservers,ontheotherhand,arethetypethatgetlistedasnameserversonanend user(client)computer. WhenyousetupyourInternetconnection,youlikelyhavetoentertwoormore"DNSserver"or"nameserver"addresses. Thesecachingserverscanbethoughtofastheworkerbees millionsofmachinesscatteredacrosstheglobewherethe actualdnsmappingsofhostnamesandipaddressesarestored.manyarehostedatispsandsimilarlysecureandreliable locations,buttheycouldalsobeatprivatelyowned"dns'rus"typecompanies,locatedinatrailerparkskirtinga downtown'sredlightdistrict.youcanevenrunacachingserveronyourowncomputer. Roughlyspeaking,theTLDserverspointtothese'workerbee'DNSserverswhenaskedwhereyourdomain's informationis. 2.3DNSserver software DNSserversoftwareisaprogramrunningonacomputerthatgetsqueries(intheformofURLs)fromfolkslookingfor yourdomainanddishesoutresponses(intheformofipaddresses)inreturn,usingoneofthose'workerbee'dns databases.yourfriend'bob'hearsyouhaveawebsite,www.example.com,andenterstheurlintohiswebbrowser.the WebbrowserlooksuptheDNSserversthatheenteredinhisnetworkcardsettings,andasksoneofthemwhattheIP addressforyourwebsiteis.ifthatdnsserverhasthemappingforwww.example.com,it'lllookitupandreturntheip address,192.0.34.166.insomecases,thednsserverheisusingwon'thavewww.example.cominitsowndatabase,butit knowswheretogolook thetldserverthatfor'.com'. ThisDNSserversoftwareprogramisrunningconstantly,andistypicallyconfiguredtobea'service',sothatitstartsup whenthecomputerisstarted.thisissimilartoadatabaseserverorawebserver(bothofwhich,interestinglyenough,also lieinwaitforrequestsfromusersandthendishoutresponsesinreturn.)therearespecificinstancesofdnsprograms,just liketherearespecificinstancesofdatabaseservers(mysql,postgresql,oracle)andwebservers(apache,iis,etc.). CommonDNSprogramsincludeBIND,tinydns,anddjbdns. 2.4DNSclient ThethirdplayerinthisschemeisaDNS'client'.Youcanthinkofthisclientasaprogramrunningonyourdesktop(laptop) computerthatfetchestheipaddressfromadnsserver.whenyouenteraurlintoyourbrowser,yourbrowserthentalks toyourdnsclient,whichthengoesoutontotheinternettofindoneofthednsserversthatwereidentifiedinthenetwork cardsettingsonyourcomputer.whenthednsclientgetsananswer,itthenreturnsthatanswerbacktowhoeverrequested it,suchasthewebbrowser. Strictlyspeaking,theDNSclientisn'tactuallyaseparateprogramonyourcomputer,likeaWebbrowseroranemail client.instead,it'samoduleorpartofalargerprogram oftentheoperatingsystem thathandlesthework.thereisn'ta separateprogramthatcanbestartedupandshutdown.awebbrowser,forinstance,wouldjustasktheostodothe lookup. 2.5Zonefile Finally,althoughIsaid,'three',there'sonemoreplayerthatIshouldmentionnow thezonefile.thednsdatabaseconsists ofmillionsofhostname IPaddressmappings.Atfirstglance,youmightthinktheDNSdatabasejustlookslikethis: anacondasteel.com99.20.4.160 bestbuy.com68.7.7.14 crazyeddie.com100.203.40.57 digg.com8.12.66.48 example.com192.0.34.166 ford.com44.29.151.40 www.hentzenwerke.com

Page5 DNSExplained Inreality,thedatabaseisconsiderablymorecomplexthanthis.AdomainhasmorethanjusttheIPaddressfortheWeb server.therecouldbeotherserversinvolved,suchasanftpserveroramailserver.therecouldbesubdomains(the 'www.'partoftheurl),andadditionalinformation,suchastimeforupdatestobechecked,arealsoneeded.asaresult, eachdomainhasasetofrecordsthattogetherarecalleda'zonefile'.asinglezonefilelookssomethinglikethis: $TTL 86400 $ORIGINexample.com. @1DIN SOAns1.example.com. 2005010101;serial 3H;refresh 15;retry 1w;expire 3h;minimum ) INNSns1.example.com. INNSns2.example.com. MX10mail.example.com. MX20mail.another.com. A192.0.34.166 wwwina192.0.34.167 INCNAMEwww.example.com. hostmaster.example.com.( Whilethismaylookconfusing,thisinformationrepresentswhatwouldbeneededforarathersimpledomain.Azone fileforabigdomain,suchasforfordmotorcompanyorgeneralelectric,isconsiderablymoreinvolved.thekeypointto bringawayfromthisisthatthednsrecordsforasingledomainaremoreinvolvedthanasimpleonetoonehostname IP addressmapping.additionally,nowyouknowthatthednsdatabaseisacollectionofmillionsofzonefiles. Revisitingtheterminology...yourzonefilecontainsyourDNSrecords.EachDNSrecordisforaspecificservice,such as'www'forawebserveror"mx"foramailserver.i'llusetheterms'zonefile'and'dnsrecords'somewhat interchangably,astheyrefertothesamegeneral'chunkofdata'. Let'slookatthepaththatDNSplaysbothontheendofanindividualsurfingtheWeborgettingtheiremail,andasan administratorofawebsite. 3.IndividualSurfer Whenyouconfigureyourcomputer'snetworkcardormodemtoconnecttotheInternet,yourInternetServiceProvider (ISP)givesyoutheaddressesforyourDNSsettings.Typicallyyouaregivenatleasttwo,butsometimesthree.This duplicationissothatifoneofthednsserversisunreachableorslow,yourmachinewillhaveasecondchoice(andathird) totry. InWindows2000,yougettothisdialogviaStart Settings NetworkandDial upconnections Properties TCP/IP component Properties,asshowninFigure1. www.hentzenwerke.com

DNSExplained Page6 Figure1.TheWindows2000dialogforenteringDNSnameservers. InFedoraCore6,yougettothedialogviaF Administration Network NetworkConfigurationdialog DNStab,as showninfigure.2. Figure2.TheFedoraCore6dialogforenteringDNSnameservers. www.hentzenwerke.com

DNSExplained Page7 WhenyouenteraURLinyourWebbrowser,orconnecttoyourmailserverviayouremailclient,orwhenyourIM programtriestoconnecttoanotherserver,yourcomputerwillsendaquerytothednsserversinyourdnssettingstolook upthedomainname.abunchofstuffhappens,andeventuallyaresponsewillcomebackwiththeipaddressofthe machineyou'retryingtoreach,andyourcomputerconnectstothatmachine.there'sobviouslyalotmoregoingonunder thehood,butforourpurposes,thisiscloseenough. SomenetworkcardconfigurationprogramscalltheDNSservera'nameserver'(typically,Linuxdistrosdo.) That'sallanend userreallyneedstoknow.let'stakealookatwhatanadministratorneedstoknow,behindthescenes. 4.SettingupaWebserver/Website SettingupaWebserverisasinvolvedasbeingacasualInternetuseriseasy.We'llstartbyassumingyoudon'tevenhavea domainnameyet. 4.1Domainname You'llneedadomainname,suchasexample.com.Youmaybeusedtothinkingofdomainnamesas'www.example.com', butinactuality,the'www'isanadd onthatwe'lldealwithlater.whenyougetadomainname,you'lljustbegettingthe 'example.com'part.(onceyouhavethe'example.com'part,youcansetupmultiplesites,calledsubdomains,withnames like'www.example.com','customers.example.com','private.example.com'and'bob.example.com'.) You'llgetadomainnamefromaregistrar.Therearemany,manyregistrarsoutthere,butmostofthemaresimply resellersfortheprimarydomainnameregistrars.primaryregistrarsincludenetworksolutions.com,register.com, godaddy.com,andsoon.forpurposesofthisarticle,i'llusegodaddy.comasthesampleregistrar,bothbecausethey'rethe oneiuse(but,no,idon'tgetacommissionforreferringthem)andbecausei'veusednetworksolutions.comand register.com,andfindthemlackinginmanysignificantareas.they'vebothbeenaroundforalongtime,butiwouldn'tever usethemagain.youmaychoosedifferently,butcaveatemptor. (Theonebigproblemwithgodaddy.comisthattheyarevery,verypushyabouttryingtosellyouextrastuffthatyou reallydon'tneed.ignoreitallforthetimebeing;youcanalwaysaddittoyoursitelaterifyouwant,andthey'reconstantly runningspecialstogiveyoudealsondoingso.) 4.2Navigatingtoabrandnewdomain OK,sonowyou'veplunkeddownyour$8.95atgodaddyandnowhaveyourveryowndomainname,say,'example.com'. Whathappenswhenyourmom,allproudthatherson/daughterhastheirveryownwebsite,typesin'www.example.com' intoherbrowser?absolutelynothing.that'sbecausethereisnowebsiteattachedtothatdomainnameyet,andsoyour mom'sbrowserendsupin'404 pagenotfound'land.soyouneedtodofourmoresteps.i'lldescribeingeneraltermswhat thosefourthingsare,andtheni'llwalkthroughaspecificexample. First,createawebsiteandputitonaWebserversomewhere.Second,findaDNSserver(oneofthoseauthoritative DNSserversImentionedearlier)thatyoucanuse.Third,createaDNSrecord(inyour'zonefile')thatmaps 'www.example.com'totheipaddressofthewebserverfromstep1,andstuffitintothatauthoritativednsserverthatyou foundinstep2.andfourth,tellyourregistrar,godaddy.com,thatthednsserverthatcontainsyourzonefilefor www.example.com,istheauthoritativednsserveryoupickedinstep2. Ifyouusedgodaddy.com(ormostanyotherpopularregistrar),you'llfindthattheprecedingdescriptionisn't completelyaccurate whenyourmomtyped'www.example.com'inherbrowser,shedidn'tcomeacrossa'pagenotfound' page.instead,shewasdirectedtoa"thissitehasrecentlybeenregistredwithgodaddy.com"page.whenyouregisteredthe domainnamewithgodaddy,theydidn'tjustletitsitoffthereintheether.theycreateadummywebpageforyourdomain ononeoftheirservers,andthentheycreateazonefilewithrecordsinitthatpointthedomaintothattemporarypage.this isbothtoinformnewvisitorsthatthesiteis,indeed,ok(elseavisitormightthinktheyjusttypedthedomainnamewrong), and,natch,toadvertisethemselvesatthesametime.inotherwords,theyprovideddefaultvaluesforsteps2,3,and4for you,andthey'llstaythatwayuntilyouchoosetochangethem. www.hentzenwerke.com

DNSExplained Page8 OK,nowlets'dothissamething,butwith'realdata'. 4.3Liveexample Supposeyou'veregistered'example.com'withgodaddy.(GodaddyhasaWebserverandanauthoritativeDNSserverthat theyusefornewlyregistereddomainslikeyours.)azonefilewascreated,andthey'veputthatzonefileinapairoftheir DNSservers.They'vealsocreatedadummyWebpagefor'www.example.com'foryouandputitononeoftheirWeb serversaswell.sothen,whenyou(oryourmom)navigatetowww.example.com,youarriveatthe'temporarilyparked here...'page.youcanlogintoyourgodaddyaccountandnavigatetothe'managedomains'link;doingsowilldisplaya pagethatlistsyournameservers,likeso: NameServers:(Lastupdate1/1/1980) PARK21.SECURESERVER.NET PARK22.SECURESERVER.NET ThesearethenamesforacoupleofDNSserversthatgodaddyruns.TheDNSrecordsinyourzonefileonthempoint togodaddy'swebserver.theactualwebpageforadministeringthemlookslikefigure3.youcanseethenameservers displayedintheverymiddleofthepage,slightlyunderandtheleftofthered"cancel"button. Figure3.TheGoDaddyWebpageformanagingdomainDNSinformation. www.hentzenwerke.com

DNSExplained Page9 4.4Hostingyoursiteatathirdpartysite Nowwhat?First,youCANcontinuetohostyourDNSzonefileandyourWebsiteatgodaddy.UseofthegodaddyDNS servertostoreyourdnsrecordscomeswithyourregistrationfee(otherregistrarsmayormaynotincludednswiththe registration).notethattypicallyhostingyourwebsitewillcostyouacoupleofbucksextra. Ifthat'sthecase,yourjobisnearlydone.AfterpurchasingtheWebsiteoption,they'llgiveyousomespaceonaserver oftheirs.(theyhaveacresandacresofservers.)they'llalsogiveyoutheipaddressforyourspaceonthatserver.you'll createyourwebpagesandthenftpthosepagesuptotheirserver.they'llalsochangeyourzonefilesothatitpointstothe rootdirectoryofyourspaceontheserver,andyou'redone. 4.5Hostingyoursiteyourself SupposeyouwanttohostyourownWebserver.Therecanbeseveralreasonsforthis,suchastheneedtorunsoftwarethat isn'tsupportedongodaddy'sservers.inthiscase,you'dcreateyourownwebserver,installinglinuxandapache,say,onit, andthenmoveyourwebpagestothatmachine.butatthispoint,thiswebservermachineisanislandwithoutabridge connectingittotherestoftheinternet.timetogetconnected. You'llneedaconnectiontotheInternet,similartotheoneyoualreadyuse maybeeventhesameone.yourispwill giveyouapublicipaddressthatbecomesthegatewayforyourserver.(i'mtakingcomplicationslikeroutersandfirewalls outoftheequationrightforthetimebeing.)whenyourispbecameanisp(fromitshumblebeginningsasabaitandtackle shoporatelephonecompany),theyreceivedablockofipaddresses(their'netblock')thattheyinturndishouttotheir customers.theipaddressthattheygiveyouisoneoftheaddressesintheirnetblock.whileit's'your'ipaddress,they're actuallyjustlendingittoyouforaslongasyou'retheircustomer;ifyouchangeisps,you'lllosethatipaddressandneedto getonefromyournewisp.imentionthisbecausetheconceptthattheipaddressisundertheisp'scontrolwillbe importantlateron. BacktoyournewpublicIPaddressandyourWebserver.YouwouldneedtochangeyourDNSrecordsongodaddy's DNSserverstopoint'www.example.com'tothatnewpublicIPaddressfromyourISP.It'lltakeanywherefromafew minutestothebetterpartofadayforthechangestoyourzonefiletofilterthroughoutallofthednsserversontheweb (thisiscalled'propagation'),butsoonenough,peoplesurfingto'www.exmaple.com'willendupatyourwebsite! Atthispoint,yourjobisdone.Well,exceptforthetrivialmatterofbuildingyourWebsite,garneringtraffic,thatsort ofthing.yourzonefilestillresidesongodaddy'sdnsservers,butthewebserverrecordinitpointstotheipaddressofthe Webserversittinginyourbasementorintheserverroomofyourcompany. Supposeyouhadaseparateemailserver,runningonaboxsittingrightnexttotheWebserver?Youwouldchangeyour zonefiletopointyourmxrecordstotheipaddressforthatmachine.whatifyoudidn'thostyourownemailserver, though?instead,youusedtheserverofanemailserviceprovider,suchasgodaddyoryourisp.inthosecases,themx recordinyourzonefilewouldpointtothatemailserver'sipaddressinstead. 4.6TurningoveryourDNStoathirdparty Let'stakethingsastepfurther.Supposeyoudon'twanttokeepyourDNSzonefileongodaddy'sDNSservers?Justlikeyou aren'trequiredtohostyourwebsiteoremailongodaddy'sservers,you'renotrequiredtohostyourdnsontheirservers. First,you'llneedanewDNSserver.ThiscanbeaboxofyoursrunningtheDNSserversoftware,justlikeyou'vegotabox runningwebserversoftware.oryoucouldoutsourceittoanyoneofanumberofcompaniesthatprovidednsservices, justliketherearecompaniesthatprovidewebsitehostingandemailservices.youcanmoveyourzonefiletooneofthose companies.supposeyoudecidedtousezoneedit.comtohostyourzonefile.whenyousetupanaccountwiththem,they'll giveyouthenamesofthednsservers(muchlikegodaddy'swere"park21.secureserver.net"and "PARK22.SECURESERVER.NET"). Youjustneedtotellyourregistrar,godaddyinthiscase,thatyourdomain'snameserverisnowzoneedit.com,and changeyournameserversfrom"park21.secureserver.net"and"park22.secureserver.net"tothedns serversthatzoneedit'sgaveyou. www.hentzenwerke.com

DNSExplained Page10 4.7"It'salotworsethanthat" There'smoretoDNSthanthis.TheDNSdatabaseisdistributedacrossmanyserversthroughouttheworld,andthere'sa complexandsophisticatedmechanismtokeepthemallinsync.forallpracticalpurposes,youdon'tneedtoknowanyof this.youjustneedtokeepthezonefileonyourowndnsserversetup,andyourmachinesconfiguredtouseyourdns servers,andyou'llbeok. 4.8Summaryofauthoritativeandcachingserverroles Insummary,whenyoucreateadomainname,youtellyourregistrarwheretheauthoritativeDNSserversforyourdomain are.yourzonefilesitsontheseauthoritativeservers.thiszonefileiscopied(or'propagated')tocachingserversalloverthe Internet.Thetimingvaluesinthezonefiletellsthecachingservershowoftentheyneedtorefreshtheirdata.Usermachines allovertheinternetpointtocachingservers.whenausermachinerequestsarecord,it'lllookatitscachingservers.ifthe dataisnotfound,there'saclearlydefinedpathforittolookat;thedetailsofwhicharen'timportanttous. Supposeoneofyourusermachine'scachingservershadjuststartedup,andhadn'tgoneouttopopulateitsdatabaseyet. It'llonlyknowabouttherootservers.Sointhiscase,thecachingserverwouldaskarootserverfortheinformationabout www.example.com.therootserverwouldrespond,sayingthattherootserverdoesn'tknow,butinformationon.comcan befoundattheserversforthatdomain.thecachingserverasksoneofthe.comserversfortheinformation.the.com serverrespondssayingthatitonlyknowswheretofindinformationforexample.com.iftheurlwaslongerandhadmore levels,thecachingservercontinuesonlikethatuntilitfinallygetsthealloftheinfoorendsupwithapermanenterror. Finally,thecachingserverreturnstheinfototheclientthatrequestedit. Thatsaid,it'snowtimetolookatthosezonefilesinmoredetail. 5.Zonefiles Zonefilescontroltwobasicthings themappingsofvarioustypesofservers,suchaswebservers,mailservers,ftpservers, andsoon.thisway,mailtobob@example.comknowswheretheexample.commailserverislocated sinceitmightnotbe onthesamemachine orinthesamecountry! thatservesupwebpagesforwww.example.com. ThesecondthingthatazonefilecontrolsishowoftenchangestothezonefilearepropagatedthroughouttheInternet. Unlessyouhavespecialneeds,thedefaultsettingsthatcamewithyourzonefilewhenitwassetupareprobablygood enough.mostpeople(particularlythefolksreadingthis)aretypicallygoingtosetuptheirzonefile,pointingtotheirweb site,mailserver,andsoon,andthenleaveitalone.ifyouwereinthebusinessofrunningmultiplewebsitesformany peopleororganizations,you'dprobablybedoingmoretweaking. Fortunately,thearcanesyntaxusedinazonefileisusuallyhiddenawayfromyou.MostDNSserverprovidersprovide aneditingfacilitythatallowsyoutomakechangesusingasimpleinterfaceasshowninfigure4. www.hentzenwerke.com

Page11 DNSExplained Figure4.GoDaddy'sWebinterfaceforchangingDNSrecords. Whatyoudoneedtoknowistheconceptsbehindthechangesyou'remaking.Let'slookatourdummyzonefileagain. $TTL 86400 $ORIGINexample.com. @1DIN SOAns1.example.com. 2005010101;serial 3H;refresh 15;retry 1w;expire 3h;minimum ) NSns1.example.com. NSns2.example.com. MX10mail.example.com. MX20mail.another.com. A192.0.34.166 wwwina192.0.34.167 bobina192.0.34.168 INCNAMEwww.example.com. hostmaster.example.com.( www.hentzenwerke.com

DNSExplained Page12 SOAisanacronymfor"StartofAuthority".TheDNSdatabaseconsistsofzillionsofzonefiles,eachofwhichisthe responsibilityofsomeone.everythinginthatzonefileisthatperson'sresponsibility.whenyouthinkofthednsdatabase asapyramid,yourzonefilemakesuponeverysmallbrickinthatconstruction.thesoaindicateswhereinthatstackof bricksyourresponsibilitystarts.therestofthednsdatabase therootservers,tldservers,andworkerbeeserverscan onlypointtoyourzonefile.withinyourzonefile,youarethemaster.thesoarecordpointstothe'start'ofyourzonefile. Youdon'thavetoworryaboutmostofthepiecesoftheSOArecord.Thefirstpiece,the'@'sign,issimplyapointerto thecurrentzone sortoflikeyou'repointingtoyourself.thenextimportantpieceis'ns1.example.com' it'stheprimary nameserverforyourdomain.thisentrymustbefollowedbyaperiod.andthelastpartofthelineistheemailaddressof thepersonresponsibleforthedomain,exceptthatthe'@'signisreplacedbyaperiod,andtheaddressisfollowedbya period. Thesecondlineistheserialnumberofthezonefile thedatethatthezonefilewaslastupdated,followedbya sequencenumbersothatifthezonefileisupdatedmorethanonceaday,it'scleartootherserversthatgetupdatedwiththis zonefile'sinformationwhetherornottheyhavethemostrecentupdate.inotherwords,supposeyouupdateyourzonefile inthemorning.theserialnumberbecomes'2006103101'.laterthatday,thechangesyou'vemadearepropagated throughouttheinternet andnowotherdnsservershavethemostrecentdate,includingthe'2006103101'serialnumber.if youthenupdateyourzonefileagainthatday(somepeoplecannevermakeuptheirminds...),theserialnumberbecomes '2006103102'.Whenanotherserverchecksinonyourzonefile,itwillseethatitsserialnumberendsin'01'whileyours endsin'02'andthusknowstograbafreshcopyofyourzonefile. Thenextfourlinesinvolvetimespans.Thevaluescanbedescribedinseconds,inwhichcasenounitisneededtobe displayed,orinothertimeunits,inwhichcasetimeunits 'H'=hours,'w'=weeks,'m'=minutes arerequired.86,400= secondsinoneday,28800=8hours,604,800=1week,7200=twohours. Thethirdline,refresh,tellsanotherDNSserverhowoftenitshouldcheckyourzonefileforupdates.Thefourthline, retry,tellstheotherserverhowoftenitshouldtrytoconnecttoyourserverintheeventofaconnectionfailure.thefifth line,expiry,isthetotalamountoftimethattheotherservershouldtrycheckingbeforeitgivesup.ifitgivesup,itwillflag yourzonefileonitsdatabaseasexpiredandthenbegintoredirectrequestsforyourdnsinformationtotherootservers. Finally,thesixthline,TTL(timetolive)representstheamountoftimethatanotherserverwillcacheanswersfromyour server.asisaid,forthemostpart,you'llnotwanttomesswiththesevalues. Afterthetimespanvalues,thenextrecordsspecifythenameserversforthedomain therecordstotherightofthe'ns' recordtype.afterthatcomesan'mx'record whichstandsfor'mailexchanger'.youcanhavemorethanonemxrecord, eachofwhichpointstoadifferentmailserver.theorderinwhichmailisdirectedtoaserveriscontrolledbythetwodigit numberbetweenthe'mx'recordtypeandtheurlofthemailserveritself,whichthelowernumberbeingahigherpriority. TheArecordsmaphostnamestoIPaddresses.You'llusuallyhaveone'A'recordthatismappedtoa'catch all'ip address,andthen,possibly,subdomainsmappedtootheripaddresses.forexample,'www.example.com'ismappedto '192.0.34.167'while'bob.example.com'ismappedto'192.0.34.168'.Ifyourmomtyped'http://example.com'intoher browser,however,shewouldbedirectedtothe'catch all''192.0.34.166'address. TheCNAMErecord(CNAMEisshortfor"canonicalname")isanaliasforanArecord. Finally,TXTrecords(notshownhere)areusedforSPF(SenderPolicyFramework)records.Thesearerecordsthat specifywhichmachinesareallowedtosendmailwiththesendersettoyourdomain.ifthesenderdomaindoesnothavean SPFrecord,orifthesenderdomainissendingfromamachinethatisnotlistedintheSPFrecord,thenthemailisclassified asspam.(moreinfoonspfcanbefoundatopenspf.org.) 6.ReverseDNS TheDNSrecordsallowprogramstolookuptheIPaddressfor'example.com'inallitsglory(aswellasanythingelse related,suchasftpormailservers).youmaybewonderingaboutthereverse ifyouhadanipaddress,couldyoulookup thedomainname?yes,youcould,andthisiscalled'reversedns'.thisisactuallyimportantbecausesomeprograms www.hentzenwerke.com

DNSExplained Page13 (particularlymailservers)willrefuseemailfromdomainsifthereversednsresultsdonotmatchtheregular(alsocalled 'forward')dns. AreverseDNSrecordlookslikethis: zone"34.0.192.in addr.arpa"{ typemaster; file"pri.34.0.192.in addr.arpa"; }; You'llseethatthefirstpartoftheaddress,'34.0.192.in addr.arpa'beginswiththereverseofthefirstthreepartsofthe example.comipaddress.thethirdlinecontainsthenameofthereversezonefile,34.0.192.in addr.arpa.thereversezone fileitselfcontains,insteadofaormxrecords,ptrrecords(ptrstandsfor'pointer'.) AreversezonefilewouldconsistofindividualrecordsforeachIPaddressassociatedwiththedomain.Followingour example,ourreversezonefilemightincludeptrrecordslikethis: 166PTRexample.com 167PTRns1.example.com 168PTRmail.example.com ReverseDNSissomethingthatmanyISPsdon'thaveaclearhandleon,orthattheydon'tbothertodountilyounag themto.youcantellifyourreversednsissetupthroughthelinuxcommandlinetool,'dig'.first,let'slookatadomain wherethereversednsisnotsetupproperly.findtheipaddressforanexampledomain: >digbozo_dns.com <somestuff> QUESTIONSECTION: bozo_dns.comina ANSWERSECTION: bozo_dns.com12837ina1.2.3.4 Andthen,withthe" x"switchontheipaddress,youcanseethatthereversednsisnotsetupproperly. >dig x1.2.3.4 <somestuff> QUESTIONSECTION: 4.3.2.1.in addr.arpa.inptr ANSWERSECTION: 4.3.2.1.in addr.arpa.inptr1.2.3.4.ded.pacbell.net. Asyoucanseefromthelastline,theIPaddressdoesnotresolvebacktothedomainname;instead,itresolvestothe ISPwhoownsthenetblock. ThisexampleshowsDNSsetupproperly: >digexample.com <somestuff> QUESTIONSECTION: example.comina ANSWERSECTION: example.com8702ina192.0.34.166 Andthen,withthe" x"switchontheipaddress,youcanseethatthereversednsissetupproperlyaswell. >dig x192.0.34.166 <somestuff> www.hentzenwerke.com

Page14 DNSExplained QUESTIONSECTION: 166.34.0.192.in addr.arpa.inptr ANSWERSECTION: 166.34.0.192.in addr.arpa.inptrwww.example.com. ReverseDNSrecordsarestoredbyyourISPonserverssimilartotheauthoritativeDNSserverswe'vealreadylooked at,becausetheispcontrolsthenetblockofipaddresses.inordertogetreversednssetup,youhavetorequestyourispto doit,sincetheycontroltherecords.whileintheoryyoucouldhaveyourispdelegateauthorityforyourreversednsto anotherservice,mostispswon'tasamatterofconvenienceandconsistency. 7.Wheretogoformoreinformation ThisfreewhitepaperispublishedanddistributedbyHentzenwerkePublishing,Inc.Wehavethelargestlistsof Movingto Linux,OpenOffice.org,andVisualFoxProbooksontheplanet. Wealsohaveoodlesoffreewhitepapersonourwebsiteandmorearebeingaddedregularly.OurPreferredCustomer mailinglistgetsbi monthlyannouncementsofnewwhitepapers(andgetsdiscountsonourbooks,firstcrackatspecial deals,andotherstuffaswethinkofit.) Clickon YourAccount atwww.hentzenwerke.comtogetonourpreferredcustomerlist. Ifyoufoundthiswhitepaperhelpful,checkouttheseHentzenwerkePublishingbooksaswell: LinuxTransferforWindows NetworkAdmins: AroadmapforbuildingaLinuxfileandprintserver MichaelJang LinuxTransferforWindows PowerUsers: GettingstartedwithLinuxforthedesktop WhilHentzen www.hentzenwerke.com