Skip to main content

DNS & URLs

A. DNS — Domain Name System

Computers communicate using IP addresses, but people usually access websites using domain names.

DNS (Domain Name System) connects these two concepts by allowing a domain name to be mapped to an IP address.

This entire process is mostly hidden from users.

We simply type a domain name into the browser, while underneath, multiple systems work together to determine where the request should go.

DNS allows human-readable domain names to be connected to network addresses.


B. DNS Servers: Authoritative Name Servers and Recursive Resolvers

A DNS lookup can involve different kinds of servers:

  • An authoritative name server publishes the official DNS records for a domain's zone.
  • A recursive resolver looks up answers on behalf of clients and caches those answers for a limited time.

The Namecheap and DigitalOcean example below concerns authoritative name servers. The instructor describes them as a kind of phone book that provides the official records for a domain.

When you register a domain, you specify which authoritative name servers are responsible for its DNS zone.

The company where you register the domain is called a Registrar.

For example, in the course:

The domain could continue using Namecheap's Name Servers, but the instructor instead changes them to DigitalOcean's Name Servers.

DNS Setup example:

  1. DigitalOcean — Create a Droplet → get a Public IP.
  2. Namecheap — Register gemstack.lol.
  3. DigitalOcean — Add gemstack.lol.
  4. Namecheap — Set DigitalOcean's Authoritative Name Servers:
    • ns1.digitalocean.com
    • ns2.digitalocean.com
    • ns3.digitalocean.com
  5. DigitalOcean DNS — Create A Records:
    • @ → Droplet IP
    • www → Droplet IP

This means:

  • Namecheap remains the Registrar.
  • DigitalOcean becomes the DNS Provider.
  • DigitalOcean's Name Servers provide the domain's DNS records.
  • An A Record points the domain to the Droplet's IP address.

The instructor notes that keeping the name servers with Namecheap would also work. He moves them to DigitalOcean because it is easier to manage for this exercise and gives students experience with changing name servers.

Registrar = where the domain is registered.

Name Server = where the domain's DNS records are provided.

The Registrar, DNS Provider, and Hosting Provider do not have to be the same company.

C. A Records

An A Record maps a domain name to an IPv4 address.

In the course:

@ → Droplet IPv4 address
www → Droplet IPv4 address

@ represents the root domain, gemstack.lol.

The instructor creates another record for www.gemstack.lol so both addresses point to the same Droplet.


D. DNS Changes, Caching, and TTL

DNS changes may take time to appear for every user. This delay is often called DNS propagation, but records are not literally copied to every DNS server on the Internet.

A DNS record has a TTL (Time to Live), usually expressed in seconds. The TTL tells recursive resolvers how long they may cache an answer before asking an authoritative name server for a fresh copy.

For example, a TTL of 3600 allows a resolver to reuse the cached answer for up to one hour. During that period, some users may receive the old cached value while other resolvers that refresh later receive the new value. Changes to authoritative name server delegation can also be delayed by cached NS and related records.

In the course, gemstack.lol was not available immediately because the changes had not fully propagated yet.


E. Checking DNS with dig

The instructor uses dig to check whether the DNS changes have propagated.

dig gemstack.lol

dig can be used to query DNS information and verify whether the domain resolves correctly.

If the domain is not available yet, the server can still be accessed directly using its IP address.

dig is better than ping for troubleshooting DNS because it directly queries DNS and provides detailed information about the result, such as the IP address, DNS records, and errors like NXDOMAIN. ping may use DNS to resolve a domain first, but its main purpose is to test network reachability, not DNS.


F. Domain Email

A custom domain can also be used for email:

name@gemstack.lol

Services such as Namecheap or Google can provide domain email or email forwarding.

This may require additional DNS configuration depending on the service being used.

G. URL

URL stands for Uniform Resource Locator. It describes where a resource is located.

A URL can contain several parts:

https://dev.example.com:443/products/123?sort=price#details
  • Schemehttps
  • Hostnamedev.example.com
  • Subdomaindev
  • Registrable domainexample.com
  • TLD.com
  • Port443 (optional; HTTPS uses 443 by default)
  • Path/products/123
  • Query string?sort=price
  • Fragment#details

The hostname identifies the network destination. The path identifies a resource at that destination, the query string supplies additional parameters, and the fragment identifies a location within the returned resource.


H. TLD — Top-Level Domain

A TLD is the ending of a domain name:

Examples mentioned in the course include:

  • .com
  • .science
  • .blog
  • .best

There are now many different TLDs available.

I. Cybersquatting

Cybersquatting refers to registering a domain associated with another company or trademark, often hoping to profit from or misuse it.

For example:

microsoft.com microsoft-related domains

Domain ownership can lead to disputes when trademarks or company names are involved.

J. ICANN

ICANN coordinates important parts of the global domain-name system, including the DNS root, top-level domains, and the registrar ecosystem.

ICANN does not directly decide every domain dispute. Its Uniform Domain-Name Dispute-Resolution Policy (UDRP) provides a process for certain trademark-related disputes, which are decided by approved dispute-resolution providers.

For example, someone cannot simply create or control a TLD such as:

.microsoft

without going through the relevant process and rules.

The instructor also notes that domain registration and renewal include a small ICANN fee.

K. Domain Security

A domain registrar account should be strongly protected with:

  • A strong password
  • Two-Factor Authentication (2FA)
  • Limited account access

If the registrar account is compromised, an attacker could change the domain configuration and redirect users to a fake website.

Protecting the Registrar account is critical because it controls the domain.