IP address and MAC address compared
Categories: networks network hardware
What is the difference between an IP address and a MAC address, and why do we need both?
The answer is that, although they both identify a device on a network, they are used at different stages to control how data is transferred over a network.
An analogy - posting a letter
One analogy is to consider posting a letter to someone. You would mark the envelope with the person's name and address.
The address helps the postal service find the right building. An address is structured - it tells the postman the country, town, district, street and house number, so that they can efficiently route the letter to exactly the right place.
Once the letter arrives through the letter box, the name becomes important. It needs to get to the right person within the house.
Imagine if you posted a letter with a name but no address? How would the postman know where to deliver a letter to John Smith, who could be anywhere in the world? It would be very difficult.
What if you posted a letter with an address but no name? Well, the letter would arrive at the right house, but how would anyone know who it was for? If your house only gets a few letters per day you might figure it out, but when it comes to millions of packets of data over the Internet it really needs to be ''automatically'' sent to the right device.
IP address
In this analogy, the house address is like the IP address. IP addresses are structured - for example, the first part of the address might let you know what country or company the data is destined for. The Internet can efficiently sent data packets to the correct place. In the case of a home network, all the data will arrive back at your Internet Network router.
MAC address
The MAC address is like the name on an addressed envelope. Once data arrives at the router, the MAC address tells the router which actual device has requested the data, and the router automatically sends the packets of data to the correct device.
The IP address and MAC address operate at different levels in the [[TCP/IP layer model]]. One advantage of this is that the IP address is independent of the actual computer. So if you website lives at a particular fixed IP address, and the computer breaks, you can replace the computer without the rest of the Internet needing to know anything about it. The MAC address changes, but the new computer is still connected to the same IP address.
See also
Sign up to the Creative Coding Newletter
Join my newsletter to receive occasional emails when new content is added, using the form below:
Popular tags
555 timer abstract data type abstraction addition algorithm and gate array ascii ascii85 base32 base64 battery binary binary encoding binary search bit block cipher block padding byte canvas colour coming soon computer music condition cryptographic attacks cryptography decomposition decryption deduplication dictionary attack encryption file server flash memory hard drive hashing hexadecimal hmac html image insertion sort ip address key derivation lamp linear search list mac mac address mesh network message authentication code music nand gate network storage none nor gate not gate op-amp or gate pixel private key python quantisation queue raid ram relational operator resources rgb rom search sort sound synthesis ssd star network supercollider svg switch symmetric encryption truth table turtle graphics yenc