Explain how domain name system works

how domain name system works and domain name system tutorial
HartJohnson Profile Pic
HartJohnson,United States,Professional
Published Date:02-08-2017
Your Website URL(Optional)
Comment
8 the domain name system Names to Numbers You say your name is Patrick? That must mean you’re Number 6. You probably don’t even think about it, but when you type a URL into a browser, how does your computer find an IP address for that server? In this chapter you will discover the world of Internet domains. You will find out how there are 13 root servers that deal out domain name information for the entire Internet. You will also install and configure your own DNS server. this is a new chapter 291 Download at aa website? isn’t this networking? The Head First Health Club needs a website The Head First Health Club prides itself on its ability to find the perfect class for everyone. Whether you want to learn how to swim, practice martial arts, or get your body into shape, it has just the right class. Unfortunately, competition between the different health clubs is fierce. In a bid to attract more customers, the CEO has decided that the Head First Health Club needs to have a website. A strong web presence will be great for business. We’ll be able to advertize all our classes and services. Can you set us up on the Internet? The CEO already has web page developers handling the actual web pages that need to go on the site, and web servers for the site itself. What you need to do is get a domain for the website. So what’s a domain? 292 Chapter 8 Download at a Health Club CEOThese are taken from a list of the top domain registrars in 2008, but there are plenty of others to choose from. domain name system Hello, my name is... Even if you’ve never heard of a domain name, you’ve seen and used a zillion of them; you know... google.com, yahoo.com, amazon.com, headfirstlabs.com, and maybe a few you wouldn’t want us to mention. So what’s a domain name? Well, it’s really just a unique name that’s used to locate your site. Here’s an example: www.hfhealthclub.com The main reason why you should care about domain names is that it gives you a unique, specific, and memorable name for your site. There’s one other thing you should know. Domain names are controlled be a centralized authority (called ICANN) to make sure that only one person at a time uses a domain name. Also, you pay a small annual registration fee to keep your domain name (you knew it was coming). So how do we get a domain name? The easy answer is to go to a domain registrar and step through the process of searching for an unused domain name that you would like to register. Some offer great tools to manage your domain names and extra tools for web pages, email, and other servers. But like most things, that comes at a price. You really need to shop around and find the best deal and service for what you need. Here’s a list of some of the top domain registrars you might want to try out. Note from Marketing: are they paying us for this? EuroDNS.com godaddy.com tucows.com Sibername.com Dotster.com you are here 4 293 Download at a This part is the domain name. The domain ending is the top level domain name. There are different ones for different purposes: .com, .org, .gov; and also for different countries: .co.uk, .co.jp, and so on. You need to pick the one that best fits you. This is called a fully qualified domain name (FQDN) because all the parts are present. It’s basically the name of the website. domain This is the host name. It’s the name of a specific server IN the domain. FQDN Stands for Fully Qualified Domain Name. An example is: www.hfhealthclub.com It’s basically the name of the website you’d type into your browser.it starts with a domain Let’s go buy a domain name The Health Club CEO likes the domain hfhealthclub.com, and a quick search reveals that it’s available to buy. Before too long, you’ve bought up the domain and linked it to the Health Club web server. When the web page developers have deployed the web pages onto it, you’re good to go. Q: Q: Why is it called a “domain name” rather than a “website What if I don’t have my own web servers? name”? A: In that case, you can use those of a hosting company. They A: Because they are different things. If you look at often have package deals for hosting web pages, registering www.hfhealthclub.com, that’s the web server’s name that is domain names, and so on. Your best bet is to figure out what you hosting that website, but only the “hfhealthclub.com” part is need, and then shop around for the best deal. the domain name. You could also create other websites that use the same domain name, like corporate hfhealthclub.com or employees.hfhealthclub.com. So the domain name is something Q: What’s so great about a domain name anyway? Do I you can use for a lot of websites. really need one? My hosting company says I can just use their name, www.dirtcheaphosting.com. Q: But I thought www.hfhealthclub.com was the name of a website? A: If that meets your needs, there’s nothing wrong with using A: Yes and no. With regards to DNS, it is the name of a specific their name, But (and it’s a big but) here’s the disadvantage: should web server. A given web server can host lots of different websites, you ever want to choose another hosting company, or should that and it uses the domain name to decide which website to serve out. hosting company go out of business, then everyone who knows your site will no longer be able to easily find it. If, on the other hand, you have a domain name, you can just take that with you to your new hosting company. Your users will never even know you’ve Q: If I was going to get the domain name for the Health switched. Club, wouldn’t I want to get the name www.hfhealthclub.com? Everyone seems to use websites with the “www” at the front. Q: I don’t know how to develop web pages. Is that a problem? A: Again, don’t confuse a domain name with a web server’s name: hfhealthclub.com is a domain name, while A: Not at all. We’re assuming that a separate group of web page www.hfhealthclub.com is the name of a web server. Buying a developers are doing the web page development and deploying it to domain is like buying a piece of land—let’s say 100mainstreet.com. the server. If, on the other hand, you’re interested in learning more On that land, you can set up as many web servers as you like, for about how web pages are developed, Head First HTML with CSS & example, home.100mainstreet.com, toolshed.100mainstreet.com XHTML is a great starting point. and outhouse.100mainstreet.com. So www.hfhealthclub.com is just one web server in the hfhealthclub.com domain. 294 Chapter 8 Download at adomain name system Test Drive Let’s try browsing to www.hfhealthclub.com and see what happens. This looks great This is bound to bring in more customers. So everything’s working well... right? you are here 4 295 Download at a The bright and shiny Head First Health Club website with its very own domain name.already there’s a problem Uh-oh We’re in trouble Everything seemed to be going well, but before too long, a customer reported a problem. Hey, what’s going on? I keep trying to enroll in classes, but I keep getting this error message. And she’s not the only one Before too long, the Head First Health Club is getting lots of complaints of intermittant problems and timeout issues. So what could the problem be? And what can we do to fix it? 296 Chapter 8 Download at aFrank domain name system Is there a problem with the website? Frank: No, I saw what the developers have done; it looks great. Jim: Well I can’t seem to get to it, and we have had some customer complaints as well. Joe: I know the web server is running. I was just looking at it this morning. There were no errors or anything on it. Jim: What else could be the problem? Frank: I am trying to pull it up right now on my browser, and I am just getting an error. Jim: That does not sound good. Joe: What error message does the browser give? Jim: It says it can’t find the server www.hfhealthclub.com. Frank: Sounds like our domain is not available, or at least that server’s domain name is not available. Joe: Did our domain registrar update the DNS records for the new web server? you are here4 297 Download at a Joe Jimwhat’s really going on with dns? Introducing the DNS Before we look at how the client can find the web pages on www.hfhealthclub.com, we need to take a look at how DNS works. So what’s that? DNS stands for Domain Name System. It translates fully qualified domain names that are meaningful to humans into IP addresses that computers understand. It’s a bit like an address book for the Internet that tells clients where to access resources. My little black I really need to go to book says you need www.hfhealthclub.com. to go to IP address Where’s that? 204.110.23.186. The DNS relies on name servers The translation between domain name and IP address is made possible because of a hierarchy of name servers. By a name server, we mean a server that can give an answer to a DNS query. So if we want to know which IP address is mapped to domain www.hfhealthclub.com, the name servers can tell us. Let’s take a closer look at this. 298 Chapter 8 Download at adomain name system How the DNS sees your domain You can think of the DNS as being like an upside down tree. The name servers are like the branches, and the leaves are like the domains. To get to a particular domain or leaf, we trace our way through the relevant name servers (branches) to get to where we want to be. Let’s look at www.hfhealthclub.com as an example. 1 We start off with the DNS root servers. The DNS root servers look at what the top level domain (tld) name is to see where the address can be looked up from. In our case it’s .com, so the DNS root servers direct us to the more specialized .com servers. 2 Next there’s the .com tld servers. The .com top level domain (tld) servers know all about the .com domains. They see we need hfhealthclub.com, so they pass us along to the relevant name server. 3 Then there’s the hfhealthclub.com name server. The hfhealthclub.com name server knows about all the hosts and sub-domains of hfhealthclub.com. It sees we want www.hfhealthclub.com, so it passes us along to the web server. 4 And here’s the Health Club web server. This is the web server that’s mapped to the the fully qualified domain name of www.hfhealthclub.com. So how does the client use this to get to the domain? you are here 4 299 Download at a Each tld, like .com or .edu, has its own set of name servers.icann.org www dns magnets DNS Magnets Take a look at the following fully qualified domain names: www.apple.com en.wikipedia.org oreilly.com icann.org Your job is to use the magnets below to say what the top level domain name, domain name, and host name is for each one. Domain name Top level domain name Host name 300 Chapter 8 Download at a apple.com .com en www www .com oreilly.com .org wikipedia.org .orgdomain name system BE the Domain Name System Your job is to play the domain system and fill in what happens in each step of the process of resolving a domain name when a client requests an name to be resolved to an IP address. Root DNS Server client 2 I’m looking for www.hfhealthclub.com. You can find www.hfhealthclub.com. 1 3 at 204.110.23.186 8 client’s DNS Server 4 ns.example.com 5 The name server in charge of hfhealthclub.com at 204.110.23.2 6 7 204.110.23.2 you are here 4 301 Download at aicann.org www connect the parts DNS Magnets Solution Take a look at the following fully qualified domain names: www.apple.com en.wikipedia.org oreilly.com icann.org Your job is to use the magnets below to say what the top level domain name, domain name, and host name is for each one. Domain name Top level domain name Host name 302 Chapter 8 Download at a apple.com .com en oreilly.com .com www www .org wikipedia.org .orgdomain name system BE the Domain Name System Solution Your job is to play the domain system and fill in what happens in each step of the process of resolving a domain name when a client requests an name to be resolved to an IP address. Root DNS Server client What name server is in charge of the .com TLD? I’m looking for 2 www.hfhealthclub.com. You can find www.hfhealthclub.com. 1 The name server in charge of .com 3 at 204.110.23.186 8 is ns.example.com at 192.20.66.42 What name server is in charge client’s DNS Server of the hfhealthclub.com 4 domain? ns.example.com 5 The name server in charge of hfhealthclub.com at 204.110.23.2 I’m looking for www.hfhealthclub.com. 6 7 You can find www.hfhealthclub.com. 204.110.23.2 at 204.110.23.186 you are here 4 303 Download at aname server problems? So how does this affect the Health Club? So far we’ve seen how the DNS relies on name servers, and how the name servers resolve IP addresses. But why might this be causing a problem for the Health Club? Why are the customers getting server timeout errors? I wonder if people get errors because of the name servers? They were getting server timeout errors, and if the hfhealthclub.com name server is down, that might explain it. He may be right. When a client tries to browse to a particular domain, it needs to know which IP address the domain name represents. The client gets this from the name server. If the name server is down, this means that the client has no way of knowing how to get to the website at www.hfhealthclub.com. This means that anyone trying to reach the website will get errors. Zzzzzz..... I really need to go to Zzzzzzz....... www.hfhealthclub.com. Zzzzzzz....... Where’s that? Hello? 304 Chapter 8 Download at adomain name system So we’re doomed, right? We don’t own those name servers, so there’s nothing we can do. We can replace the name server with our own. At the moment the Health Club is using the domain registrar’s name servers, but there’s an alternative. Instead of using the name servers of the domain registrar, we can take control and setup our own instead. There are pros and cons to this approach, but if the current name servers are causing a problem for the Health Club, it might be the way to go. So how do we set up our own name server? Write down some more pros and cons of running your own name servers. Pros Cons you are here 4 305 Download at atake control? Write down some more pros and cons of running your own name servers. Pros When you want to make a change in your DNS, there is no waiting around for it to take effect. You can gain a really thorough understanding of how your DNS service is working. You can immediately correct any problems that come up. Cons You have to perform sys admin duties not only on the DNS service but on the host operating system as well. This means updates, etc. You have to purchase hardware and possibly licensing for the server OS. You have to house the hardware somewhere. First install a DNS name server... A DNS name server is basically just an application that runs on an operating server. That means you have to have a server running Windows Server OS, Mac OS X Server, or a Linux variant. There are hardened servers that just do DNS. For some of these, you purchase subscriptions to keep the server up-to-date. The most commonly used DNS server on the Internet is BIND. Installing BIND is relatively simple, but there’s something else we need to do too. We need to configure the name server so that it can translate fully qualified domain names into IP addresses. 306 Chapter 8 Download at a We’ve put some instructions on how to install the BIND DNS server in Appendix iii.domain name system ...then configure the name server Your name server uses something called a DNS zone file that translates a FQDN to an IP address. Let’s look at an example. Since name servers are public, we can take a look at other name servers to see how they are configured using a command called dig. Go through the following steps to bring up details of the O’Reilly web servers. What do you think the output means? Open a terminal (cmd) window. 1 Type dig ns.oreilly.com www.oreilly.com any 2 This will return the records for the O’Reilly web servers. The A 3 stands for Address. You should see somewhere in the output: 4 ;; ANSWER SECTION: www.oreilly.com. 21600 IN A 208.201.239.36 www.oreilly.com. 21600 IN A 208.201.239.37 ;; AUTHORITY SECTION: oreilly.com. 21600 IN NS ns.oreilly.com. oreilly.com. 21600 IN NS b.auth-ns.sonic.net. oreilly.com. 21600 IN NS a.auth-ns.sonic.net. oreilly.com. 21600 IN NS c.auth-ns.sonic.net. you are here 4 307 Download at a On a Windows system you need to download dig from http://members.shaw.ca/nicholas.fong/dig/what does it mean? Since name servers are public, we can take a look at other name servers to see how they are configured using a command called dig. Go through the following steps to bring up details of the O’Reilly web servers. What do you think the output means? Open a terminal (cmd) window. 1 Type dig ns.oreilly.com www.oreilly.com any 2 This will return the records for the O’Reilly web servers. The A 3 stands for Address. You should see somewhere in the output: 4 ;; ANSWER SECTION: www.oreilly.com. 21600 IN A 208.201.239.36 www.oreilly.com. 21600 IN A 208.201.239.37 ;; AUTHORITY SECTION: oreilly.com. 21600 IN NS ns.oreilly.com. oreilly.com. 21600 IN NS b.auth-ns.sonic.net. oreilly.com. 21600 IN NS a.auth-ns.sonic.net. oreilly.com. 21600 IN NS c.auth-ns.sonic.net. 308 Chapter 8 Download at a Means Internet class record Means host address Their 2 web servers’ IP addresses. Means name server Servers’ FQDNs dig command allows us to lookup domain information. These are BIND configuration file acronyms.Who am I? domain name system A bunch of BIND configuration file acronyms are playing the party game “Who am I?” They give you a clue, and you try to guess who they are, based on what they say. Assume they always tell the truth about themselves. If they happen to say something that could be true for more than one guy, then write down all for whom that sentence applies. Fill in the blanks next to the sentence with the names of one or more attendees. Tonight’s attendees: SOA, CNAME, IN, MX, A, NS, PTR Acronym I specify hosts used for handling email. I designate a host address. I point to a domain name. I designate a name server. I mark off the start of a zone of authority. I define an alias. I designate an Internet class record. you are here4 309 Download at aWho am I? know your bind acronyms A bunch of BIND configuration file acronyms are playing the party game “Who am I?” They give you a clue, and you try to guess who they are, based on what they say. Assume they always tell the truth about themselves. If they happen to say something that could be true for more than one guy, then write down all for whom that sentence applies. Fill in the blanks next to the sentence with the names of one or more attendees. Tonight’s attendees: SOA, CNAME, IN, MX, A, NS, PTR Acronym MX I specify hosts used for handling email. I designate a host address. A PTR I point to a domain name. NS I designate a name server. SOA I mark off the start of a zone of authority. CNAME I define an alias. IN I designate an Internet class record. 310 Chapter 8 Download at a