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).
| Bits | 160-167 | 168-175 | 176-183 | 184-191 |
|---|---|---|---|---|
| 160 | Type | Code | Checksum | |
| 192 | ID | Sequence | ||
- 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
| Type | Code | Description |
|---|---|---|
0 - Echo Reply[RFC792] | 0 | Echo reply (used to ping) |
| 1 and 2 | Reserved | |
3 - Destination Unreachable[RFC792] | 0 | Destination network unreachable |
| 1 | Destination host unreachable | |
| 2 | Destination protocol unreachable | |
| 3 | Destination port unreachable | |
| 4 | Fragmentation required, and DF flag set | |
| 5 | Source route failed | |
| 6 | Destination network unknown | |
| 7 | Destination host unknown | |
| 8 | Source host isolated | |
| 9 | Network administratively prohibited | |
| 10 | Host administratively prohibited | |
| 11 | Network unreachable for TOS | |
| 12 | Host unreachable for TOS | |
| 13 | Communication administratively prohibited | |
4 - Source Quench[RFC792] | 0 | Source quench (congestion control) |
5 - Redirect Message[RFC792] | 0 | Redirect Datagram for the Network |
| 1 | Redirect Datagram for the Host | |
| 2 | Redirect Datagram for the TOS & network | |
| 3 | Redirect Datagram for the TOS & host | |
| 6 | Alternate Host Address | |
| 7 | Reserved | |
8 - Echo Request[RFC792] | 0 | Echo request |
9 - Router Advertisement[RFC1256] | 0 | Router Advertisement |
10 - Router Solicitation[RFC1256] | 0 | Router discovery/selection/solicitation |
11 - Time Exceeded[RFC792] | 0 | TTL expired in transit |
| 1 | Fragment reassembly time exceeded | |
12 - Parameter Problem: Bad IP header[RFC792] | 0 | Pointer indicates the error |
| 1 | Missing a required option | |
| 2 | Bad length | |
13 - Timestamp [RFC792] | 0 | Timestamp |
14 - Timestamp Reply[RFC792] | 0 | Timestamp reply |
15 - Information Request[RFC792] | 0 | Information Request |
16 - Information Reply [RFC792] | 0 | Information Reply |
17 - Address Mask Request [RFC950] | 0 | Address Mask Request |
18 - Address Mask Reply[RFC950] | 0 | Address Mask Reply |
| 19 | Reserved for security | |
| 20 through 29 | Reserved for robustness experiment | |
30 - Traceroute[RFC1393] | 0 | Information Request |
31 -[RFC1475] | Datagram Conversion Error | |
| 32 | Mobile Host Redirect | |
| 33 | Where-Are-You (originally meant for IPv6) | |
| 34 | Here-I-Am (originally meant for IPv6) | |
| 35 | Mobile Registration Request | |
| 36 | Mobile Registration Reply | |
| 37 - [RFC1788] | Domain Name Request | |
| 38 - [RFC1788] | Domain Name Reply | |
| 39 | SKIP Algorithm Discovery Protocol, Simple Key-Management for Internet Protocol | |
| 40 | Photuris, Security failures | |
| 41 | ICMP for experimental mobility protocols such as Seamoby [RFC4065] | |
| 42 through 255 | Reserved |
No comments:
Post a Comment