Transcript ICMP

ICMP
CST 415
4/6/2016
CST 415 - Computer Networks
1
Topics
• ICMP Defined
• ICMP Packet Generation
• ICMP Packet Structure
4/6/2016
CST 415 - Computer Networks
2
Problem Definition
• IP defines a set of host to host services for
interconnected networks.
– These services are unreliable
– Connectivity is provided through gateways and routers
• Gateways and routers must have dynamic
behavior.
– Network traffic will vary
– Behavior will change depending on the dynamic
Internet configuration.
– Routers and gateways will dump packets they cannot
deal with.
4/6/2016
CST 415 - Computer Networks
3
Problem Definition
• Since IP is unreliable, we can expect packets
to be lost.
• What happens to the system when:
– A host is removed from the network?
– A router is removed from the network?
What are the ramifications of ignoring
problems in datagram related message
delivery?
4/6/2016
CST 415 - Computer Networks
4
ICMP Defined
• Routers need a way to communicate back to
host computers when a problem arises.
• To do this, a protocol has been defined
(RFC 792).
Internet Control Messaging Protocol
4/6/2016
CST 415 - Computer Networks
5
ICMP Defined
• ICMP was defined as an error reporting
mechanism.
• When an error is encountered, ICMP is used
to allow a router to report the error to the
original source of the packet.
• The originator of the datagram can then
make a decision on how to deal with the
problem.
4/6/2016
CST 415 - Computer Networks
6
ICMP Defined
ICMP General Operation
ICMP provides a feedback mechanism when an IP message is sent. In this example, device A sends an IP datagram to
device B. When it gets to router R3 a problem of some sort is detected, dropping the datagram. R3 sends an ICMP
message back to A to tell it that something happened, hopefully with enough information to let A correct the problem.
R3 can only send the ICMP message back to A, not to R2 or R1.
4/6/2016
CST 415 - Computer Networks
7
ICMP Packet Generation
ICMP will be sent when:
• A network destination is unreachable.
• A host destination is unreachable.
• A Protocol unreachable.
• A Port unreachable.
• Packet fragmentation failure.
• Source route failure.
4/6/2016
CST 415 - Computer Networks
8
ICMP Packet Generation
ICMP will be sent when:
• A Packet is killed due to timeout.
• IP packet parameter problem.
• A router needs to slow down the traffic
coming into it.
• A router needs to inform another router to
send traffic to a different router.
4/6/2016
CST 415 - Computer Networks
9
ICMP Packet Generation
ICMP will be sent when:
• Echo request/reply (e.g. ping).
• Timestamp request/reply
• A router needs to get information from
another router.
4/6/2016
CST 415 - Computer Networks
10
ICMP Packet Format
The ICMP packet is encapsulated inside an IP
packet.
ICMP
IP
802.3
4/6/2016
CST 415 - Computer Networks
11
ICMP Packet Format
There are 15 different types of ICMP packet.
Each type of ICMP packet starts with the same fields:
– Type – 8 bits : Defines the type of this ICMP
packet.
– Code – 8 bits : Depending on the type, this field
provides further information about the packet.
– Checksum – 16 bits : The 16 bit checksum for
the ICMP packet header + data.
4/6/2016
CST 415 - Computer Networks
12
ICMP Packet Format
The type field is interpreted as:
Type (decimal)
4/6/2016
Meaning
0
Echo Reply
3
Destination Unreachable
4
Source Quench
5
Redirect (change route)
8
Echo Request
9
Router Advertisement
10
Router Solicitation
11
Datagram time expire
12
Datagram parameter problem
13
Timestamp Request
14
Timestamp Reply
15
Information Request
16
Information Reply
17
Address Mask Request
18
Address Mask Reply
CST 415 - Computer Networks
13
ICMP Packet Format
Echo Request/Reply (Ping):
• Used for debugging connections.
• Host or router sends a Ping request.
• The destination (the “pingee”) sends back
a response.
4/6/2016
CST 415 - Computer Networks
14
ICMP Packet Format
• Type – 8: echo request 0: echo reply
• Code – 0 (not used)
• Identifier – The ID of this ping request (used to
match the ping response).
• Sequence Number – In a multiple ping, the ping
packet in the ping sequence.
– Could be used to measure percent packet loss.
• Optional Data – Any data sent in the request will
be sent back in the response.
4/6/2016
CST 415 - Computer Networks
15
ICMP Packet Format
Destination Unreachable Report:
• Used by a router when it cannot forward a
datagram.
• After the ICMP message is sent back, the router
will dump the undeliverable datagram.
4/6/2016
CST 415 - Computer Networks
16
ICMP Packet Format
The code field is interpreted as:
Code Value
4/6/2016
Meaning
0
Network Unreachable
1
Host Unreachable
2
Protocol Unreachable
3
Port Unreachable
4
Fragmentation needed and DF flag set
5
Source Route Failure
6
Destination Network Unknown
7
Destination Host Unknown
8
Source Host Isolated
9
Communication with network administratively prohibited.
10
Communication with host administratively prohibited.
11
Network unreachable for requested type of service.
12
Host unreachable for requested type of service.
CST 415 - Computer Networks
17
ICMP Packet Format
• Type – 8: echo request 0: echo reply
• Code – 0 (not used)
• Identifier – The ID of this ping request (used to
match the ping response).
• Sequence Number – In a multiple ping, the ping
packet in the ping sequence.
– Could be used to measure percent packet loss.
• Optional Data – Any data sent in the request will
be sent back in the response.
4/6/2016
CST 415 - Computer Networks
18
ICMP Packet Format
• Routers are just special purpose computing
devices with:
– Limited physical resources
» Memory
» Processor cycles
– Limited bandwidth
• Routers overwhelmed by datagram traffic
are called “congested”.
4/6/2016
CST 415 - Computer Networks
19
ICMP Packet Format
Source Quench:
• Used by a router to tell a host sending it datagrams to
“shut up!”.
• The host computer will slow down sending of to the
router until it no longer receives Source Quench.
• When this occurs, the host will begin increasing
datagram traffic.
4/6/2016
CST 415 - Computer Networks
20
ICMP Packet Format
• Type – 4
• Code – 0 (not used)
• Header of the offending datagram plus the
first 64 bits of the offending data payload.
4/6/2016
CST 415 - Computer Networks
21
ICMP Packet Format
Route Change Request:
– A router may need to request that a host send
to a different router.
4/6/2016
CST 415 - Computer Networks
22
ICMP Packet Format
Route Change Request:
• Host computer typically have minimal information
related to packet routing.
• After a host machine boots, a router may need to inform
a host machine of route configuration changes.
• Used by a router to tell a host to send traffic to a different
router.
4/6/2016
CST 415 - Computer Networks
23
ICMP Packet Format
• Type – 5
• Code – 0 to 3
• Router Internet Address – The IP address of
the router that the host should use instead of
“this” router.
• Header of the redirected datagram plus the
first 64 bits of the offending data payload.
• The datagram being re-routed will be
dumped.
4/6/2016
CST 415 - Computer Networks
24
ICMP Packet Format
The Route Change Request code field is interpreted
as:
Code Value
4/6/2016
Meaning
0
Redirect datagrams for the Network
1
Redirect datagrams for the originating Host.
2
Redirect datagrams for the Type of Service and the Network.
3
Redirect datagrams for the Type of Service and the Host.
CST 415 - Computer Networks
25
ICMP Packet Format
Circular or Long Route Detection:
• The Internet is unstable because of message latency
– There is no way to detect global state at any given point in time.
– Why?
• This inherent instability can bring about routing cycles.
• If a datagram enters a routing cycle, it will pass endlessly
from one router to the next in the cycle.
4/6/2016
CST 415 - Computer Networks
26
ICMP Packet Format
• Type – 11 (Time Exceeded)
• Code –
– 0 : Time-to-live count exceeded (i.e. was
decremented to 0).
– 1 : Fragment reassembly time exceeded.
• Header of the dumped datagram plus the
first 64 bits of the offending data payload.
• The datagram timed-out will be dumped.
4/6/2016
CST 415 - Computer Networks
27
ICMP Packet Format
Parameter Problem:
• Datagrams can have any other of ailments that plague the
digital information realm.
• The Parameter Problem ICMP packet is an attempt to
inform of other packet ailments.
• Bad packets will be dumped.
4/6/2016
CST 415 - Computer Networks
28
ICMP Packet Format
• Type – 12 (Parameter Problem)
• Code –
– 0 : General Problem
– 1 : A required option is missing (i.e. security)
• Pointer – The octet in the datagram that
caused the problem.
• The dumped datagram IP header plus 64 bits
of the datagram.
4/6/2016
CST 415 - Computer Networks
29
ICMP Packet Format
Clock Synch and Transit Time Estimate:
• In large scale distributed systems, clock synchronization
is essential.
• To handle this synchronization, a host can solicit a
timestamp from another machine on the network.
4/6/2016
CST 415 - Computer Networks
30
ICMP Packet Format
• Type – 13 (Request), 14 (Reply)
• Code – 0
• Identifier/Sequence Number – Used to associate
requests with replies.
• Originate Timestamp – The time the request
packet was sent.
• Receive Timestamp – The time the request packet
was received at the destination.
• Transmit Timestamp – The time the response
packet was sent back.
4/6/2016
CST 415 - Computer Networks
31
ICMP Packet Format
Obtaining a subnet mask:
• When subnet addressing is being used, a host must
obtain the correct mask from the router.
• A host must be able to determine what router to send a
packet to, depending on the subnet mask.
4/6/2016
CST 415 - Computer Networks
32
ICMP Packet Format
• Type – 17 (Request), 18 (Reply)
• Code – 0
• Identifier/Sequence Number – Used to
associate requests with replies.
• Address Mask – The subnet mask that a
router will use for routing the packet.
4/6/2016
CST 415 - Computer Networks
33
ICMP Packet Format
Router Discovery:
• To send datagram packets to other networks on the Internet, a host
must know what router to send their datagrams.
• Broadcast the router discovery packet on the LAN, the routers will
respond with addressing information for the host.
4/6/2016
CST 415 - Computer Networks
34
ICMP Packet Format
• Type – 9
• Code – 0
• Num Addrs – The number of address/precedence
fields in the packet.
• Addr Size – The time the request packet was sent.
• Lifetime – The amount of time this router will
support this connection ( typically 30 minutes).
• Router Addr “n” – The IP address of a router.
• Preference level “n” – A twos compliment value
indicating the “desireability” for this router.
4/6/2016
CST 415 - Computer Networks
35
ICMP Packet Format
Router Solicitation:
• When a host machine boots, it must immediately
discover the routers it can communicate with.
• This is done by broadcasting a Router Solicitation on the
network.
• When a router receives a solicitation message, it will
send back a normal router advertisement packet.
4/6/2016
CST 415 - Computer Networks
36