Name resolution is the process of relating difficult-to-remember IP addresses with easy-to-remember names. Imagine if you had to remember your favorite websites by a long string of numbers instead of a familiar name. That would be nearly impossible! However, computers need numeric addresses to find each other. Name resolution translates between the computer's need for numbers and people's need for names. The primary name resolution service is the Domain Name System (DNS).
Figure 1: Example of using an easy-to-remember name, such as fileserver01
Figure 2: DNS is a record that relates an easy-to-remember name with a difficult-to-remember IP address
One or more servers provide DNS services on internal business networks and the public internet. Client systems, such as a user's computer, tablet or smartphone, contact the DNS server when a user enters a name, and the server responds with the related IP address. The client computer uses that IP address to connect to the destination webserver.
How Does DNS Work?
Most client computers receive their IP address settings from a Dynamic Host Configuration Protocol (DHCP) server on the network. This configuration includes the IP address of the local DNS server. That's how the client computer knows which server provides name resolution
Notice the DNS Servers line near the bottom of the following output:
Figure 3: The ipconfig /all command displays network settings, including configured DNS servers
Name resolution is important enough that most sysadmins will configure both a primary and secondary DNS server to ensure the computer can resolve names and IP addresses.
System administrators configure one or more DNS servers on business networks. These servers provide name resolution for internal resources to internal clients. For internet (external) resources, a series of distributed servers worldwide provides name resolution. Most clients that access the internet from home use these DNS servers. Business DNS servers forward name resolution requests to the internet DNS servers for resources outside the company network. Note that DNS uses both port 53/tcp and 53/udp for network communications.
DNS servers store name resolution information in a database. Each entry in the database is a resource record. There are many kinds of resource records, but the most fundamental are A records, which relate a name to an IP address.
A client may contact the DNS server and ask for the IP address of the specified name. The DNS server looks up the A record for that name and reports the listed IP address back to the client. The client then has enough information to contact the destination device. This DNS lookup process is known as a query.
DNS stores resource records in zones. Zones are a portion of a namespace managed by a specific organizational group. These zones are typically part of a larger hierarchical naming structure.
There are many types of resource records, including:
- Start of Authority (SOA): Stores administrative information about the DNS domain
- Name Server (NS): Name server for a DNS domain
- Mail Exchange (MX): Forwards requests to a mail server (for email services)
- A (A): Stores name to IPv4 address information
- Quad-A (AAAA): Stores name to IPv6 address information
- Pointer (PTR): Stores IPv4 address information (reverse of A records)
- Service (SRV): Stores server to name information
Client computers on an internal business network automatically register their names and IP addresses with the DNS server. This dynamic DNS registration process keeps the database current as network devices change over time. Desktop support troubleshooters can use the ipconfig /registerdns command to manually register the system's name and IP address, though this is rarely necessary.
While A records are the most common, PTR records also usually exist. A records map a name to an IP address, but PTR records map an IP address to a name. You may think these are essentially the same things, but to the computer, they are two distinct pieces of information. Forward lookups use A records for name to IP address resolution. PTR records are used in reverse lookups by many services for IP address to name queries.
The Importance and Role of DNS
DNS is one of the most essential network services. It makes it much easier for humans to work with network components and find the resources they need, as it:
- Relates names and IPs, making it easier to find resources
- Makes URLs work for websites
- Makes email addresses work
- Makes mapping network drives easier
- Continues to support the growing internet
- Contains modern security support
- Remains flexible and simple
- Is well-tested and well-supported
- Works with IPv6
- Supports performance features, such as caching and load balancing
Compare the Hosts File With DNS
In the early days of networking, workstations stored static text files called hosts files that listed names and their related IP addresses. These files were difficult to keep current as networks grew and devices became more portable. Today, hosts files are rarely used. DNS is the preferred name resolution method.
You can view these hosts files on Windows by going to C:\Windows\system32\drivers
etc\hosts, or see them on Linux and macOS by going to /etc/hosts.
Figure 4: Sample hosts file showing example mappings
Query Process With Examples
How does name resolution work when you're surfing the web? Suppose you open a web browser and enter a URL, such as www.example.com. Your computer first checks its own name—after all, maybe it is www.example.com, which would be remarkably convenient.
Obviously, this is not the case, so it checks the hosts file next. That file will probably not have the IP address for the webserver hosting the www.example.com site. The computer then checks its network configuration for the IP address of a DNS server. It sends a DNS lookup to that server, asking for the IP address related to www.example.com. The DNS server either stores or discovers the answer and returns it to the client, which then uses the IP address to address the data packets making up the website request.
The following examples summarize the query process.
Example 1: Name Resolution From Home
If you're at home on your laptop browsing websites, your computer must address data packets to the specified webserver. However, you probably don't maintain your own DNS server (though some of us do!). So how does your computer resolve names? Your system is configured to use the internet service provider's (ISP) DNS system. The query goes to that server, which resolves the name using the internet's DNS infrastructure and returns the IP address to your computer.
The name resolution path is:
Some home computers might be configured to use other DNS services, such as Google's name resolution servers at 126.96.36.199 or 188.8.131.52. Client systems cache recent DNS queries for better performance. Use the ipconfig /displaydns command on a Windows computer to view this cache, and ipconfig /flushdns to clear it.
Example 2: Name Resolution From a Business Network
Business networks usually maintain their own DNS servers. The company's computers use these name resolution services in two ways: To resolve internal resource names to IP addresses, and to resolve external resource names (public websites) to IP addresses.
Suppose a user needs a network drive mapped to a projects folder stored on a file server named fileserver01. A desktop support technician might use a Universal Naming Convention (UNC) path, such as \\fileserver01\projects. The user's workstation must resolve fileserver01 to the file server's IP address. All components involved—workstation, file server, and DNS server—are internal. The workstation queries the internal DNS server, asking for the IP address for fileserver01. The DNS server checks its resource records and returns the requested IP address. The client uses that IP address to connect to the fileserver.
What if the workstation needs to connect to an outside public website? The site's IP address will not be stored on the business's DNS servers. When the client queries the internal DNS server, the server will forward the query to the internet name resolution servers. Those servers pass the requested IP address to the business DNS server, which passes the address to the workstation. The workstation now knows the IP address of the external destination webserver and can connect to it.
Advantages and Disadvantages of DNS
DNS has lots of positive aspects and relatively few disadvantages. Most of the kinks have been worked out over the decades. Here are a few considerations:
- Well-tested and well-understood by network professionals
- Works with services such as email and Active Directory
- Works on all common computer operating systems
- Work with IPv6 using AAAA records
- Many security options are available to protect the service and its resources
- Quickly becomes complex in large, distributed networks
- Administrators must deliberately take steps to secure it
Learning how to troubleshoot DNS is essential. If you can identify and diagnose name resolution issues and then take appropriate steps to correct them, you can address common network problems quickly. Tools such as nslookup, dig, and host allow you to generate name resolution queries to test DNS.
DNS operates in nearly every network, making your skill and experience with it a benefit at any organization.
DNS Best Practices
Computers use IP addresses to exchange data on the network, but these addresses are very difficult for humans to work with. People rely on logical, easy-to-remember names. DNS is a database service that maintains a list of names and their associated IP addresses.
DNS is a critical service. Here are a few best practices to keep in mind:
- If possible, configure two DNS servers in case one is unavailable.
- Use public DNS services, such as Google (found at 184.108.40.206 and 220.127.116.11), on home computers.
- Test for name resolution problems by pinging by IP address and then pinging by name. If the ping by name fails, but the ping by IP address succeeds, you probably have a name resolution issue.
- Learn to use DNS lookup tools, like nslookup, dig, and host for troubleshooting name resolution.
- Check the system's IP address configuration early in the troubleshooting process for network issues to be sure the DNS server entry is correct.
Understanding and working with DNS is essential to a network administrator's role. Being CompTIA Network+ certified shows employers that you have skills to succeed as a network administrator. Check out the CompTIA Career Roadmap to see what other certifications can help you become a network administrator.
CompTIA Linux+ validates the skills of IT pros with hands-on experience configuring, monitoring and supporting servers running on the Linux operating system. This could be a key addition towards becoming a network administrator.
Learn the skills you need with CompTIA CertMaster Learn. Sign up today for a free trial today!