IP (Internet Protocol) and MAC (Media Access Control) addresses are two distinct types of addresses used in computer networking.
IP addresses are assigned to devices on a network to identify and communicate with them over the internet or local network. They are numerical addresses that are assigned to devices by a Dynamic Host Configuration Protocol (DHCP) server or by manual configuration. IP addresses can be either dynamic or static, and they can change over time.
On the other hand, MAC addresses are unique identifiers assigned to network interfaces of devices by their manufacturers. They are used to identify devices within a local network, such as a LAN (Local Area Network). MAC addresses are usually fixed and cannot be changed unless the device’s network interface is replaced.
The main difference between IP and MAC addresses is that IP addresses are used to identify devices on a network, while MAC addresses are used to identify network interfaces. IP addresses are used for routing and transmission of data packets over the internet, while MAC addresses are used for local communication within a network.
IP addresses and MAC addresses are both used in modern networks for any communication. It could be on a small local network or a wide area network like the Internet.
Are they different? Do we need both?
Yes and yes!
Here’s why.
If you are here for a quick super-simple answer, IP addresses are like your real-world house addresses, and MAC addresses are the rooms in these houses.
Unit 7, Grafton Pl, Chelmsford, Essex, CM2 6TG
If you send a letter from any place on Earth to this address, it will eventually get to our office.
IP addresses work the same way – they are unique worldwide.
The MAC addresses, on the other hand, are like rooms in your house. The original sender doesn’t know how many rooms there are and which one is yours – they don’t need to know that. When you finally get that delivery from an online shop, your mum will take the box to your room.
OSI model
If you want to go a bit more technical, let’s quickly have a look at one of the fundamental concepts of computer networking – the OSI model.
Open Systems Interconnection model (OSI) model is a conceptual framework that standardises the communication functions of computer systems. OSI model consists of 7 abstract layers each representing a specific function
7. | Application | ||
6. | Presentation | ||
5. | Session | ||
4. | Transport | ||
3. | Network | IP | Packets |
2. | Data Link | MAC | Frames |
1. | Physical |
Here’s a quick example of how it works.
When you send a message to your friend, the data that you’re sending starts at the top of the OSI model – the application layer.
As the data moves down each layer, it gets processed by different protocols getting everything prepared.
Let’s go back to the same online shop delivery analogy.
When the order gets processed, it collects all the necessary data about you and the items you have ordered.
The goods are then packaged, and your address is attached to it.
The package is ready to go.
The same thing happens here.
English gets converted to 1s and 0s. Source and destination IP addresses are specified. Then source and destination MAC addresses are added to the payload and, eventually, it goes out the wire.
The inverted process then occurs on your friend’s computer when they receive the message – the envelope gets unpacked, 1s and 0s turn back into English, and they get a new message notification.
Simple, right?
MAC address
MAC addresses are sometimes called physical addresses. They are 48bit long and consist of 6 blocks of 2 hexadecimal digits 4 bits each. These addresses are similar to serial numbers and are assigned by hardware manufacturers.
The first 24 bits are unique to manufacturers, and the last 24 bits are Network Interface Card (NIC) specific.
Each NIC attached to a device will have its own MAC address. A desktop PC will usually have just one. Laptops will mostly have two (one for the ethernet cable and another one for wireless). A 48-port network switch will have a MAC address for each port, plus a base MAC address (49 addresses in all) It is crucial to have a unique MAC address on each NIC for successful layer 2 communication.
Even when you try communicating to a computer on a local network using its IP address, the communication will still be established using MAC addresses, and that’s when the Address Resolution Protocol (ARP) comes into play.
Devices on a LAN tend to keep an ARP table with a list of MAC and IP addresses of other devices on the local network. When you try pinging other machine using its IP address, it will be translated to a MAC address using the ARP table, and then the packets will go out the wire. The network devices responsible for delivering layer 2 frames to the destination are called Switches.
MAC addresses are only used for communication on Local Area Networks (LANs), so if you want to access a remote network or the Internet, you need an IP address.
IP address
IP addresses, or as they’re also sometimes called logical addresses, reside on layer 3 of the OSI model.
These addresses are unique on the Internet, which make communication across the globe a possibility.
You need to install a router on your local network, which will act as a gateway for all your local devices. The layer 2 frames are turned into layer 3 packets when they leave the gateway.
There are currently two types of IP addresses:
IPv4 – the most widely used addressing standard was invented in the 1970s when people couldn’t imagine what computer networks would grow into. IPv4 addresses are 32bit long and consist of 4 so-called octets of 8bits separated by ‘.’s. For example, Wikipedia’s website IP is 208.80.152.201.
For example:
This setup means we can only have 4,294,967,296 of unique IPv4 addresses. Sounds like a lot, but really isn’t.
We ran out of IPv4 addresses a long time ago.
In fact, over 22 billion devices connect to the internet, all needing an IPv4 address.
We still keep using them because the transition to the new IPv6 system is not a simple one-day job.
While the world is slowly adopting the new IPv6 standard, people came up with things like private IPv4 addresses and Network Address Translation (NAT) protocols to give IPv4 a slightly longer life.
IPv6 – developed by Internet Engineering Task Force (IETF) in 1998, the new IPv6 addressing solves the problem of a small number of possible unique addresses raising the bar all the way to 2128 addresses – all thanks to 8 blocks of 4 hexadecimal numbers.
For example, Facebook’s IPv6 in Ireland is 2a03:2880:2110:df07:face:b00c::1
IP Address |
MAC Address |
Stand for Internet Protocol | Stands for Media Access Control |
Assigned to each device on network | Unique Identifier |
Assigned by ISP or Admin | Assigned to NIC by Manufacturers |
IPv4 32 bits (4 bytes) IPv6 128 bit (16 bytes) |
48 bits (6 bytes) |
Layer 3 | Layer 2 |