DNS(Domain Name System) 구조The Structure of DNS (Domain Name System)

DNS의 계층 구조(Root Domain, TLD, SLD, Sub Domain)The DNS hierarchy (Root Domain, TLD, SLD, Sub Domain)

written by tiaz0128

DNS(Domain Name System)란?

우리가 크롬으로 구글에 접속할 때 주소창에 google.com을 입력합니다. 이런 문자열 주소를 흔히 도메인이라 부르지만, 정확한 표현으로는 도메인 네임입니다.

실제로 인터넷에서 특정 서버에 접속하기 위해서는 숫자로 이루어진 IP 주소가 필요합니다. 하지만 우리는 구글의 IP 주소를 몰라도 도메인 네임만으로 구글 서버에 접속할 수 있습니다.

이처럼 사람이 이해하기 쉬운 도메인 네임을 컴퓨터가 이해할 수 있는 IP 주소로 변환해주는 시스템을 DNS(Domain Name System)라고 합니다.

DNS

> DNS는 도메인 네임을 IP 주소로 변환한다

IP 주소 확인

이제 google.com의 실제 IP 주소를 확인해보겠습니다. Linux/Mac 환경에서는 host 명령어를, Windows 환경에서는 nslookup 명령어를 사용할 수 있습니다.

Linux/Mac
$ host google.com
google.com has address 172.217.31.174
google.com has IPv6 address 2404:6800:4004:820::200e
google.com mail is handled by 10 smtp.google.com.
Windows
> nslookup google.com
이름:    google.com
Addresses:  2404:6800:4004:820::200e
          172.217.31.174

DNS를 통해 확인한 google.com의 주소는 172.217.31.174 입니다. IP 주소를 통해 접속 가능한지 한번 확인해보세요!

DNS 구조

인터넷 주소창에 google.com을 입력하면 어떻게 해당 웹사이트에 접속할 수 있었을까요? 이를 이해하기 위해서는 먼저 DNS의 구조를 알아야 합니다.

DNS는 마치 전화번호부처럼 계층적인 구조로 도메인 정보를 관리합니다. 이러한 계층 구조(hierarchical naming structure)는 전 세계의 수많은 도메인을 체계적으로 관리할 수 있게 해줍니다.

hierarchical naming structure

http://api.www.google.com.이라는 가상의 주소로 예를 들어 설명해 보겠습니다.

DNS

DNS의 계층 구조는 다음의 네 가지로 구성 됩니다.

  • Root Domain
  • TLD(Top Level Domain)
  • SLD(Second Level Domain)
  • Sub Domain

Root Domain

우리가 사용하는 모든 도메인 네임은 실제로는 마지막에 Root Domain을 나타내는 점이 존재합니다. 예를 들어 google.com은 실제로는 google.com.와 동일하며, 마지막 점은 Root Domain을 나타냅니다.

Root Domain

> 사실 우리가 쓰는 도메인 네임 마지막에는 점이 존재

Root Domain은 DNS 계층 구조의 시작점이며, 단순히 점으로 표현됩니다. 하지만 일반적인 경우는 이 마지막 점을 생략합니다.

TLD(Top Level Domain)

도메인 이름에서 점은 계층을 구분하는 구분자 역할을 합니다. 여기에서는 다음 점이 있는 com이 TLD에 해당합니다. TLD는 Root Domain 아래 단계인 최상위 도메인을 의미하며, 크게 두 종류로 나눌 수 있습니다.

  1. 일반 최상위 도메인(gTLD): com, net, org 등 용도에 따라 구분된 도메인
  2. 국가 코드 최상위 도메인(ccTLD): kr, jp, us 등 국가를 나타내는 도메인

TLD(Top Level Domain)

> Root Domain 아래 단계인 TLD는 최상위 도메인을 의미

SLD(Second Level Domain)

SLD는 TLD 바로 아래 단계의 도메인을 의미하며, 보통 개인, 조직, 기업이 직접 등록하고 관리하는 첫 번째 단계의 도메인입니다. 여기에서는 google이 SLD입니다.

SLD(Second Level Domain)

> SLD는 TLD 바로 아래 단계의 도메인을 의미

SLD는 DNS 레코드를 직접 관리하고 설정할 수 있는 가장 기본적인 단위가 됩니다. 주요 DNS 레코드는 다음과 같습니다.

  • A (Address Record) : IPv4 주소를 위한 DNS 레코드
  • AAAA (IPv6 Address Record) : IPv6 주소를 위한 DNS 레코드
  • CNAME (Canonical Name Record) : 도메인 별칭
  • NS (Name Server) : 도메인의 DNS 정보를 제공할 수 있는 공식 네임서버를 지정
  • MX (Mail Exchange Record) : 메일 서버 설정

이러한 DNS 레코드들을 설정하여 웹 서버 연결, 이메일 서비스 구축, 도메인 리다이렉션 등의 서비스를 제공할 수 있습니다.

Sub Domain

Sub Domain은 SLD의 왼쪽에 위치하는 모든 하위 도메인을 의미합니다. 필요에 따라 계층적으로 확장이 가능합니다. 주로 서비스나 시스템을 논리적으로 구분하는데 사용됩니다.

각 Sub Domain은 자신만의 DNS 레코드를 가질 수 있어, 독립적으로 서버나 서비스를 연결할 수 있습니다. 일반적으로 다음과 같은 용도로 활용됩니다.

  • 서비스 분리: docs.github.com, mail.google.com
  • 개발 환경 구분: dev.example.com, staging.example.com, prod.example.com
  • 지역 구분: kr.example.com, us.example.com
  • 기능 분리: api.example.com, admin.example.com

Sub Domain

> Sub Domain = SLD의 왼쪽에 위치하는 모든 도메인

도메인 네임(Domain Name)

지금까지 설명한 DNS 계층 구조를 바탕으로 도메인 네임이 무엇인지 이해할 수 있습니다. 도메인 네임은 인터넷 상의 특정 위치를 나타내는 주소로, 점으로 구분된 계층적 주소 체계에서 Root Domain을 제외한 모든 부분을 의미합니다.

Domain Name

> 도메인 네임은 Root Domain을 제외한 계층적 주소 체계

각 부분은 점으로 구분되며, DNS는 도메인 네임을 해석할 때 오른쪽에서 왼쪽으로 순차적으로 분석합니다. 예를 들어 api.www.google.com의 경우

  • Sub Domain: api, www
  • SLD: google
  • TLD: com

이러한 계층적 구조 덕분에 DNS는 전 세계의 수많은 도메인 네임을 체계적으로 관리하고 효율적으로 조회할 수 있습니다.

FQDN (Fully Qualified Domain Name)

FQDN은 Root Domain을 포함한 전체 도메인 네임을 의미합니다. 도메인 네임과 다른 점은 가장 마지막에 Root Domain을 명시적으로 표현한다는 것입니다.

예를 들어

  • 도메인 네임 : api.www.google.com
  • FQDN : api.www.google.com.

FQDN (Fully Qualified Domain Name)

> FQDN은 Root Domain을 포함한 전체 도메인 네임을 의미

FQDN은 모호성 없이 정확한 도메인 위치를 나타내며, DNS 설정에서 정확한 도메인을 지정할 때 사용됩니다. 특히 DNS 구성 파일이나 시스템 설정에서는 FQDN을 사용하여 정확한 도메인 지정이 필요합니다.

마무리

지금까지 DNS의 기본 구조에 대해 알아보았습니다. DNS는 아래와 같은 계층적 구조로 이루어져 있습니다.

  • Root Domain은 DNS 계층 구조의 시작점
  • TLD는 .com, .net과 같은 최상위 도메인
  • SLD는 실제로 도메인을 등록하고 관리할 수 있는 도메인
  • Sub Domain은 필요에 따라 확장 가능한 하위 도메인

다음으로

다음글에서 계속 됩니다.

다음글: DNS(Domain Name System) 동작 방식에서는 DNS가 어떻게 도메인 네임을 IP 주소로 변환하는지, DNS 서버들이 어떻게 이 과정을 수행하는지 자세히 알아보겠습니다.

What Is DNS (Domain Name System)?

When we open Google in Chrome, we type google.com into the address bar. People usually call a text address like this a domain, but the precise term is a domain name.

To actually reach a specific server on the internet, you need a numeric IP address. Yet we can reach Google’s servers with just the domain name, without knowing Google’s IP address.

The system that turns human-friendly domain names into IP addresses computers can understand is called DNS (Domain Name System).

DNS

> DNS translates domain names into IP addresses

Looking Up an IP Address

Let’s look up the actual IP address of google.com. On Linux/Mac you can use the host command, and on Windows the nslookup command.

Linux/Mac
$ host google.com
google.com has address 172.217.31.174
google.com has IPv6 address 2404:6800:4004:820::200e
google.com mail is handled by 10 smtp.google.com.
Windows
> nslookup google.com
Name:    google.com
Addresses:  2404:6800:4004:820::200e
          172.217.31.174

The address of google.com that DNS gave us is 172.217.31.174. Try it and see whether you can connect using the IP address!

DNS Structure

So how did typing google.com into the address bar get us to the website? To understand that, we first need to know how DNS is structured.

DNS manages domain information in a hierarchy, much like a phone book. This hierarchical naming structure makes it possible to manage the countless domains around the world in an orderly way.

hierarchical naming structure

Let’s walk through it with a made-up address, http://api.www.google.com..

DNS

The DNS hierarchy is made up of four levels:

  • Root Domain
  • TLD(Top Level Domain)
  • SLD(Second Level Domain)
  • Sub Domain

Root Domain

Every domain name we use actually ends with a dot that stands for the Root Domain. For example, google.com is really the same as google.com., and that final dot represents the Root Domain.

Root Domain

> The domain names we use actually end with a dot

The Root Domain is the starting point of the DNS hierarchy and is written simply as a dot. In everyday use, though, that final dot is left out.

TLD(Top Level Domain)

In a domain name, dots act as separators between levels. Here, com, which comes after the next dot, is the TLD. The TLD is the level just below the Root Domain and means the top-level domain. There are two main kinds:

  1. Generic top-level domains (gTLD): domains grouped by purpose, such as com, net, org
  2. Country code top-level domains (ccTLD): domains that represent a country, such as kr, jp, us

TLD(Top Level Domain)

> The TLD, one level below the Root Domain, is the top-level domain

SLD(Second Level Domain)

The SLD is the domain one level directly below the TLD. It’s usually the first level that individuals, organizations and companies register and manage themselves. Here, google is the SLD.

SLD(Second Level Domain)

> The SLD is the domain one level directly below the TLD

The SLD is the most basic unit at which you can manage and configure DNS records yourself. The main DNS records are:

  • A (Address Record) : DNS record for an IPv4 address
  • AAAA (IPv6 Address Record) : DNS record for an IPv6 address
  • CNAME (Canonical Name Record) : an alias for a domain
  • NS (Name Server) : specifies the authoritative name servers that can provide the domain’s DNS information
  • MX (Mail Exchange Record) : mail server settings

By configuring these DNS records, you can connect web servers, set up email services, redirect domains and more.

Sub Domain

A Sub Domain is any lower-level domain to the left of the SLD. It can be extended hierarchically as needed, and is mainly used to separate services or systems logically.

Each Sub Domain can have its own DNS records, so it can point to its own server or service independently. Common uses include:

  • Separating services: docs.github.com, mail.google.com
  • Separating environments: dev.example.com, staging.example.com, prod.example.com
  • Separating regions: kr.example.com, us.example.com
  • Separating functions: api.example.com, admin.example.com

Sub Domain

> Sub Domain = every domain to the left of the SLD

Domain Name

With the DNS hierarchy covered, we can now understand what a domain name is. A domain name is an address that points to a specific location on the internet: in the dot-separated hierarchical address system, it means everything except the Root Domain.

Domain Name

> A domain name is the hierarchical address without the Root Domain

Each part is separated by a dot, and DNS reads a domain name from right to left when resolving it. For example, with api.www.google.com:

  • Sub Domain: api, www
  • SLD: google
  • TLD: com

Thanks to this hierarchy, DNS can manage the world’s countless domain names in an orderly way and look them up efficiently.

FQDN (Fully Qualified Domain Name)

An FQDN is the full domain name including the Root Domain. The difference from a domain name is that it explicitly writes the Root Domain at the very end.

For example:

  • Domain name : api.www.google.com
  • FQDN : api.www.google.com.

FQDN (Fully Qualified Domain Name)

> An FQDN is the full domain name including the Root Domain

An FQDN points to an exact domain location with no ambiguity, and it’s used whenever DNS settings need a precise domain. DNS configuration files and system settings in particular require FQDNs to specify the domain exactly.

Wrapping Up

We’ve covered the basic structure of DNS. DNS is built as the following hierarchy:

  • The Root Domain is the starting point of the DNS hierarchy
  • The TLD is the top-level domain, such as .com or .net
  • The SLD is the domain you actually register and manage
  • The Sub Domain is a lower-level domain you can add as needed

What’s Next

Continued in the next post.

In the next post, How DNS (Domain Name System) Works, we’ll look in detail at how DNS turns a domain name into an IP address and how DNS servers carry out that process.

DNS

tiaz0128

Eat Sleep Coding.

Never Never GiveUp.

Security  |  BackEnd  |  Multi Cloud