본문 바로가기
IT 이론/네트워크&무선통신

IP Protocol Structure

by 지식id 2014. 4. 24.
반응형

*클릭해서 보세요!

 

1. Routing Module

입력 : IP패킷, 출력 : IP패킷 + 라우팅 정보

OSPF, BGP등의 Routing Protocol이 상태정보를 수집하여 만든 Routing Table을 이용한다.

Routing Module은 단순히 테이블을 참조만 할 뿐, 테이블의 데이터를 만드는 것까지 관장하진 않는다.

IP패킷에 다음 홉 주소를 붙여서 단편화 모듈(Fragmentation Module)로 보낸다.

 

 

2. Header-adding Module

입력 : 목적지 주소가 포함된 데이터, 출력 : IP 패킷

데이터를 받아 IP 데이터그램(IP Packet)으로 encapsulate 한다.

Checksum을 검사하여 checksum 필드에 삽입한다.

Processing Module로 차례대로 전송하기 위해 Queue에 데이터를 삽입한다.

 

 

3. Processing Module

데이터가 어디로 전달 되어야 할지 결정하고 보낸다. 슈도코드는 아래와 같다.

 

Delete(get) datagram from input queue;

if(loopback || local destination) { // 목적지 IP가 127.X.X.X 이라면 루프백이다.

  send datagram to reassembly module;

  return;

}

if(this machine is router) decreament TTL; // TTL이 1이었던 애들은 여기서 사망한다.

if(TTL =< 0) {

  discard the datagram;

  call ICMP for error handling; // 에러 처리는 ICMP가 한다.

  return;

}

send the datagram to the routing module; // 살아 남은 애들은 다음 목적지로 가야한다.

return;

 

 

4. Fragmentation Module

다음 목적지로 보내기 전에 다음 목적지에서 받을 수 있는 용량으로 데이터를 분할 해 주는 역할을 한다.

 

Recieve IP packet from routing module;

if(size > MTU) {

  if(D) { //사이즈가 MTU보다 크면 쪼개야 되는데, don't fragment 플래그가 true이면 폐기할 수 밖에 없다.

    discard the datagram;

    call ICMP for error handling;

    return;

  } else {

    calculate maximum size;

    divide the datagram into fragment;

    add header each fragment;  // header는 모든 fragment에 다 붙여야 된다. 하지만 header option은 아니다.

    add required option to each fragment; // TTL같이 굳이 모든 fragment 에 붙이지 않아도 되는건 안붙인다.

    send the datagram to output queue;

    return;

  }

} else {

  send the datagram to output queue;

} return;

 

 

5. Reassembly Module

Processing Module로 부터 데이터를 전달받아서 재조립이 필요하다면 재조립 하여 상위 레이어로 전달한다.

 

Recieve IP packet from processing module;

if(offset == 0 && !M) {

  send the datagram to output queue;

  return;

}

if(!search the reassembly table) create new entry in table;

insert the fragment at the appropriate place;

if(all fragments have arrived) {

  reassemble;

  send the reassembled data to output queue;

  return;

} else {

  if(timeout) {

    discard all fragment;

    call ICMP for error handling;

  }

} return;

 

 

 

반응형

'IT 이론 > 네트워크&무선통신' 카테고리의 다른 글

Internet Control Message Protocol (ICMP)  (0) 2014.04.25
Address Resolution Protocol (ARP)  (0) 2014.04.24
IP header options  (0) 2014.04.23
IPv4 Header  (0) 2014.04.23
WAN과 LAN, Internet Structure  (0) 2014.04.23

댓글