IP and MAC Addressing
When you send data to a device on a different network, such as a friend's phone in another town, the data has to cross several networks to reach it. The data travels as packets, and each packet is addressed in two ways on its journey: with IP addresses between networks and with MAC addresses inside each local network (LAN).
Every packet carries a destination address and a source address. The destination address lets each device know where the packet is going next. The source means the receiving device knows who to reply to, so the reply gets back to the right computer.
When data is sent between networks, the packet is addressed with the destination IP address: the IP address of the device it is finally meant for. Routers read this address and forward the packet towards the destination network, network by network, until it arrives at the network the destination device is on.
Inside a LAN, delivery is done with MAC addresses. In the source LAN, the switch uses the MAC address of the router to pass the packet on to the router. At the other end, the router forwards the packet into the destination LAN, and the switch there uses the destination device's MAC address to deliver it to that device only.
For example, a tablet at a vet's surgery in Norwich (IP 80.4.19.133) sends an X-ray image to a server at a specialist centre in Leeds (IP 212.58.244.18). The surgery's switch forwards the packet to its router using the router's MAC address. The router sends it across the internet towards 212.58.244.18. When it reaches the specialist centre's network, a switch there uses the server's MAC address, such as 7C-19-E4-B2-0D-A5, to hand the packet over. The reply carries both addresses too, so it can find its way back.
MAC addresses alone cannot do this job: the tablet and the server are not on the same network or connected to the same switch, so a MAC address gives no clue about how to cross the internet. IP addresses carry the packet between networks; MAC addresses deliver it within each LAN.