1 of 19

Layer 3 Protocols: IP and ICMP

NET-215

2 of 19

Function of a Zip Code

  • What do you think are some of the main functions of a zip code?

  • Addressing:
    • Limited geographic area that is efficient to serve by a post office
    • Address uniquely identifies that area
  • Mail Routing:
    • Codes are used within the postal system to forward mail to its next logical facility on the path to its destination

3 of 19

US Zip Code Zones

4 of 19

Function of Layer 3

The primary job of Layer 3 is delivering messages between devices – including those on different networks

In most data networks, IP (Internet Protocol) is the primary Layer 3 protocol

5 of 19

Internet Protocol- Important Functions

  • Addressing: Mechanism to identify both the network address, as well as a unique host address of a device interface
  • Routing/Indirect Delivery:
    • the final destination of a packet is often on a distant network
    • NIC to NIC – Layer 2 transmission - won’t work in that case
    • Therefore, the datagram must be delivered indirectly
      • Intermediary devices (routers) need to route the packet using IP addresses
  • Fragmentation and Reassembly:
    • Layer 1 (Physical) and Layer 2 (Data Link) have limits on maximum frame size
    • IP includes the ability to fragment IP datagrams into pieces
    • The receiving device uses the reassembly function to re-create the whole IP datagram.

6 of 19

IP Protocol Format/Header

  • So based on the function of IP, what do you think needs to be in the header?

  • Source and Destination IP Addresses

  • Fragmentation Info

  • Next Protocol

  • Plus some more…

7 of 19

IP Header

Other Fields of Interest:

Version: IPv4 or v6

Header Length: Multiply by 4 to get byte count

TTL: Time-To-Live…

8 of 19

Time To Live Field

  • Why do we need to be concerned about packets roaming forever?

  • Imagine the Postal Scenario
    • Letter is sent to an undefined zip code – 00789
    • Each postal sorting facility decides to send it to their “default” next facility - it could loop through the system forever
  • The same could happen with an IP packet

9 of 19

Prevent Packets from Roaming Forever?

  • TTL in IP Header

  • Value set when Datagram is created
  • 255 is the max

  • Deceased by one as it passes each router

  • If it gets to 0 – router discards
    • Discarding Router may send an ICMP TTL expired to sender

10 of 19

TTL in Capture

11 of 19

Different OS Default TTL

12 of 19

IP Support Protocols

While IP is the primary Layer 3 protocol:

  • Some additional protocols operate within Layer 3 to support IP

13 of 19

�ICMP

  • ICMP – Internet Control Messaging Protocol
    • IP Support Protocol
    • Designed as a health and maintenance protocol
    • Not intended to carry user data – just system messages

  • Ping commands typically use ICMP messages

14 of 19

Internet Control Message Protocol (ICMP)

  •  ICMP contains two message types:
    • messages used to report errors
    • messages used to obtain information

  • Echo Request and Echo Reply obtain information
    • used by the ping application to test connectivity
    • When a host receives an echo request message ICMP software on a host or router sends an echo reply that carries the same data as the request

  • Errors
    • Time Exceeded and Destination Unreachable report errors when a datagram cannot be delivered successfully
    • A destination is unreachable if no route exists to the address
    • A datagram times out if
      • either the TTL count in the header expires or
      • fragments of the datagram do not arrive before the timer expires

14

15 of 19

Internet Control Message Protocol

15

16 of 19

16

17 of 19

17

Internet Control Message Protocol (ICMP)

More information on Type and Codes

18 of 19

18

19 of 19

ICMP Error Messages

  • Again, ICMP used for informational messages (like Echo’s) as well as Error Messages

  • Time Exceeded and Destination Unreachable messages both report errors when a datagram cannot be delivered successfully
    • A destination is unreachable (Type 3) if no route exists to the address
    • A datagram times out if (Time Exceeded: Type 11)
      • either the TTL count in the header expires or
      • fragments of the datagram do not arrive before the timer expires