Presentation is loading. Please wait.

Presentation is loading. Please wait.

ICMP RFC 792 Internet Control Message Protocol RFC 1256 ICMP Router Discovery Message.

Similar presentations


Presentation on theme: "ICMP RFC 792 Internet Control Message Protocol RFC 1256 ICMP Router Discovery Message."— Presentation transcript:

1 ICMP RFC 792 Internet Control Message Protocol RFC 1256 ICMP Router Discovery Message

2

3 ICMP: Internet Control Message Protocol used by hosts & routers to communicate network-level information –error reporting: unreachable host, network, port, protocol –echo request/reply (used by ping) network-layer “ above ” IP: –ICMP msgs carried in IP datagrams ICMP message: type, code plus first 8 bytes of IP datagram causing error Type Code description 0 0 echo reply (ping) 3 0 dest. network unreachable 3 1 dest host unreachable 3 2 dest protocol unreachable 3 3 dest port unreachable 3 6 dest network unknown 3 7 dest host unknown 4 0 source quench (congestion control - not used) 8 0 echo request (ping) 9 0 route advertisement 10 0 router discovery 11 0 TTL expired 12 0 bad IP header

4 Traceroute and ICMP Source sends series of UDP segments to dest –First has TTL =1 –Second has TTL=2, etc. –Unlikely port number When nth datagram arrives to nth router: –Router discards datagram –And sends to source an ICMP message (type 11, code 0) –Message includes name of router& IP address When ICMP message arrives, source calculates RTT Traceroute does this 3 times Stopping criterion UDP segment eventually arrives at destination host Destination returns ICMP “ host unreachable ” packet (type 3, code 3) When source gets this ICMP, stops.

5 網際控制訊息協定( Internet Control Message Protocol , ICMP ) 透過 IP 來傳送控制訊號 常用的功能: – 流量控制 – 偵測無法到達的目的地 – 重導路徑 – 偵測遠端主機

6 Failure of Datagram Transfer If a router cannot route a datagram to destination... Some reasons: –Failures of communication lines and processes –Destination machine is disconnected from the network –Time-to-live counter expires –Intermediate router becomes so congested source error occurs destination

7 How to Handle the Error The ICMP allows routers to send error or control messages to (the ICMP module of ) other routers or hosts. When a datagram causes an error, ICMP can only report the error condition back to the original source of the datagram. The source must relate the error to an individual application program or take other action to correct the problem.

8 ICMP 訊息的傳送

9 ICMP over IP ICMP message is encapsulated in IP datagram and transferred by the IP mechanism. Thus, ICMP message –May be lost or error, –May make network congestion more serious.

10 ICMP 訊息表頭 資料 依 Type 而定 表頭的加總查核碼型態 Type 訊息碼 Code Bit 016314824 1 2 字組 Word

11 ICMP 表頭欄位 型態( Type , 8 位元):訊息的分類 訊息碼( Code , 8 位元):提供此型態下 更多的屬性 表頭的加總查核碼( Checksum , 16 位元) 資料:通常是收到的 IP datagram 的 Header + 64 bits of Data Datagram

12 Categories of ICMP Messages ICMP messages are divided into two broad categories: –Error-reporting The error-reporting messages report problems that a router or a host (destination) may encounter when it processes an IP packet. –Query The query, which occur in pairs, help a host or a network management get specific information form a router or another host.

13 ICMP Message Type Type of ICMP ICMP Message Type 8/0 Echo Request/Reply 3 Destination Unreachable 4 Source Quench 5 Redirect ( Change a route ) 9 Router Advertisement 10 Router Solicitation 11 Time Exceeded for a Datagram 12 Parameter Problem on a datagram 13/14 Timestamp Request/Replay 15/16 Information Request/Replay ( obsolete ) 17/18 Address Mask Request/Replay

14 ICMP 的錯誤訊息 ( 3 )偵測無法到達目的地主機 ( Destination Unreachable ) ( 4 )來源主機暫停( Source Quench ) ( 5 )重導( Redirect ) ( 11 )超過時間的訊息( Time Exceeded ) ( 12 ) Parameter Problem on a datagram

15 偵測無法到達的目的地 使用 Destination Unreachable ( Type 3 ) 的 ICMP Error Message 。 當 Datagram 無法送達某一 Network 或 Host 時,由偵測到此問題的 Gateway 送 出 Destination Unreachable 的 Message 給 Source 。 當 Datagram 無法送達某一 Host 的特定 Port 時,由 Destination Host 送出 Message 給 Source 。

16 目的地無法到達的原因( 1 ) 0. Network unreachable 1. Host unreachable 2. Protocol unreachable 3. Port unreachable 4. Fragmentation needed and DF set 5. Source route failed 6. Destination network unknown

17 目的地無法到達的原因( 2 ) 7. Destination host unknown 8. Source host isolated 9. Communication with destination network administratively prohibited 10. Communication with destination host administratively prohibited 11. Network unreachable for type of service 12. Host unreachable for type of service

18 使用 ICMP 訊息發現路徑 MTU 當 Datagram 大於傳送網路上的 MTU , IP 模組會切割( Fragment )此 Datagram 以符 合 MTU 的要求。 如果應用程式選擇的 Datagram 小於或等與 路徑上的最小 MTU ,路徑上的路由器便不 需要做切割的動作。 DF=1 表此 Datagram 不可被 Fragmented 。 Router 送 ICMP Message 給 Source 。修正 Datagram Size 直到沒有 Error Message 。

19 流量控制 Datagram 到達 Destination or router 的速 度太快,來不及處理, Destination or router 會對每一個 Discarded Datagram , 傳回相對應的 Source Quench ( Type 4 ) Message ,要求 Source 暫時停止傳送 Datagram 。 Source 收到 Source Quench 會降低 Transmission Rate ,直到不再收到 Error Message 。

20 重導路徑 網路上可能有 2 台以上的 gateways 。 當某一 Router 發現應該使 用另一 Gateway 送資料, 則送出 Redirect ( Type 5 ) 給予 Host 。 Host 會將此資訊存在 Routing Table ,並 Forward Datagram 給合適的 Gateway 。 B1 G1:default gateway B1 send a datagram to C1.

21 Time Exceeded for a Datagram Type 11 的 ICMP 訊息。其功用包括: –Detecting circular (Code=0) –Not find all of fragments (Code=1) –Traceroute

22 Detecting Circular 當傳送路徑太長或出現 Routing Cycle , 則 TTL 最終會被減為 0 。 若一 Router 發現 TTL 為 0 則會丟棄此 Datagram ,且送回 Type 11 、 Code 0 的 ICMP 訊息,表示 TTL count exceed 。 避免 Endless 的傳遞 Datagram 。

23 無法重組 Datagram 若 Host 在一定時間內一直等不到某些 Fragment 以重組 Datagram 。一旦 Timeout , Host 送回 Type 11 、 Code 1 的 ICMP 訊息,表示 Fragment reassembly time exceeded 。

24 使用 Traceroute 追蹤目的地主 機路由路徑( 1 ) 利用 IP datagram 中的 Time To Live ( TTL )計數器: – 送出的 IP datagram ,沿著傳送路徑,每經過 一個路由器, TTL 就會被遞減。 – 如果 TTL = 0 ,則路由器送回 ICMP Time Exceeded 訊息,並將自己的 IP 位址傳回給 原始主機。

25 使用 Traceroute 追蹤目的地主 機路由路徑( 2 ) 送出 UDP 偵測( Probe )封包給予目的地電 腦上不存在的程式 Probe 設定一個很小的 TTL ,等待 – 從( TTL 時間限制內可到達 之最靠近目的地的) 路由器送來的 ICMP Time Exceeded 訊息; – 或是目的地電腦送來的 ICMP 目的埠無法到達 (Port Unreachable )(代表已到達目的地主機 ) 的 訊息。 原始主機收到 ICMP 訊息後,記錄路由器的 IP 位址。

26 使用 Traceroute 追蹤目的地主 機路由路徑( 3 ) 從 1 開始遞增 TTL 的值,再次送出 Probe ,記錄新的路由器的 IP 位址。 直到收到 ICMP Port Unreachable 訊息。

27 TRACEROUTE from 140.126.155.25 $ traceroute pcs.csie.nctu.edu.tw traceroute to pcs.csie.nctu.edu.tw (140.113.214.103), 30 hops max, 40 byte packs 1 140.126.111.20 (140.126.111.20) 0.695 ms 0.633 ms 0.635 ms 2 140.126.111.254 (140.126.111.254) 3.858 ms 3.241 ms 3.260 ms 3 ChinMin-TANet.HcRC.edu.tw (140.126.239.254) 15.783 ms 20.899 ms 24.593 ms 4 HcRC-eth-Nctu.HcRC.edu.tw (140.126.236.254) 12.564 ms 8.819 ms 8.787 ms 5 ITRI-T1-TANet.HcRC.edu.tw (140.126.254.254) 8.517 ms 8.420 ms 8.849 ms 6 HcRC-Gw2-NCTU.TANet.edu.tw (140.113.254.254) 10.479 ms 8.941 ms 8.984 ms 7 ATM-Gw-GE.NCTU.edu.tw (140.113.57.253) 15.047 ms 71.216 ms 38.336 ms 8 CSIE-E3sw.NCTU.edu.tw (140.113.53.73) 9.050 ms 12.163 ms 22.902 ms 9 pcs.csie.nctu.edu.tw (140.113.214.103) 11.778 ms * 16.269 ms

28 Parameter Problem on a Datagram 使用 ICMP ( Type 12 )表示不在上述其 他 Types 的錯誤。 ( Code 0 )如果 IP header 內參數錯誤, ICMP 會回報錯誤的 byte 的位址。 ( Code 1 )如果 IP option 內資料不全, 傳回錯誤的訊息。

29 ICMP 的資訊訊息 ( 8,0 ) Echo Request/Reply ( 9 ) Router Advertisement ( 10 ) Router Solicitation ( 13,14 ) Timestamp Request/Replay ( 17,18 ) Address Mask Request/Reply Echo Request Echo Reply

30 Echo Request/Replay Echo Request/ Reply –ICMP 回應要求( Echo Request )訊息可以送 給任意電腦上的 ICMP 軟體。 – 此 ICMP 軟體被要求送回一個 ICMP 回應回 覆( Echo Reply )訊息。 –Echo Reply 內將放置與 Echo Request 相同的 資料。

31 以 Ping 偵測遠端主機 使用 ICMP 訊息( Echo Request )測試目 的地主機可否到達。 送出一個 datagram 給予特定的目的地, 並等待其回應( Echo Replay )。 使用 ping 測試某一目的地主機是否可到 達:換言之,即網路是可相通的。 Ping 使用 ICMP echo 訊息。

32 PING $ ping -c 4 pcs.csie.nctu.edu.tw PING pcs.csie.nctu.edu.tw (140.113.214.103): 56 data bytes 64 bytes from 140.113.214.103: icmp_seq=0 ttl=248 time=25.000 ms 64 bytes from 140.113.214.103: icmp_seq=1 ttl=248 time=9.744 ms 64 bytes from 140.113.214.103: icmp_seq=2 ttl=248 time=41.403 ms 64 bytes from 140.113.214.103: icmp_seq=3 ttl=248 time=32.027 ms --- pcs.csie.nctu.edu.tw ping statistics --- 4 packets transmitted, 4 packets received, 0% packet loss round-trip min/avg/max/stddev = 9.744/27.043/41.403/11.559 ms

33 Routing Discovery 如同 BOOTP 和 DHCP ,當某一主機重新啟 動時, ICMP 提供讓 Host 知道所有 Routers 目前動態的方式。 Routers (定期)廣播送出 Router Advertisement ( Type 9 ),讓所有 Hosts 得 到 Routers 的資訊。 – 訊息中會帶有此 routers 所有的 addresses 及各 address 的優先順序. – 以 Lifetime 欄位來宣告此 Message 的有效期限。

34 Router Solicitation 當某一主機重新啟動時, Host 會想立即 獲得 Router Information 。 當 Host 廣播送出 Router Solicitation ( Type 10 ),所有收到訊息的 Router 立 即回覆一個 Router Advertisement ,如此 可讓 Host 立即獲得 Router Information 。

35 Clock Synchronization Original machine 使用 Timestamp Request ( Type 13 )要求對方傳回目前的時間。 Receiving machine 以 Timestamp Reply ( Type 14 )回應自己的時間。

36 Obtaining a Subnet Mask 使用 ICMP ( Type 17/18 ) 當某一主機重新啟動時,它會廣播一個 位址遮罩要求( Address Mask Request )。 當路由器收到此要求,便會送回一個位 址遮罩回覆( Address Mask Reply ),內 含此網路使用的 32 位元子網路遮罩。


Download ppt "ICMP RFC 792 Internet Control Message Protocol RFC 1256 ICMP Router Discovery Message."

Similar presentations


Ads by Google