Skip to content

Split View: [컴퓨터 네트워크] 04. 프로토콜 계층과 서비스 모델

|

[컴퓨터 네트워크] 04. 프로토콜 계층과 서비스 모델

본 포스팅은 James Kurose, Keith Ross의 Computer Networking: A Top-Down Approach (6th Edition) 교재를 기반으로 정리한 내용입니다.


1. 프로토콜 계층화의 필요성

인터넷은 매우 복잡한 시스템이다. 수많은 애플리케이션, 다양한 종단 시스템, 패킷 스위치, 링크, 프로토콜이 존재한다.

이 복잡성을 관리하기 위해 계층화(layering) 를 사용한다.

1.1 항공 여행 비유

항공 여행도 여러 계층으로 나눌 수 있다:

출발지                              목적지
──────                              ──────
 티켓 구매                           수하물 수취
   ↓                                   ↑
 수하물 위탁                          수하물 찾기
   ↓                                   ↑
 탑승 게이트                          하차 게이트
   ↓                                   ↑
 이륙                                착륙
   ↓                                   ↑
 항로 비행 ─────────────────────> 항로 비행

각 계층은 자신의 기능을 수행하고, 아래 계층의 서비스를 이용한다.

1.2 계층화의 장점

  • 모듈화: 각 계층의 내부 구현을 독립적으로 변경 가능
  • 복잡성 관리: 전체 시스템을 작은 부분으로 나누어 이해
  • 유연성: 한 계층의 프로토콜을 다른 것으로 교체 가능

2. 인터넷 프로토콜 스택 (5계층 모델)

┌─────────────────┐
│  애플리케이션 계층  │  Application Layer
├─────────────────┤
│   전송 계층       │  Transport Layer
├─────────────────┤
│   네트워크 계층    │  Network Layer
├─────────────────┤
│   링크 계층       │  Link Layer
├─────────────────┤
│   물리 계층       │  Physical Layer
└─────────────────┘

2.1 애플리케이션 계층 (Application Layer)

네트워크 애플리케이션과 애플리케이션 계층 프로토콜이 존재하는 계층이다.

  • HTTP: 웹 문서 요청과 전송
  • SMTP: 이메일 전송
  • FTP: 파일 전송
  • DNS: 도메인 이름을 IP 주소로 변환

애플리케이션 계층의 정보 패킷을 메시지(message) 라 부른다.

2.2 전송 계층 (Transport Layer)

애플리케이션 계층의 메시지를 종단 시스템 간에 전달한다.

  • TCP: 연결 지향, 신뢰적 전송, 혼잡 제어, 흐름 제어
  • UDP: 비연결, 비신뢰적 전송, 최소한의 서비스

전송 계층의 패킷을 세그먼트(segment) 라 부른다.

TCP 서비스:
  ✓ 신뢰적 데이터 전달 (재전송)
  ✓ 흐름 제어 (수신자 과부하 방지)
  ✓ 혼잡 제어 (네트워크 과부하 방지)

UDP 서비스:
  ✓ 빠른 전송 (오버헤드 최소)
  ✗ 신뢰성 보장 없음
  ✗ 흐름/혼잡 제어 없음

2.3 네트워크 계층 (Network Layer)

한 호스트에서 다른 호스트로 데이터그램(datagram) 을 전달한다.

  • IP 프로토콜: 데이터그램의 필드 정의, 주소 체계
  • 라우팅 프로토콜: 출발지에서 목적지까지의 경로 결정

네트워크 계층의 패킷을 데이터그램(datagram) 이라 부른다.

네트워크 계층의 두 가지 핵심 기능:
  1. 포워딩(Forwarding): 패킷을 적절한 출력 링크로 이동
  2. 라우팅(Routing): 출발지-목적지 경로 결정

IP 프로토콜은 하나뿐이므로, 네트워크 계층을 흔히 IP 계층이라고도 부른다.

네트워크 계층은 출발지에서 목적지까지의 경로를 결정하지만, 실제로 한 노드에서 다음 노드로 데이터그램을 전달하는 것은 링크 계층의 역할이다.

  • 이더넷(Ethernet)
  • WiFi (802.11)
  • PPP

링크 계층의 패킷을 프레임(frame) 이라 부른다.

경로: A → R1 → R2 → R3 → B

링크 계층의 역할:
  A --[이더넷]--> R1 --[WiFi]--> R2 --[PPP]--> R3 --[이더넷]--> B

  각 구간(링크)마다 다른 링크 계층 프로토콜을 사용할 수 있다.

2.5 물리 계층 (Physical Layer)

링크 계층이 프레임 단위로 데이터를 전달한다면, 물리 계층은 프레임 내의 개별 비트를 한 노드에서 다음 노드로 이동시킨다.

  • 실제 전기 신호, 빛 신호, 무선 신호를 다루는 계층
  • 매체(구리선, 광섬유, 무선)에 따라 프로토콜이 다름

3. OSI 7계층 모델과의 비교

ISO에서 제안한 OSI(Open Systems Interconnection) 모델은 7개 계층으로 구성된다.

OSI 7계층              인터넷 5계층
──────────            ────────────
애플리케이션 계층  ─┐
표현 계층        ─┤── 애플리케이션 계층
세션 계층        ─┘
전송 계층        ──── 전송 계층
네트워크 계층     ──── 네트워크 계층
데이터 링크 계층  ──── 링크 계층
물리 계층        ──── 물리 계층

표현 계층 (Presentation Layer)

  • 데이터 압축, 암호화, 데이터 형식 변환
  • 인터넷 모델에서는 애플리케이션이 직접 처리

세션 계층 (Session Layer)

  • 데이터 교환의 동기화, 체크포인팅, 회복
  • 인터넷 모델에서는 애플리케이션이 직접 처리

인터넷 프로토콜 스택에서는 표현/세션 계층의 기능이 필요하면 애플리케이션 개발자가 직접 구현한다.


4. 캡슐화 (Encapsulation)

4.1 캡슐화 과정

각 계층은 상위 계층에서 받은 데이터에 자신의 헤더 정보를 추가한다.

애플리케이션:  [메시지]
전송:         [Ht|메시지]              ← 세그먼트
네트워크:     [Hn|Ht|메시지]           ← 데이터그램
링크:        [Hl|Hn|Ht|메시지]        ← 프레임
물리:         01011001010110...        ← 비트
계층PDU (Protocol Data Unit)추가되는 헤더
애플리케이션메시지 (Message)-
전송세그먼트 (Segment)전송 계층 헤더
네트워크데이터그램 (Datagram)네트워크 계층 헤더
링크프레임 (Frame)링크 계층 헤더

4.2 전체 캡슐화 흐름

출발지 호스트          라우터              목적지 호스트
┌──────────┐    ┌──────────────┐    ┌──────────┐
│애플리케이션│    │              │    │애플리케이션│
├──────────┤    │              │    ├──────────┤
│  전송     │    │              │    │  전송     │
├──────────┤    ├──────────────┤    ├──────────┤
│ 네트워크  │    │   네트워크    │    │ 네트워크  │
├──────────┤    ├──────────────┤    ├──────────┤
│  링크     │    │    링크      │    │  링크     │
├──────────┤    ├──────────────┤    ├──────────┤
│  물리     │    │    물리      │    │  물리     │
└──────────┘    └──────────────┘    └──────────┘

호스트: 5개 계층 모두 구현
라우터: 하위 3개 계층만 구현 (네트워크, 링크, 물리)
스위치: 하위 2개 계층만 구현 (링크, 물리)

5. 네트워크 보안 기초

5.1 인터넷 초기와 보안

초기 인터넷은 신뢰할 수 있는 소수의 사용자만 사용하는 것을 전제로 설계되었다. 따라서 보안이 원래 설계에 포함되지 않았다.

오늘날 네트워크 보안은 필수적이며, 다음과 같은 위협이 존재한다.

5.2 주요 네트워크 보안 위협

멀웨어 (Malware)

멀웨어의 종류:
  ├── 바이러스(Virus): 사용자 상호작용으로 감염
  ├── 웜(Worm): 자동으로 네트워크를 통해 전파
  ├── 트로이 목마(Trojan): 정상 소프트웨어로 위장
  └── 봇넷(Botnet): 감염된 컴퓨터의 네트워크

서비스 거부 공격 (DoS: Denial of Service)

네트워크, 호스트, 또는 인프라를 정상 사용자가 사용할 수 없게 만드는 공격이다.

DoS 공격의 3가지 유형:
  1. 취약점 공격: 특정 취약점을 이용
  2. 대역폭 범람: 대량의 패킷으로 링크 포화
  3. 연결 범람: 반쪽 연결(half-open)을 대량 생성

DDoS (Distributed DoS): 여러 출처에서 동시에 공격

  봇넷 PC1 ──┐
  봇넷 PC2 ──┼──> 공격 대상 서버 (과부하)
  봇넷 PC3 ──┤
  ...        ──┘

패킷 스니핑 (Packet Sniffing)

공유 매체 환경에서 지나가는 패킷의 복사본을 가로채는 행위다.

공유 매체 (WiFi 등):
  A ──────────────── B
       └── 스니퍼(패킷 도청기)
           모든 패킷의 복사본을 수신

IP 스푸핑 (IP Spoofing)

가짜 출발지 IP 주소를 가진 패킷을 생성하여 다른 사용자로 위장하는 공격이다.

공격자가 출발지 IP를 위조:
  실제 IP: 192.168.1.100
  위조 IP: 10.0.0.1 (신뢰받는 호스트)

  서버는 패킷이 신뢰받는 호스트에서 온 것으로 오인

5.3 보안의 중요 원칙

네트워크 보안의 핵심 요소:
  ├── 기밀성(Confidentiality): 송수신자만 내용을 이해
  ├── 무결성(Integrity): 전송 중 데이터 변조 탐지
  ├── 인증(Authentication): 상대방의 신원 확인
  └── 가용성(Availability): 서비스가 항상 이용 가능

6. 정리

인터넷 프로토콜 스택 요약:

계층          PDU        핵심 프로토콜      역할
──────       ──────     ────────────    ──────
애플리케이션   메시지     HTTP,SMTP,DNS   네트워크 애플리케이션
전송          세그먼트   TCP, UDP        종단 간 데이터 전달
네트워크      데이터그램  IP              호스트 간 라우팅
링크          프레임     이더넷, WiFi     인접 노드 간 전달
물리          비트       -               비트의 물리적 전송

캡슐화의 핵심:

  • 각 계층은 상위 계층의 PDU를 페이로드(payload) 로 취급하고 자신의 헤더를 추가한다
  • 수신 측에서는 각 계층이 자신의 헤더를 제거하고 상위 계층에 전달한다 (역캡슐화)

7. 확인 문제

Q1. 인터넷 5계층 모델에서 각 계층의 PDU 명칭은?
계층PDU
애플리케이션메시지 (Message)
전송세그먼트 (Segment)
네트워크데이터그램 (Datagram)
링크프레임 (Frame)
물리비트 (Bit)
Q2. 라우터는 몇 개의 계층을 구현하는가?

라우터는 하위 3개 계층(물리, 링크, 네트워크)을 구현한다. 라우터는 IP 데이터그램의 헤더를 확인하여 포워딩 결정을 내리므로 네트워크 계층까지 필요하지만, 전송 계층과 애플리케이션 계층은 구현하지 않는다.

Q3. OSI 모델에서 인터넷 모델에 없는 두 계층은?

표현(Presentation) 계층세션(Session) 계층이다.

  • 표현 계층: 데이터 압축, 암호화, 형식 변환 담당
  • 세션 계층: 데이터 교환의 동기화, 체크포인팅 담당

인터넷에서는 이 기능들이 필요한 경우 애플리케이션 개발자가 직접 구현한다.

[Computer Networking] 04. Protocol Layers and Service Models

This post is based on the textbook Computer Networking: A Top-Down Approach (6th Edition) by James Kurose and Keith Ross.


1. The Need for Protocol Layering

The Internet is an extremely complex system. Numerous applications, various end systems, packet switches, links, and protocols all coexist.

To manage this complexity, we use layering.

1.1 Airline Travel Analogy

Air travel can also be divided into layers:

Departure                               Arrival
---------                               -------
 Ticket purchase                         Baggage claim
   |                                       ^
 Baggage check                           Baggage pickup
   |                                       ^
 Boarding gate                           Deplaning gate
   |                                       ^
 Takeoff                                 Landing
   |                                       ^
 En-route flight ----------------------> En-route flight

Each layer performs its own function and uses the services of the layer below.

1.2 Advantages of Layering

  • Modularity: Internal implementation of each layer can be changed independently
  • Complexity management: The entire system is divided into smaller, understandable parts
  • Flexibility: Protocols at one layer can be replaced with alternatives

2. The Internet Protocol Stack (5-Layer Model)

+-------------------+
| Application Layer |  Application Layer
+-------------------+
| Transport Layer   |  Transport Layer
+-------------------+
| Network Layer     |  Network Layer
+-------------------+
| Link Layer        |  Link Layer
+-------------------+
| Physical Layer    |  Physical Layer
+-------------------+

2.1 Application Layer

The layer where network applications and application-layer protocols reside.

  • HTTP: Web document request and transfer
  • SMTP: Email transfer
  • FTP: File transfer
  • DNS: Translating domain names to IP addresses

The information packet at the application layer is called a message.

2.2 Transport Layer

Delivers application-layer messages between end systems.

  • TCP: Connection-oriented, reliable delivery, congestion control, flow control
  • UDP: Connectionless, unreliable delivery, minimal service

The packet at the transport layer is called a segment.

TCP services:
  + Reliable data delivery (retransmission)
  + Flow control (prevents receiver overload)
  + Congestion control (prevents network overload)

UDP services:
  + Fast transmission (minimal overhead)
  x No reliability guarantee
  x No flow/congestion control

2.3 Network Layer

Delivers datagrams from one host to another.

  • IP protocol: Defines datagram fields and addressing scheme
  • Routing protocols: Determine the route from source to destination

The packet at the network layer is called a datagram.

Two core functions of the network layer:
  1. Forwarding: Moving a packet to the appropriate output link
  2. Routing: Determining the source-to-destination path

Since there is only one IP protocol, the network layer is often called the IP layer.

While the network layer determines the path from source to destination, the link layer is responsible for actually delivering datagrams from one node to the next.

  • Ethernet
  • WiFi (802.11)
  • PPP

The packet at the link layer is called a frame.

Path: A -> R1 -> R2 -> R3 -> B

Link layer's role:
  A --[Ethernet]--> R1 --[WiFi]--> R2 --[PPP]--> R3 --[Ethernet]--> B

  Different link-layer protocols can be used on each segment (link).

2.5 Physical Layer

While the link layer delivers data in frame units, the physical layer moves individual bits from one node to the next.

  • Deals with actual electrical signals, light signals, and wireless signals
  • Protocols differ depending on the medium (copper, fiber, wireless)

3. Comparison with the OSI 7-Layer Model

The OSI (Open Systems Interconnection) model proposed by ISO consists of 7 layers.

OSI 7 Layers              Internet 5 Layers
-----------              -----------------
Application Layer  --+
Presentation Layer --+-- Application Layer
Session Layer      --+
Transport Layer    ---- Transport Layer
Network Layer      ---- Network Layer
Data Link Layer    ---- Link Layer
Physical Layer     ---- Physical Layer

Presentation Layer

  • Data compression, encryption, data format conversion
  • In the Internet model, handled directly by the application

Session Layer

  • Synchronization of data exchange, checkpointing, recovery
  • In the Internet model, handled directly by the application

In the Internet protocol stack, if presentation/session layer functions are needed, application developers implement them directly.


4. Encapsulation

4.1 The Encapsulation Process

Each layer adds its own header information to the data received from the layer above.

Application:  [Message]
                |
Transport:   [Ht|Message]              <- Segment
                |
Network:     [Hn|Ht|Message]           <- Datagram
                |
Link:        [Hl|Hn|Ht|Message]        <- Frame
                |
Physical:     01011001010110...         <- Bits
LayerPDU (Protocol Data Unit)Header Added
ApplicationMessage-
TransportSegmentTransport header
NetworkDatagramNetwork header
LinkFrameLink header

4.2 Complete Encapsulation Flow

Source Host            Router               Destination Host
+------------+    +--------------+    +------------+
| Application|    |              |    | Application|
+------------+    |              |    +------------+
| Transport  |    |              |    | Transport  |
+------------+    +--------------+    +------------+
| Network    |    |   Network    |    | Network    |
+------------+    +--------------+    +------------+
| Link       |    |   Link       |    | Link       |
+------------+    +--------------+    +------------+
| Physical   |    |   Physical   |    | Physical   |
+------------+    +--------------+    +------------+

Host: Implements all 5 layers
Router: Implements only the lower 3 layers (Network, Link, Physical)
Switch: Implements only the lower 2 layers (Link, Physical)

5. Network Security Basics

5.1 The Early Internet and Security

The early Internet was designed with the assumption that only a small number of trusted users would use it. Therefore, security was not included in the original design.

Today, network security is essential, and the following threats exist.

5.2 Major Network Security Threats

Malware

Types of malware:
  +-- Virus: Infects through user interaction
  +-- Worm: Automatically spreads through the network
  +-- Trojan horse: Disguised as legitimate software
  +-- Botnet: A network of infected computers

Denial of Service (DoS)

An attack that makes a network, host, or infrastructure unusable for legitimate users.

Three types of DoS attacks:
  1. Vulnerability attack: Exploits a specific vulnerability
  2. Bandwidth flooding: Saturates links with massive packets
  3. Connection flooding: Creates a large number of half-open connections

DDoS (Distributed DoS): Simultaneous attacks from multiple sources

  Botnet PC1 --+
  Botnet PC2 --+---> Target server (overloaded)
  Botnet PC3 --+
  ...          --+

Packet Sniffing

Intercepting copies of packets passing through a shared medium.

Shared medium (WiFi, etc.):
  A -------------------- B
       |
       +-- Sniffer (packet eavesdropper)
           Receives copies of all packets

IP Spoofing

Generating packets with a forged source IP address to impersonate another user.

Attacker forges source IP:
  Actual IP: 192.168.1.100
  Forged IP: 10.0.0.1 (trusted host)

  Server mistakenly believes the packet came from the trusted host

5.3 Key Security Principles

Core elements of network security:
  +-- Confidentiality: Only sender and receiver understand content
  +-- Integrity: Detecting data alteration during transmission
  +-- Authentication: Verifying the identity of the other party
  +-- Availability: Services are always accessible

6. Summary

Internet Protocol Stack Summary:

Layer          PDU        Key Protocols      Role
-----          ---        -------------      ----
Application    Message    HTTP,SMTP,DNS      Network applications
Transport      Segment    TCP, UDP           End-to-end data delivery
Network        Datagram   IP                 Host-to-host routing
Link           Frame      Ethernet, WiFi     Adjacent node delivery
Physical       Bit        -                  Physical bit transmission

Key encapsulation concepts:

  • Each layer treats the upper layer's PDU as a payload and adds its own header
  • On the receiving side, each layer removes its header and passes data to the upper layer (decapsulation)

7. Review Questions

Q1. What is the PDU name for each layer in the Internet 5-layer model?
LayerPDU
ApplicationMessage
TransportSegment
NetworkDatagram
LinkFrame
PhysicalBit
Q2. How many layers does a router implement?

A router implements the lower 3 layers (Physical, Link, Network). A router needs the network layer to examine IP datagram headers and make forwarding decisions, but it does not implement the transport or application layers.

Q3. What are the two layers in the OSI model that are absent from the Internet model?

The Presentation layer and the Session layer.

  • Presentation layer: Handles data compression, encryption, and format conversion
  • Session layer: Handles synchronization of data exchange and checkpointing

In the Internet, these functions are implemented directly by application developers when needed.