ICMP (Internet Control Message Protocol) is used to send error and informational messages at the internet layer. ICMPv4 is used with IPv4 and ICMPv6 is used with IPv6. ICMP messages are divided into error messages, which report problems, and informational messages, which are used for testing and diagnostics. Both ICMPv4 and ICMPv6 define message types for common functions like echo requests, redirects, and indicating destination unreachability.