Protocol Layering
프로토콜(protocol) : 송신자와, 수신자, 그리고 모든 중간 장치들이 효과적으로 통신하기 위하여 따라야 하는 규칙
- 통신이 간단할 때에는 하나의 프로토콜만이 필요할 수도 있다.
- 통신이 복잡할 떄에는 각 계층마다 프로토콜이 필요하다.
- 프로토콜 계층화 : 서로 다른 계층 간에 임무를 나눔
시나리오
- 프로토콜 계층화를 이해하기위한 두 가지 시나리오
1) 첫번째 시나리오
- 통신은 한 계층에서만 일어날 수 있는 간단한 것

2) 두번째 시나리오
- 세 계층 프로토콜을 사용한다.
- 멀리 떨어진 도시에서의 메일을 이용한 통신
- 암호화 (encryption), 복호화(decryption) 기술을 사용하여 전송된다.
- 통신은 세 개의 계층에서 발생한다.

Protocol Layering의 원칙
- 각 계층은 opposite tasks를 수행
- 각 계층에 있는 객체는 서로 identical 해야한다.
Logical connection
- peer layer 사이에서 layer-to-layer 통신을 갖는다.

TCP/IP protocol 그룹
- 현재의 인터넷에서 사용하는 프로토콜 그룹이다.
- 계층적 : 각 상위 계층 프로토콜은 1개 이상의 하위 계층 프로토콜로부터 지원을 받는다는 의미

계층적 구조
두 호스트 간에 통신
- link-layer switch를 갖는 3개의 LAN으로 이루어진 인터넷이라고 가정
- 링크들이 하나의 라우터로 연결된고 가정

컴퓨터 A와 컴퓨터 B가 통신하다고 가정

- 중간 장치는 5개 계층이 다 동작할 필요가 없다
- router의 경우 실제로는 여러개가 있을 수 있다.(경로를 잡아주는 일)
송신측과 수신측 host : 5 layer
switch : 2 layer (phsical, data link)
Router : 3 layer (phsical, data link, network)
TCP/IP 에서 계층간의 기능
- application, trasnport, network layer의 임무 : end-to-end
- data link, phiscal의 임무 : hop-to-hop
- hop은 여기서 호스트 또는 라우터를 말한다

TCP/IP protocol에서 같은 layer에서는 동일한 object 사용

각 계층에 대한 설명
1) Physical Layer
- 한 hop에서 다른 hop으로 보내는 bit를 전달하는 책임이 있다.
- 전자적 회로 구성(electronic circuit transmission) 기술로 이루어진다.

2) Data link layer
- 한 hop에서 다른 hop으로 보내는 frame를 전달하는 책임이 있다.
- Frame : data link layer의 데이터 단위
- Basic functions : Framing, Node-to-node Delivery, Error Control

Hop-to-Hop delivery(Node-to-Node)
- 인접한 노드(in a WAN) 간이나 노드(in a LAN) 사이에 fraem을 전달한다.

3) Network Layer
- 송신측에서 수신측 사이에 packet(Datagrame)을 최선의 경로로 전달하는 책임이 있다.

source to destination to delivery
- basic funcitons : Host addressing, Packet routing

4) Transport Layer
- application을 위한 proccess-specific transmission channel을 제공한다.

port to port delivery
- 한 프로세스에서 다른 프로세스에 message를 전송하는 책임이있다.
- Basic-functions : Error & Flow & congestion Control, Proccess-to-proccess delivery

5) Application Layer
- 사용자에게 서비스를 제공하기 위한 책임이 있다.
- Hypertext Transfer Protocol (HTTP)
- File Transfer Protocol (FTP)
- Simple Mail Transfer Protocol (SMTP)
- Dynamic Host Configuration Protocol (DHCP)

Encapsulation and Decapsulation
- protocol layering 에서 중요한 개념
- 송신측 host : Encapsulation
- router : Decapsulation and Encapsulation
- 수신측 host : Decapsulation

Addressing
- 양 layer들 간에는 logical communcication이 존재한다.
- 어떤 통신간에는 address가 필요하다
- TCP/IP는 5개의 계층을 가진다. 그러나 4개의 주소쌍이 필요하다
- Physical layer는 주소가 필요없다.
- Physical layer의 데이터 단위는 bit인데, 주소를 가질수 없다.

1) Link-layer Addresses
- 지역적으로 정의된 주소
- LAN이나 WAN에서 호스트나 router 구분을 정의한다.

2) Network Layer Addresses : Logical Address
- 인터넷 전체에 범위로 주소는 global하다.
- 32-bit IP 주소

3) Transport layer address : Port Number
- port number는 동시에 동작하는 여러 프로그램을 구별하는 local address이다.

4) Application layer address : Names(Specific Address)
- email address, Uniform Resource Locator(URL)
OSI Model
- 1970년 대에, 국제 표준화기구(ISO)에서 networking의 일반적인 기준과 방법의 개발하는 프로그램을 수행했다.
- Open System Interconnection(OSI)는 모든 종류의 컴퓨터 시스템 간 통신을 가능하게 하는 네트워크 시스템 설계를 위한 계층 구조이다.

OSI vs TCP/IP

OSI 모델의 실패
- OSI 모델은 TCP/IP 프로토콜 이후에 나타남
- 그러나, 세가지 이유로 OSI model은 TCP/IP를 대체하지 못했다.
- OSI는 TCP/IP가 완전히 자리잡은 이후에 완성되었다.
- OSI의 일부 계층(Session, Presentation Layer)이 완전히 정의되지 않았다.
- OSI는 TCP/IP로 부터 전환되기 위한 충분히 높은 수준의 성능을 보여주지 못했다.