MAC Address vs. IP Address: Key Differences and Practical Uses
The internet is one of the marvels of the century. It allows us to stay connected at a global level by using various devices that are convenient for us.
Whether it be a mobile phone, laptop, desktop, or even appliances, we can connect to the internet wherever and whenever we like.
One of the core technologies required for the function of the Internet is the IP address. If you have studied IP addresses, you may have also stumbled upon MAC addresses.
At a glance, it seems like both types of addresses do the same thing–identify a device when connected to the internet. However, they have their differences. Today, we will check out these two types of addresses, their differences, and their uses.
What is the Difference Between MAC Address and IP Address
Both IP address and MAC address work on the OSI model of networking. They also work on different layers. But let’s take a deeper look into their differences.
MAC Address
The MAC address is also called the physical address of a device. The Acronym MAC stands for Media Access Control. All devices that can connect to the internet have a Network Interface Card (NIC. This is a physical circuit that holds the infrastructure necessary to communicate over the Internet.
The MAC address is the unique identifier of that NIC. It is a 48-bit hexadecimal number. The first half (24 bits) is called the OUI number, and the second half is called the serial number. Together, they identify the device.
The OUI number identifies the company that assigned the MAC address, and the serial number identifies the unique device. MAC addresses are always unique. No two MAC addresses can be the same. However, two devices can have the same OUI number. You can do a MAC address lookup with a tool to see which company assigned your device’s MAC address.
Another thing you need to know about the NIC is that only one of them exists for each type of network connection protocol. For example, If your computer has an ethernet port and a WiFi antenna, then it has two NICs. If you add an external WiFi port on top of that, then that computer has three NICs.
So, three NICs means there are three MAC addresses too. However, this is never a problem because only one MAC address is used at a time.
Here is a summary of the MAC address characteristics.
- It is a physical address. It identifies the actual device during internet communication.
- It is permanent. It cannot be changed. The MAC address of a NIC is physically tied to it.
- Used to identify a device on a local network. The way the internet works is that there are access points that connect to the rest of the internet. The access points hide the devices behind them from the net. They use MAC addresses to route the data from the Internet to the intended device.
- Works on layer 2 of the OSI model. Layer 2 is called the data link layer.
IP Address
IP addresses are 32-bit decimal numbers (IPv4) or 128-bit hexadecimal numbers (IPv6). It is used to find a device on the internet. For example, all websites that you visit are hosted on a server. To visit the website, your computer must know the IP address of the server.
The complex routing system of the internet ensures that you can find the IP address of a public resource easily. So, how is it different from a MAC address?
- It is not a physical address. The IP address is not tied to the hardware. It is assigned at the software level.
- It is not permanent. Since the IP address is assigned at the software level, it can be changed. In fact, your public IP address changes between different sessions all the time.
- It is used to identify a device between different networks. Unlike a MAC address, which identifies devices in a local network, IP addresses are used to identify devices between different Let’s say you are trying to connect two local networks together. The communication between the two networks will use IP addresses, while communication within the same network will use MAC addresses.
- Works on layer 3 of the OSI model. This layer is called the Network Layer and uses a bunch of networking protocols like ARP, IP, and ICMP, to name a few.
How Do MAC and IP Address Work
The difference between the two types of addresses becomes more understandable when you take a look at their function and how they work.
The above-given figure will help you understand the uses and differences between MAC address and IP address.
First, let us understand what everything means.
- The dotted circles are networks. You can see there are two small networks with three devices each. These networks are labeled LAN.
- Then, we have two access points. These are the routers to which the devices in the LAN connect to access the internet.
- Each router has an IP address. This is known as the public IP address. This is the address that is visible to anyone outside the LAN. For example, websites that may request your IP to find your IP location will only get the public IP instead of the MAC address or the private IP of a device in the LAN.
So, let’s say MAC 1 wants to send MAC 4 a file. MAC 1 will go to its access point and input the IP address of MAC 4’s access point. When MAC 4’s access point receives the file through the internet, it will know that the file is for MAC 4 because the file came through a specific port. The sender knows the specific port because of a process called NAT Traversal.
The receiving access point will then check which MAC address the port is assigned to and send the information to that device.
So, you can see how IP addresses help find the local network in which the recipient device is present and how MAC addresses help to identify that device.
Conclusion
So, there you have it, the difference between an IP address and a MAC address. They are both important aspects of the OSI networking model. IP addresses work on layer 3, while MAC addresses work on layer 2. MAC addresses are unique and specific to one device, while IP addresses are not. They are not interchangeable and have their own roles to play. So, now you know the difference between the two types of addresses.