Friday, September 12, 2008

NetML - ICMP Internet Control Message Protocol

Giao thức Internet Control Message Protocol (ICMP) là một trong những giao thức lõi của bộ giao thức IP. Nó thường được các thiết bị mạng sử dụng để gửi các thông điệp thông báo lỗi trên đường truyền dữ liệu — ví dụ như dịch vụ hay host không tồn tại, dữ liệu không thể gửi đến một máy hay một router nào đó.

Nếu so sánh với mạng điện thoại thì ICMP có những message tương tự như những tín hiệu busy, hold, forwarding, .....

ICMP dựa vào IP để thực hiện chức năng của nó. ICMP không phải là giao thức để truyền dữ liệu giữa các hệ thống như TCP hay UDP. Các ứng dụng phổ biến sử dụng ICMP là ping và traceroute.

Cấu trúc của ICMP

Header

ICMP header bắt đầu sau bit 160 của IP header (ngoại trừ IP options được dùng).

Bits160-167168-175176-183184-191
160TypeCodeChecksum
192IDSequence
  • Type - loại ICMP được định nghĩa theo bảng bên dưới
  • Code - Ứng với mỗi Type có nhiều code để định nghĩa các loại message khác nhau
  • Checksum - phần kiểm tra lỗi được tính tóan ICMP header+data
  • ID - ID value sẽ được gửi đi bởi Echo và gửi trả lại trong gói Echo Reply
  • Sequence - sequence value, được gửi đi bởi Echo và gửi trả lại trong gói Echo Reply


Padding data

Sau phần ICMP header là padding data (in octets):


Bảng sau liệt kế các loại thông điệp của ICMP

TypeCodeDescription
0 - Echo Reply
[RFC792]
0Echo reply (used to ping)
1 and 2Reserved
3 - Destination Unreachable
[RFC792]
0Destination network unreachable
1Destination host unreachable
2Destination protocol unreachable
3Destination port unreachable
4Fragmentation required, and DF flag set
5Source route failed
6Destination network unknown
7Destination host unknown
8Source host isolated
9Network administratively prohibited
10Host administratively prohibited
11Network unreachable for TOS
12Host unreachable for TOS
13Communication administratively prohibited
4 - Source Quench
[RFC792]
0Source quench (congestion control)
5 - Redirect Message
[RFC792]
0Redirect Datagram for the Network
1Redirect Datagram for the Host
2Redirect Datagram for the TOS & network
3Redirect Datagram for the TOS & host
6Alternate Host Address
7Reserved
8 - Echo Request
[RFC792]
0Echo request
9 - Router Advertisement
[RFC1256]
0Router Advertisement
10 - Router Solicitation
[RFC1256]
0Router discovery/selection/solicitation
11 - Time Exceeded
[RFC792]
0TTL expired in transit
1Fragment reassembly time exceeded
12 - Parameter Problem: Bad IP header
[RFC792]
0Pointer indicates the error
1Missing a required option
2Bad length
13 - Timestamp
 [RFC792]
0Timestamp
14 - Timestamp Reply
[RFC792]
0Timestamp reply
15 - Information Request
[RFC792]
0Information Request
16 - Information Reply
 [RFC792]
0Information Reply
17 - Address Mask Request
 [RFC950]
0Address Mask Request
18 - Address Mask Reply
[RFC950]
0Address Mask Reply
19Reserved for security
20 through 29Reserved for robustness experiment
30 - Traceroute
[RFC1393]
0Information Request
31 -
[RFC1475]
Datagram Conversion Error
32Mobile Host Redirect
33Where-Are-You (originally meant for IPv6)
34Here-I-Am (originally meant for IPv6)
35Mobile Registration Request
36Mobile Registration Reply
37 - [RFC1788]Domain Name Request
38 - [RFC1788]Domain Name Reply
39SKIP Algorithm Discovery Protocol, Simple Key-Management for Internet Protocol
40Photuris, Security failures
41ICMP for experimental mobility protocols such as Seamoby [RFC4065]
42 through 255Reserved
Vì các messages của ICMP khá nhiều, không tiện giải thích chi tiết hết ra đây. Để tìm hiểu sâu hơn về các messages các bạn click vào link liên kết để đọc thêm tài liệu về mỗi loại messages

No comments: