IPv4 (Internet Protocol version 4)
What it is for
Ethernet can only address within one link -- past that cable it knows no route.
IPv4 gives each machine a location-dependent address and forwards hop by hop toward the destination subnet using a routing table.
★★ The difference in one line: a MAC is who you are, an IP is where you are.
Two things only it can do
★★★ (1) TTL: decremented by every router and dropped at zero. An Ethernet header has no such field, which is why layer 2 needs STP while layer 3 prevents loops inherently.
★★★ (2) Fragmentation: when a link's MTU is too small the packet is split, and the destination host reassembles it (never an intermediate router).
★ Common misconceptions
★★★ "TTL is a time" -- it is called Time To Live but it counts hops. traceroute works by deliberately setting TTL to 1, 2, 3... to force each hop to reveal itself.
★★ "The header checksum protects the data" -- it covers the header only, not the payload, and must be recomputed every hop because the TTL changed.
★★ "Fragmentation is free" -- losing one fragment retransmits the whole packet, which is why modern practice uses PMTUD to avoid it.