DNS (Domain Name System) is a foundational internet protocol that translates human-readable domain names into IP addresses, making it possible to reach networked resources without memorizing numerical addresses. This content covers how DNS name resolution works, domain name structure, common record types, and how to query DNS using the nslookup command.
Domain Name System (DNS)
The domain name system is a system. It's also a protocol. So we can talk about it from a protocol perspective, but the system and how the whole system works is pretty fascinating and interesting, and critical to how the internet works and how we get to different resources.
Really, DNS's main function is name resolution: translating names to IP addresses, so that way we don't have to use IP addresses to reference certain resources or look up certain resources.
Name resolution matters because we are used to typing in certain URLs and certain information into the browser by name, such as www.techknowsurge.com, and then getting to the resource. We don't use IP addresses to access a lot of the resources. Maybe as an admin you will access a lot of resources via IP addresses, but the general users do not do that. They generally use names to access certain resources.
So for this computer to access, let's say, a web page over here and be able to view this web page, what it needs to do is resolve that name to get the IP address, so that way it can send packets to that server and ask for resources. What it may do is go to a local DNS server or an off-site DNS server, and that DNS server will reply with the IP address of the name that was resolved, so that way you can get packets to that server.
No doubt we're all at least a little familiar with domains. We've all opened up a browser, we've all typed in domains into there and got resources from those domains. But what are the separate components that make up these domains? Let's go a little more in depth on these different components.
For instance, the last little section of this, the .com, is the top level domain. So the top level domain of this is .com. We probably have seen .com, .org, .net, .gov. There are different ones out there that we've seen before, and more and more are getting opened up. We used to be somewhat limited with how many options we had out there, but it continues to grow with time.
Then after that, we could consider each one of the other sections as being subdomains of the ones prior. What I mean by that is example is a subdomain of .com, and sub is a subdomain of example, and www is a subdomain of this sub. So each one of these sections is a subdomain of the prior one, except for the top level, which is just the top level domain. That's important when we come to actually resolving the names, because it will look to the server until it finds what we call the authoritative server, which we'll talk about more here in a bit. So each one of these components right here is a subdomain from the one above it.
Now, you can have up to 1277 different subdomains of it, although you're limited on how many characters you can have in total. But we can go quite deep with these different subdomains within here.
The other thing I want to point out here is that right here at the end, not only is this a subdomain of sub, but it's also what we consider the host. The host is going to be the actual machine. So when we get down to the host level of this, then we're usually translating that host to a specific IP address. So that is the host; this last little part is the host. We'll see how that plays out when we start looking at domain zones and records and all of that.
The whole thing, to include the host, domain and any other domain components of this, we call the fully qualified domain name. The fully qualified domain name is the whole package.
Now there are some limitations with this. Really, we've tried to keep what the characters are that we're using for these domains and for these hosts to be letters, digits and hyphens. There is some capability of going outside of that realm when you're talking about these different subdomains and these different host names and stuff, but for the most part what you probably should be only using is letters, digits, like 1, 2, 3s, and hyphens. And so we call that LDH: letters, digits, and hyphens. So that's what we should be using as components within our domain names.
There's a lot of different top level domains, and they're coming out with more and more pretty consistently now. It used to be that there were just the standard ones, but now they're opening up more and more, and we've got a lot of options. This is just a very small, minute list. Some of these are smaller, just three-letter, or there's two-letter ones. Some of them are a little bit bigger; there's like family that's out there.
So what I would want to do, if I wanted to take out a new domain and purchase a new domain that I wanted to use for a business that I have, or some sort of family domain, or just something I want to do for fun or experimenting, is I would go out there and I would find whatever subdomain that I wanted, one of these and one that would match up. So if I'm doing films, maybe I choose my company name.film, and then that would be my domain that I can access. But these are the top level domains, and once again they're growing. All you need to do is on the web look up top level domains, and there'll be a whole list of these different domains that you can have.
Now, when it comes to a domain, I already mentioned that we can look up and translate from a resource that has a name to an IP address, but there are actually quite a few other records as well, and each one has a certain purpose for it.
As an example, what we've mainly been talking about is doing a host name to an IP address. We call that an A record, or a quad A record. This quad A is more for IP version sixes, versus the A record is for IP version 4. So what it will do is, when you look up www.example.com, it's going to go to the example.com domain and look up the host name. What is www? And then what it will do is reply back with an IP address. So that is an A record. If it replies back with an IP address for www.example.com, then what you're getting is an A record.
There are times, though, when we have somebody's name like Andrew at example.com, and that's an email address. What it will do is go to the example.com domain and say, what is your MX record, what is your mail exchange server? And so what that will translate to is probably another name of another server or an IP address. Either case, though, that is what's called an MX record. So we'll have MX records that are going to point to a resource that will be for the mail exchange, and that's what I'm going to send mail to.
There are times when we don't want to just point to an IP address. Maybe it's a resource that's in the cloud and the IP address changes all the time, so I need to point to this resource but I need to point to a host name. So there is a host name to host name. We also call this an alias record or a CNAME record. So a CNAME record points to another host name. So for instance, if I have www.example.com but I want to point it to www.techknowsurge.com, then I can use a CNAME record to point.
Then we also have reverse DNS. Reverse DNS is when you translate an IP address to a host name. We call that a pointer record, or a PTR record, pointer. And so that is when we take an IP address and we translate it to a host name. And we can do that for things like verification. So we'll use it for verification, to double check to make sure that this is where we should be sending something to.
And then finally, one of the other records is a name server record. The name servers are the servers that are actually going to be hosting out certain domains. So that just specifies what the name server, what the IP address is for the name servers for a certain domain, is.
This is certainly not an exhaustive list of different resources, but this is some examples of the different records that you would see.
A quick way that you can actually see this name resolution process is just open up a command prompt. You type in nslookup and the domain you want to look up. So in this case right here, I use www.example.com. And what we see is that we get a reply back from this server with this IP address, and it is giving us the answer that www.example.com. So we've come up with an answer of an IP address to this domain, this name that we looked up. It also has given us, if you notice, an IP version 6 address as well.
TechKnowSurge builds IT and cybersecurity professionals through hands-on, concept-first training built around real understanding — not memorization. Free interactive tools, structured programs, and 25+ years of real-world experience, all in one place.
Explore free tools and programs →