008A-ICMP

簡介

Internet控制消息協議ICMP(Internet Control Message Protocol)是網絡層的一個重要協議。ICMP協議用來在網絡設備間傳遞各種差錯和控制信息,並對於收集各種網絡信息、診斷和排除各種網絡故障等方面起着至關重要的作用。使用基於ICMP的應用時,需要對ICMP的工作原理非常熟悉。

ICMP用來傳遞差錯、控制、查詢等信息

ICMP重定向
ICMP差錯檢測

  • ICMP Echo Request和ICMP Echo Reply分別用來查詢和響應某些信息,進行差錯檢測

ICMP錯誤報告

  • 當網絡設備無法訪問目標網絡時,會自動發送ICMP目的不可達報文到發送端設備

ICMP數據包格式
在這裏插入圖片描述

  • Type表示ICMP消息類型,Code表示同一消息類型中的不同信息

ICMP消息封裝格式
在這裏插入圖片描述
ICMP消息頭部格式
在這裏插入圖片描述
ICMP消息類型和編碼類型

類型 編碼 描述
0 0 Echo Reply
3 0 網絡不可達
3 1 主機不可達
3 2 協議不可達
3 3 端口不可達
5 0 重定向
8 0 Echo Request

更多見:報文格式大全.chm

ICMP應用-ping

<Huawei>ping ?
  -a             Select source IP address, the default is the IP address of the
                 output interface
  -c             Specify the number of echo requests to be sent, the default is
                 5
  -d             Specify the SO_DEBUG option on the socket being used
  -f             Set Don't Fragment flag in packet (IPv4-only)
  -h             Specify TTL value for echo requests to be sent, the default is
                 255
  -i             Select the interface sending packets
  -m             Time in milliseconds to wait for sending next packet, the
                 default is 500ms
  -n             Numeric output only. No attempt will be made to lookup host
                 addresses for symbolic names
  -name          Display the host name of the destination address
  -p             No more than 8 "pad" hexadecimal characters to fill out the
                 sent packet. For example -p f2 will fill the sent packet with
                 f and 2 repeatedly
  -q             Quiet output. Nothing is displayed except the summary lines at
                 startup time and when finished
  -r             Record route. Includes the RECORD_ROUTE option in the
                 ECHO_REQUEST packet and displays the route
  -s             Specify the number of data bytes to be sent, the default is
                 56bytes
  -si            Set the specified interface as the source interface of ping
  ---- More ----

ICMP應用-Tracert

<Huawei>tracert ?
  -a             Set source IP address, the default is the IP address of the
                 output interface
  -f             First time to live, the default is 1
  -m             Max time to live, the default is 30
  -p             Destination UDP port number, the default is 33434
  -q             Number of probe packet, the default is 3
  -vpn-instance  Specify VPN-Instance of MPLS VPN
  -w             Timeout in milliseconds to wait for each reply, the default is
                 5000ms
  STRING<1-255>  IP address or hostname of a remote system
  ipv6           IPv6 Protocol
  lsp            LSP traceroute
  vc             PWE3 traceroute

<Huawei>tracert 30.0.0.2
Tracert to 30.0.0.2(30.0.0.2), max hops:30, packet length:40, 
press CTRL_C to break 
1 10.0.0.2 130 ms 50 ms 40 ms 
2 20.0.0.2 80 ms 60 ms 80 ms
3 30.0.0.2 80 ms 60 ms 70 ms
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章