error-reporting messages

Download Report

Transcript error-reporting messages

Network Protocols
Chapter 9 (TCPIP Suite Book):
Internet Control Message Protocol
version 4 (ICMPv4)
Copyright © Lopamudra Roychoudhuri
1
ICMP (Internet Control
Message Protocol)



The IP protocol has no error-reporting or errorcorrecting mechanism. What happens if something
goes wrong?
What happens if a router must discard a datagram
because it cannot find a router to the final
destination, or because the time-to-live field has a
zero value?
What happens if the final destination host must
discard all fragments of a datagram because it has
not received all fragments within a predetermined
time limit?
2
ICMP



The IP protocol also lacks a mechanism for host and
management queries.
A host sometimes needs to determine if a router or
another host is alive. And sometimes a network
manager needs information from another host or
router.
ICMP is assigned to provide error-reporting
messages and query messages.
3
ICMP

Companion to IP


What happens when errors occur in
delivering IP packets?


Network layer protocol, but encapsulated in IP
datagrams
ICMP messages are used for Error Reporting
What if a host needs more information about
the network?

ICMP messages are used for Status Queries
4
ICMP design
5
ICMP encapsulation
General format of ICMP messages
6
Error Reporting




One of the main responsibilities of ICMP is to report errors that
a router or a host may encounter when it processes an IP
packet.
However, ICMP does not correct errors, it simply reports them.
Error correction is left to the higher-level protocols.
Error messages are always sent to the original source because
the only information available in the datagram about the route
is the source and destination IP addresses.
ICMP uses the source IP address to send the error message to
the source (originator) of the datagram includes header of
error-causing packet.
7
Error Report Encapsulation
ICMP data contains:
•IP header of the
original packet that
got the error
•First 8 bytes of IP data
of original packet
•contains the port
information from
transport layer (TCP
or UDP)
•So that source can
inform the transport
protocols about the
error
8
ICMP Messages
Error-reporting messages
Query messages
9
ICMP Type Messages
10
ICMP Codes
Type
Code
Description
0
0
Echo Reply
3
0
Network Unreachable
3
1
Host Unreachable
3
2
Protocol Unreachable
3
3
Port Unreachable
3
6
Destination Network down
3
7
Destination host down
4
0
Source quench
5
0
Redirect for network
5
1
Redirect for host
8
0
Echo reply
11
0
TTL equals 0 during transit
11
1
TTL equals 0 during reassembly
12
0
IP header bad (catchall error)
12
1
Required options missing
11
Error Reporting Messages

Destination Unreachable (Type 3):



IP packet destination does not exist or cannot be reached
One case is Fragmentation required, but DF bit is set
Source quench (Type 4):



There is no communication between the source host, which
produces the datagram, the routers, which forward it, and
the destination host, which processes it. The lack of flow
control can create congestion in routers or the destination
host.
There is no flow-control or congestion-control mechanism in
the IP protocol.
A source-quench message informs the source that a
datagram has been discarded due to congestion in a router
or the destination host. The source must slow down the
sending of datagrams until the congestion is relieved.
12
Error Reporting Messages

Time Exceeded (Type 11):
 Whenever a router decrements a datagram with a time-tolive (no. of hops) value to zero, it discards the datagram and
sends a time-exceeded message
 All fragments did not arrive before fragment reassembly
timeout.
 Parameter Problem (Type 12):


If a router or the destination host discovers an ambiguous
or missing value in any field of the datagram, it discards the
datagram and sends a parameter-problem message back to
the source.
A parameter-problem message can be created by a router or
the destination host.
13
Error Reporting Messages

Redirect (Type 5):



When a router needs to send a packet destined for another
network, it must know the IP address of the next
appropriate router (routing table).
ICMP Redirect is a mechanism for routers to convey routing
information to hosts. The message informs a host to update
its routing information (to send packets on an alternative
route).
A redirection message is sent from a router to a host on the
same local network.
14
ICMP Query Messages

Echo Request / Reply (Type 8 and 0)




Echo-request and echo-reply messages can be used by
network managers to check the operation of the IP
protocol. They are designed for diagnostic purposes.
To determine whether two systems can communicate
with each other
Used for “ping”
Time Stamp Request / Reply (Type 13 and
14)


Timestamp-request and timestamp-reply messages can
be used to calculate the round-trip time between a
source and a destination machine even if their clocks
are not synchronized.
“ping” with timestamps (ping –s)
15
ICMP Query Messages

Address-Mask Request and Reply (Type 17
and 18):



A host may know its IP address, but it may not know
the corresponding mask.
To obtain its mask, a host sends an address-mask
request to a router on the LAN. If the host knows the
IP address of the router, it sends the request directly to
the router. If it does not know, it broadcasts the
message.
Address mask request and reply messages are not used
today because their duties are done by Dynamic Host
Configuration Protocol (DHCP).
16
ICMP Query Messages

Router Solicitation and Advertisement
(Type 10 and 9):


When a host wants to send data to a host on another
network needs to know the address of routers
connected to its own network. Also, the host must
know if the routers are alive and functioning.
A host can broadcast (or multicast) a router-solicitation
message. The router(s) will broadcast their routing
information using the router solicitation-advertisement.
17
Ping and Traceroute

Ping



The source host sends ICMP echo-request messages (type:
8, code:0) to find if a host is alive and responding.
Defines the number of data bytes as X and the total number
of bytes as Y
Traceroute



Trace route from source to destination
Uses two ICMP messages, time exceeded and destination
unreachable to find the route of a packet.
3 measurements taken to get an average Round Trip Time
(RTT)
18
The traceroute operation
A sends to B 3 ICMP requests with TTL=1
R1 decrements TTL to 0, discards the packet,
sends ‘time exceeded’ ICMP msg to A with its own IP
R2 decrements TTL to 0, discards the packet,
sends ‘time exceeded’ msg to A with its own IP
A then sends to B
3 ICMP requests with TTL=2
B sends ICMP reply
A sends to B
3 ICMP requests with TTL = n
19
A traceroute example from my home computer
C:\>tracert www.unige.ch
Destination IP address
Tracing route to silene.unige.ch [129.194.9.50]
over a maximum of 30 hops:
1 3 ms 1 ms 1 ms 192.168.1.1
2 3 ms 1 ms 1 ms 192.168.0.1
3 47 ms 102 ms 102 ms adsl-99-149-199-254.dsl.chcgil.sbcglobal.net
[99.149.199.254]
4 121 ms 101 ms 101 ms 99.164.168.1
5 84 ms 101 ms 80 ms ppp-151-164-55-170.eulstx.swbell.net [151.164.55.170]
6 127 ms 101 ms 101 ms 12.122.81.93
7 91 ms 46 ms 53 ms 192.205.34.198
8 145 ms 101 ms 102 ms nyk-bb1-link.telia.net [213.155.131.240]
9 229 ms 204 ms 204 ms ldn-bb1-link.telia.net [80.91.248.202]
10 211 ms 204 ms 204 ms prs-bb1-link.telia.net [80.91.254.209]
11 225 ms 205 ms 203 ms zch-b1-link.telia.net [80.91.249.112]
12 224 ms 204 ms 204 ms dante-01287-zch-b1.c.telia.net [213.248.79.190]
13
14
15
16
17
18
222 ms
221 ms
219 ms
*
*
*
*
247 ms
203 ms
204 ms
204 ms
*
*
202 ms
Trace complete.
204 ms swiZH2-10GE-1-3.switch.ch [130.59.36.130]
204 ms swiCE3-10GE-1-1.switch.ch [130.59.36.1]
205 ms swiGE2-10GE-3-1.switch.ch [130.59.37.182]
Request timed out.
Request timed out.
203 ms silene.unige.ch [129.194.9.50]
20
Ipconfig /all from my home computer
C:\Users\7Enterprise>ipconfig/all
Windows IP Configuration
Host Name . . . . . . . . . . . . : 7Enterprise-PC
Primary Dns Suffix . . . . . . . :
Node Type . . . . . . . . . . . . : Hybrid
IP Routing Enabled. . . . . . . . : No
WINS Proxy Enabled. . . . . . . . : No
Wireless LAN adapter Wireless Network Connection:
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Realtek RTL8723AE Wireless LAN 802.11n PC
I-E NIC
Physical Address. . . . . . . . . : 20-68-9D-49-F3-CD
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
Link-local IPv6 Address . . . . . : fe80::d4a7:e6b1:acaa:2fef%14(Preferred)
IPv4 Address. . . . . . . . . . . : 192.168.1.6(Preferred)
My IP address
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Lease Obtained. . . . . . . . . . : Tuesday, November 05, 2013 3:58:30 PM
Lease Expires . . . . . . . . . . : Thursday, November 07, 2013 11:18:47 PM
Default Gateway . . . . . . . . . : 192.168.1.1
DHCP Server . . . . . . . . . . . : 192.168.1.1
DHCPv6 IAID . . . . . . . . . . . : 354445469
DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-18-CC-E0-83-4C-72-B9-A6-B5-F4
DNS Servers . . . . . . . . . . . : 192.168.1.1
0.0.0.0
21
To begin with, I see 3 identical ICMP echo requests from my machine to
www.unige.ch (129.194.9.50) with TTL=1 (frames 19, 21, 23)
• the intermediate router 192.168.1.1 replies with TTL exceeded error message 3 times (20, 22, 24)
22
Next 3 identical ICMP echo requests from my machine to www.unige.ch
(129.194.9.50) with TTL=2 (frames 41, 43, 45)
• the intermediate hop 192.168.0. 1 replies with TTL exceeded error message (frames 30, 32, 34)
approx. 3 ms later (Frames 29 & 30: 11.698475 – 11.695116=.003359 s = 3ms)
23
This goes on for all the intermediate routers, till the ping requests reach
the host 129.194.9.50 itself with TTL = 18 (frames 218, 220, 222)
• the host 129.194.9.50 replied with ICMP ping reply (frames 219, 221, 223) approx. 204 ms
later (Frames 222 & 223: 72.693396 – 72.489557=.203839 s = 204 ms)
24