IPv4 and IPv6 are network layer protocols that route packets between networks through multiple hops. The network layer addresses devices, routes packets, and interconnects different subnets. Routers use routing tables to forward packets towards their destination network based on the destination address. Fragmentation allows packets to be split into smaller pieces if their size exceeds the maximum transmission unit on a link. This allows packets to traverse heterogeneous networks with different MTU sizes.