TCP/IP_ICMP

silups·2024년 12월 11일

TCP/IP

목록 보기
7/12

ICMP(Internet Control Message Protocol)

  • IP protocol은 eror-reporting 이나 error correcting 기능이 없다
    • error control, flow control, congestion control 불가(신뢰성 없음)
  • ICMP가 보완

ICMP

  • Network layer protocol
  • IP에 encapsulation됨

Messages

  • ICMP messages는 error-reporting messages와 query message로 나뉜다.
    - error-reporting messages: 에러 관리 목적(에러 발생 여부를 알려줌)
    - query message: 연결 여부 확인 목적

type

3: 목적지 도달 불가 4: quench(억제) -> flow control 11: 시간 초과 (TTL 만료(code 0), Time out(code 1)) 12: header가 잘못됨 5: 더 빠른 router가 있을 경우

8/0: ping
13/14: 전송/수신 시간 찍어 보내기

General format (ICMP)

  • 기본 header 8byte
  • ICMP는 error가 발생한 original source와 함께 report함

Error reporting message

1. Destination unreachable

  • IP header가 실리는 이유: Source address를 알기 위함

  • 8byte datagram이 실리는 이유: TCP port number가 실리며, 해당 port에 문제가 있음을 알리기 위함

  • 코드는 destination unreachable 된 원인
    code 0: network unreachable
    code 1: host unreachable
    code 2: protocol unreachable
    code 3: port unreachable
    code 4: 단편화가 필요하지만 단편화가 금지된 경우
    code 5: Source routing 수행 불가 (지정된 router 접근 불가)
    code 6: destination network 정보 없음
    code 7: destintaion host 정보 없음
    code 8: source host 고립
    code 9: 통신 금지된 destination network
    code 10: 통신 금지된 destination host
    code 11: 지정된 type에 대한 service 불가 network
    code 12: 지정된 type에 대한 service 불가 host
    code 13: 관라지가 filter한 host
    code 14: host 위반
    code 15: host 차단

  • code 2, 3은 destination host로 부터, 나머지는 router로 부터 생성됨

2. Source quench

  • flow-control, congestion-control 역할
  • router나 destination에 갑자기 packet이 몰려 packet을 버릴 경우, 버리는 packet마다 source quench message를 전송
    - source quench message를 받은 발송자는 전송 속도를 조절함

3. Time exceeded

code 0: TTL(time-to-live) 초과 (router)
code 1: fragments 조각이 다 안온 경우/ time out (destination host)

4. Parameter problems

  • IP packet이 정확한 format으로 오지 않고 깨져서 오는 경우
    (Router, destination host)

Pointer: code 0일 경우, 문제가 있는 byte number가 들어감

code 0: IP packet 자체의 문제인 경우
code 1: option을 준수하지 않은 경우

5. Redirection

  • 자신보다 더 빠른 router가 있을 경우, 받은 packet을 보낸 후, 전송자에게 redirection message를 전송함
    • 더 빠른 router가 있음을 알려주기 위함
    • 전송자는 routing table update.
      • host의 routing table은 작기 때문에 지속적으로 update됨.

code 0: network 전용 경로 redirection
code 1: host 전용 경로 redirection
code 2: 서비스 유형에 따른 network 전용 경로 redirection
code 3: 서비스 유형에 따른 host 전용 경로 redirection

  • router가 같은 network에 있는 host에게 전송

Query message

Echo request / reply

Identifier: 내가 보낸 request에 대한 reply인지 확인하기 위한 번호(식별자)
Sequence number: 보낸 request message 여러개를 구분 및 확인 용도
Optional data: 수신율을 확인하기 위한 data

  • request message는 host나 router에 의해 전송

  • reply message는 request message를 받은 host나 router가 전송

  • 상대 host나 router가 살아있는지 확인하기 위함(network test).

  • data를 조금 실어 보냄

    • 수신율 확인 용도

ex) ping

Timestamp request / reply

Original timestamp: 전송자가 packet을 전송했을 때의 시간
Receive timestamp: 수신자가 packet을 수신했을 때의 시간
Transmit timestamp: 수신자가 reply를 전송했을 때의 시간

  • 왕복 시간 평균 값 계산을 위해 Sequence number필요
    - 여러개 보냄

  • 시간 값을 찍어 보냄
    - 왕복 시간(round-trip time) 확인용

Round-trip time 구하기

  • 시간 동기화가 되지 않았어도 가능
  • Timestamp message를 통해 시간 동기화도 가능

sending time(송신 시간) = receive timestamp - original timestamp
receiving time(수신 시간) = returned time - transmit timestamp
round-trip time(왕복 시간) = sending time + receiving time

Time difference(시간 오차) = receiving timestamp-(original timestamp+ round-trip time/2)

Checksum

  • IP와 같음
  • 2byte씩 더해 나온 Sum을 뒤집음

Debugging tools

ping

  • 연결 확인

traceroute

  • 거쳐가는 router를 확인 할 수 있는 유닉스의 기능
    - 윈도우에서는 tracert 사용
  • 자기자신에게도 사용 가능(loopback)
  • 5초 이내 응답을 받지 못하면 *이 출력되고 next hop의 응답을 기다림.

ICMP Package

Input module

  • ICMP packet을 받아 error reporting message인 경우 해당 protocol에 전달
  • reply message인 경우 해당 request를 보낸 process에 전달

Output module

  • query message, error reporting message 전달 요청에 따라 ICMP packet 전송
  • IP의 request message에 따라 error reporting message 전송
- ICMP message가 필요 없는 경우 return
profile
NDBT

0개의 댓글