wireshark ICMP

整體抓包圖

clipboard.png
bogon,哈哈spa

關注看icmp報文類型和代碼

clipboard.png

win 下執行traceert

C:\Users\tb>tracert jd.com

經過最多 30 個躍點跟蹤
到 jd.com [118.193.98.63] 的路由:

  1     2 ms     2 ms     2 ms  bogon [192.168.1.1]
  2    10 ms     4 ms     4 ms  100.64.0.1
  3     5 ms     5 ms     5 ms  73.254.120.106.static.bjtelecom.net [106.120.254.73]
  4     7 ms     *        5 ms  219.142.1.70
  5    12 ms     8 ms     7 ms  220.181.0.34
  6     *        *        *     請求超時。
  7     *        *        *     請求超時。
  8     *        *        *     請求超時。
  9     *        *        *     請求超時。
 10     *        *        *     請求超時。
 11     *        *        *     請求超時。
 12     *        *        *     請求超時。
 13     *        *        *     請求超時。
 14     *        *        *     請求超時。
 15     *        *        *     請求超時。
 16     7 ms     6 ms     6 ms  118.193.98.63

跟蹤完成。

應用實現舉例

1. 將ttl 設置過時

源主機向目的主機發送一系列特定的UDP數據報。
第一組ip數據報 ttl=1
第二組IP數據報ttl=2,etc...,以下圖.net

clipboard.png

以上因爲設置第n組數據報ttl =n 到達第n個路由器時,會致使3d

  • 路由器直接丟棄數據報
  • 像源主機發送icmp保溫 ,報文類型11 ,代碼爲0.表明ttl expired。以下圖

clipboard.png

注意icmp報文中通常包含路由器名稱和源主機目的ip地址code

Frame 2601: 70 bytes on wire (560 bits), 70 bytes captured (560 bits) on interface 0
Ethernet II, Src: HuaweiTe_0d:74:67 (50:6f:77:0d:74:67), Dst: LiteonTe_f1:fc:61 (e8:2a:44:f1:fc:61)
Internet Protocol Version 4, Src: 220.181.0.34, Dst: 192.168.1.9
    0100 .... = Version: 4
    .... 0101 = Header Length: 20 bytes (5)
    Differentiated Services Field: 0x00 (DSCP: CS0, ECN: Not-ECT)
    Total Length: 56
    Identification: 0x01e2 (482)
    Flags: 0x0000
    Time to live: 251
    Protocol: ICMP (1)
    Header checksum: 0x1f5a [validation disabled]
    [Header checksum status: Unverified]
    Source: 220.181.0.34
    Destination: 192.168.1.9
Internet Control Message Protocol
    Type: 11 (Time-to-live exceeded)
    Code: 0 (Time to live exceeded in transit)
    Checksum: 0xf4ff [correct]
    [Checksum Status: Good]
    Unused: 00000000
    Internet Protocol Version 4, Src: 192.168.1.9, Dst: 118.193.98.63
        0100 .... = Version: 4
        .... 0101 = Header Length: 20 bytes (5)
        Differentiated Services Field: 0x00 (DSCP: CS0, ECN: Not-ECT)
        Total Length: 92
        Identification: 0xe478 (58488)
        Flags: 0x0000
        Time to live: 1
            [Expert Info (Note/Sequence): "Time To Live" only 1]
                ["Time To Live" only 1]
                [Severity level: Note]
                [Group: Sequence]
        Protocol: ICMP (1)
        Header checksum: 0x3a77 [validation disabled]
        [Header checksum status: Unverified]
        Source: 192.168.1.9
        Destination: 118.193.98.63
    Internet Control Message Protocol
        Type: 8 (Echo (ping) request)
        Code: 0
        Checksum: 0xf792 [unverified] [in ICMP error packet]
        [Checksum Status: Unverified]
        Identifier (BE): 1 (0x0001)
        Identifier (LE): 256 (0x0100)
        Sequence number (BE): 108 (0x006c)
        Sequence number (LE): 27648 (0x6c00)

2. 指定固定端口號(不可用端口號)

clipboard.png
返回的結果就是type3,code 3,見下圖blog

clipboard.png

相關文章
相關標籤/搜索