In the computer networking, effective communication and error handling are pivotal. The Internet Control Message Protocol (ICMP) plays a crucial role in these processes. This protocol underpins essential network tools like Ping and Traceroute, facilitating diagnostics and troubleshooting.

With the advent of IPv6, ICMP has evolved into ICMPv6, introducing enhanced functionalities and improved efficiency.

The TCP/IP suite provides error messages and informational messages when communicating with another IP device. These messages are sent using the Internet Control Message Protocol (ICMP), which operates at Layer 3 of the OSI model, the Internet layer of the TCP/IP model.

ICMP Commands: Ping and Traceroute

Ping is a network administration utility that employs ICMP Echo requests to determine the status of a distant host, measure the duration of message delivery to and from the target, and assess any loss of packets.

On the other hand, Traceroute is a command-line tool that maps the journey of a data packet from a source computer to a destination host. It reveals the sequence and duration of each hop along the path. Traceroute achieves this by dispatching data packets with incrementally increasing Time to Live (TTL) values, which dictate the maximum number of hops a packet may traverse before being discarded or returned.

ICMP messages, though often restricted for security reasons, include essential functionalities common to both ICMPv4 and ICMPv6:

  • Host reachability (the basis of the ping utility);
  • Destination or Service Unreachable;
  • Time exceeded.

Host Reachability: The local host sends an ICMP Echo Request. If the destination host is available, it responds with an Echo Reply.

Destination or Service Unreachable: When a packet cannot be delivered, a host or gateway sends an ICMP Destination Unreachable message to notify the source that the destination or service is unreachable.

Codes for ICMPv4 include:

  • 0 - Net unreachable (no route for the destination network in the routing table on the reporting router)
  • 1 - Host unreachable (host is not available on the subnet)
  • 2 - Protocol unreachable (process not running on the host)
  • 3 - Port unreachable (port not open on the host)

Some of the Destination Unreachable codes for ICMPv6:

  • 0 - No route to destination
  • 1 - Communication with the destination is administratively prohibited (e.g., firewall)
  • 2 – Beyond scope of the source address
  • 3 - Address unreachable
  • 4 - Port unreachable

Time Exceeded: If a router receives a packet and the TTL field in the IPv4 packet is decremented to zero, it discards the packet and sends a Time Exceeded message to the source host. In ICMPv6, this uses the IPv6 Hop Limit field instead of the TTL field.

ICMPv6: Enhanced Network Protocols

ICMPv6 offers new features and improved functionality not found in ICMPv4. ICMPv6 messages are encapsulated in IPv6 and include four new protocols as part of the Neighbor Discovery Protocol (ND or NDP).

ICMPv6 ND also includes the redirect message, which has a similar function to the redirect message used in ICMPv4.

ICMPv6 Router-to-Device Communication

Messaging between an IPv6 router and an IPv6 device, including dynamic address allocation, involves:

  • Router Solicitation (RS) message
  • Router Advertisement (RA) message

RA messages, sent by IPv6-enabled routers every 200 seconds, provide addressing information to IPv6-enabled hosts, including prefix, prefix length, DNS address, and domain name.

Hosts using Stateless Address Autoconfiguration (SLAAC) will set their default gateway to the link-local address of the router that sent the RA.

In computer networking, link-local addresses are valid only for communications within the subnetwork to which the host is connected.

IPv4 link-local addresses (APIPA) are from the address block 169.254.0.0/16, while IPv6 addresses are from the block fe80::/10.

An IPv6-enabled router also sends an RA message in response to an RS message.

ICMPv6 Device-to-Device Messaging

When a device is assigned a global IPv6 unicast or link-local unicast address, it may perform Duplicate Address Detection (DAD) to ensure the address is unique.

The device sends a Neighbor Solicitation (NS) message with its own IPv6 address as the targeted address. If another device on the network has this address, it responds with a Neighbor Advertisement (NA) message, notifying the sender that the address is in use. If no NA message is returned, the unicast address is considered unique and usable.

Address resolution is used when a device on the LAN knows the IPv6 unicast address of a destination but does not know its Ethernet MAC address. To determine the MAC address for the destination, the device will send an NS message to the solicited node address. The message will include the known (targeted) IPv6 address. The device that has the targeted IPv6 address will respond with an NA message containing its Ethernet MAC address.