개발새발

(Chap2) Protocol Architecture, TCP_IP and Internet-based Applications 본문

네트워크

(Chap2) Protocol Architecture, TCP_IP and Internet-based Applications

비숑주인 2025. 12. 29. 17:33

Define a protocol !

  •  Using a layered protocol stack, communication function is broken down into sub-functions implemented at each layer. 
  •  A protocol at a layer N in a device communicate with the same protocol at the same layer N in another device by exchanging data (PDU(Protocol Data Unit)= header(control info.) + payload).
  • % payload 란 각 프로토콜이 최종 전송하고자하는 데이터로 상위계층으로 부터 받는 순수한 data를 의미함.
  • 서로 다른 두 장비에서 같은 계층의 동일한 모듈이 서로 주고 받을 데이터들의 format (syntax), 각 데이터 내용의 의미 (semantics) 그리고 주고 받는 데이터들의 순서와 행동을 정의한 것, 즉 해당 모듈이 수행할 작업을 완성하기 위해 두 모듈사이에 지켜야할 규칙의 집합이 프로토콜 임. 

 

Internet communication system is based on the peer layer protocol architecture.

  • Each layer protocol (ex. TCP) is a service user to its adjacent lower layer protocol (ex. IP) and a service provider to its adjacent higher layer protocol (ex. HTTP). 즉, 데이터통신의 5계층 모델에서 각 계층(N계층)의 프로토콜들이 수행하는 작업은 자신 보다 바로 아래(N-1) 계층(lower layer)의 프로토콜이 제공하는 서비스를 사용하여 이뤄지므로 아래 계층 프로토콜이 제공하는 서비스의 사용자에 해당한다. 또한, 결과적으로 자신의 바로 상위(N+1) 계층(higher layer)의 프로토콜에게 필요한 서비스를 제공하게 되므로 상위 계층 프로토콜에게는 service provider의 역할을 하게 된다. 
  • SAP(Service Access Protocol) : 인접한 두 layer 프로토콜 사이의 인터페이스를 말함 ; 특별히 application layer와 transport layer 사이의 TSAP을  socket (소켓)이라고 함 ; 앱 개발자는 socket programming 만으로도 네트워크에 관한 지식없이 네트워크 프로그래밍이 가능함.

 

Role of each layer in the Internet (TCP/IP) protocol stack

  • L5) Application L : Support network Application service btw src & dst hosts ; HTTP (web serfing), SMTP(email), etc.; 각 프로세스는 상이한 port number를 이용함.
  • L4) Transport L : (상위 5계층 프로세스의 port # 를 이용하여) process-to-process comm. btw src & dst hosts; TCP, UDP, etc
  • L3) Network L : (상위 4계층 프로토콜이 있는 호스트의 IP주소를 이용하여) host-to-host comm (routing to destination host); IP
  • L2) Data Link L : (L1 계층에 따라 상이한 주소와 알고리즘을 이용하여) data transfer between physically adjacent nodes; Ethernet, Wi-Fi, HDLC, etc

% Application (L5) and transport(L4) layers exist only at end nodes (hosts or stations) and does not in network nodes (routers).


IP (Internet protocol) at layer 3 (Network layer) : host-to-host delivery service

  • Source host에서 전송한 데이터(패킷)를 destination IP address를 이용하여 destination host 까지 전달하는 기능.
  • 위 기능 외에 부가 기능 (congestion/flow control, error correction, etc)은 제공하지 않으므로 best-effort service를 제공하는 stateless protocol.
  • Host와 router에 존재함; host는 default router에게 전달, router 들은 routing protocol을 이용하여 다음 라우터를 결정함; 다시 말해서 host에는 라우팅 프로토콜 없음.
  • 32-bit IPv4 address 
  1. Format : a.b.c.d, 0 <= a,  b, c, d <= 255, 예) 203.24.53.1 
  2. IP는 OS에 포함된 모듈이나  IP 주소는 OS에 할당하는 파라미터가 아니라 해당 기기가 인터넷에 접속하는 NIC(Network Interface Card) 에 할당하는 파라미터임.
  3. 따라서 만일 둘 이상의 NIC 카드를 사용하는 서버 호스트 혹은 라우터는 둘 이상의 IP 주소를 설정할 수 있음.

Addressing a particular host in the Internet  (인터넷에 연결된 어떤 host (A라고 하자) 에서 실행 중인 특정 process (HTTP server process라고 가정하자)에게 데이터를 전달하기 위해 필요한 주소)

  • 인터넷에서 특정 process를 찾기 위해서는 (IP address & port#)가 필요함.
  • 즉, A 의 NIC 카드에 설정된 IP address와 HTTP server process가 사용하는 port number, 80번 을 알아야 해당 서버에게 데이터를 전송할 수 있음.
  • IP address 와 port number를 각각 집주소와 수취인에 비유함; 이는 인터넷에서의 통신과 우체국을 이용한 편지통신이 유사하개 때문임. 즉, IP address를 이용해서 중간 라우터들이 destination host를 찾음 --> IP 주소를 집 주소에 비유하며, destination host에 도달한 후 port number를 이용해서 해당 process에게 데이터를 전달 --> port number를 같은 집에 사는 특정 수취인에 비유함.


TCP vs. UDP at layer 4 (Transport layer) : process-to-process communication service

  • similarities
  1. 상위 application layer 기능을 하는 process를 port #를 이용하여 찾아주는 역할을 함; 서버는 well-known port # (ex: 80 for HTTP server process), 클라이언트는 OS가 할당한 임의 port #를 사용함.
  2. Do Internet Checksum for error detection.
  • differences
  1. TCP : connection-oriented protocol로 reliable (no-loss & in-order) service를 제공함; loss에 민감한 응용들이 선호함.; TCP는 이 외에도 flow/congestion control을 함.
  2. UDP : connectionless protocol로 부가 기능이 없어 상위 응용에서 보낸 PDU를 곧장 IP에게 내려 보냄; loss 보다 delay에 민감한 응용들 혹은 스스로 필요한 기능을 구현하는 smart application들이 선호함.


Protocol examples

  • ICMP (Internet Control Message Protcol) : IP 패킷 delivery 중에 발생한 에러를 해당 패킷을 보낸 송신지(source)에게 알려주려는 목적으로 개발된 프로토콜.
  • OSPF, RIP, BGP : 라우터에서 실행되는 라우팅 프로토콜. 
  • Again, hosts have NO routing protocols and they just send each packet to its default router (or the first-hop router).

 

PDU(Protocol Data Unit) : 각 계층 프로토콜들이 다른 노드의 같은 계층 같은 프로토콜과 주고 받는 정보 단위임; header와 payload로 구성

  • Header :  각 프로토콜이 상위 계층에 제공하는 서비스를 수행하기 위해  peer 프로토콜과 교환할 제어정보를 저장 (예를 들어 source host의 TCP와 destination host의 TCP). If a protocol defines the large header, then it means the protocol USUALLY 
  1. contains more control information
  2. provides more services (functions) to its next higher layer protocols 
  3. may take more time

%예외) IPv6 는 header 크기는 IPv4 보다 크나 주소 크기만 클 뿐, field 개수는 적어 기본 기능이 축소됨.

  • Payload : 해당 프로토콜이 전송해야할 순수한 데이터 (상위 계층 프로토콜의 PDU)
  1. 예를 들어 N 계층 프로토콜은 (N+1) 계층 프로토콜의 PDU를 자신의 payload에 저장함

PDU name, Address and example protocols used at each layer in 5 layer Internet (TCP/IP) protocol stack  

  • L5) Application L : Message / URL /  HTTP for VoD streaming, SMTP, FTP, SSH  |  DNS, RIP, HTTP  for real-time streaming...
  • L4) Transport L : Segment / port number /          TCP                                            |                  UDP
  • L3) Network L  : Datagram(or Packet) / IP address /                                         IP
  • L2) Data Link L : Frame / 프로토콜 마다 상이 함, ex) 48-bit MAC address in Ethernet & Wi-Fi, or 7-bit address in HDLC
  • L1) Physical L  : bits / Twisted Pair (TP), Coaxial cable, Optical Fiber, / radio, satellite ....

 

History of the Internet and TCP : ARPANET (NCP) --> NSFnet (original TCP/IP) --> Internet (Updated TCP/IP, and security issues)

  • 현재 사용되는 Internet의 원조는 70년대 등장한 네트워크(ARPANET 이라고 부름)이고 그때는 TCP 대신 NCP를 사용함. 
  • 이후 NSFnet 으로 성장했고 이때 부터 지금 사용하는 TCP/IP가 시작되었음. 
  • 현재 사용되는 Internet은 90년대 초 WWW의 발전으로 급 성장하게되었으며 불특정 다수의 사용자들이 연결되면서 security 이슈가 대두되었음. 


Service Access Point (SAP)

  • A logical position, where two adjacent layers in one entity communicate with each other by calling function, i.e., primitives (request/indication/response/confirm); 
  • 예를 들어 TCP는 IP 모듈을 호출 (function call하며 이때 TCP PDU(segment)를 파라미터로 넘겨 줌. 
  • Again, TSAP btw L5 and L4 은 특별히 socket 이라고 함; application developer는 네트워크에 관한 지식이 없더라도 socket에 해당하는 OS library들만 잘 사용하면 네트워 프로그래밍이 가능함.