In a computer network, when we transfer data from one computer to another computer, we need the computers to be connected and communicated.
For successful communication, we need two primary things; IP address and MAC address. It may be confusing why we need both information to reach out to any computer or node in a network.
For instance, you can assume an IP address as an address of a particular location to send data. And, in a location, there could be several devices, so to identify a particular device, we need a MAC address.
Also, it would help if you remembered that both IP address and MAC address having unique codes in the network.
Further, we will learn how IP addresses and MAC addresses are different and look for these addresses in a device.
What is an IP address in a network?
An IP address is a unique address that helps to identify a device connected to a network.
Moreover, the IP address is assigned by your ISP (Internet Service Providers), or your administrator in a network can assign it.
Additionally, the assigned IP address can be static or dynamic in nature. It means that it will remain the same throughout your connected network, or it keeps changing after a certain period of time.
The IP address is present in the Network Layer of OSI and TCP/IP model.
Depending on the version of the IP address, it is divided into two types; IPv4 and IPv6.
IPv4 consists of 32 bits long IP addresses separated by dots, whereas IPv6 consists of 128 bits IP addresses, separated by semicolons (:).
For instance, 192.168.12.32 is an IPv4 address and 3EEF:FA32:21AB:7654:99EF:DC21:567F:DA89 is an IPv6 address.
Also, the IP address 127:0:0:1 is called localhost, which means it is reserved for each computer to communicate internally. So, the same machine can act as both client and server.
What is the MAC address?
MAC address is a unique hard-coded address of a device that differentiate from other devices in a network. It is also called a physical address or burnt-in address, or hardware address.
Moreover, it is provided by the Network Interface Card (NIC) manufacturer, which acts as a unique hardware identifier. The MAC address consists of a 48-bits address containing 6 pairs of hexadecimal digits (12 hexadecimal digits) or 3 groups of 4 hexadecimal digits. It is separated into either hyphen (-) or colons (:).
For example; 79:6E:56:32:45:34 or 79-6E-56-32-45-34.
Additionally, the first 24-bits of the MAC address represent vendor serial numbers, also called Organizationally Unique Identifier (OUI). And, the next 24-bits of the MAC address represents NIC serial number assigned by the manufacturer.
Also, the MAC address works on the Data Link layer of the OSI model or TCP/IP model.
How do IP address and MAC address work?
With a router or modem, there could be more than one device connected. So, the data can be sent to a particular device only when the MAC address is identified in a network.
Apart from differences, the IP address and MAC address work together using ARP (Address Resolution Protocol). It helps in mapping IPv4 address with network device’s MAC address and vice versa.
Differences between IP address and MAC address
MAC address is permanent, and IP address is dynamic
The MAC address assigned by the manufacturer is permanent, whereas the IP address assigned in a network can be dynamic in nature, which can change with time.
Restrict devices using MAC address
MAC address is permanent, so you can uniquely identify each device in a network connection with a router modem. If you want to put restrictions on certain devices in a network connection with a router, then you can deny access to the device.
But, you cannot do the same with an IP address. When the devices are connected with the router, then the router assigns an internal IP address. So, when the devices get disconnected and connected again, they are assigned a new internal IP address.
Therefore, filtering devices with the changing IP address is not possible.
Contains unique address structure
The MAC address contains a 48-bits hexadecimal address, whereas the IP address can be IPv4 or IPv6. The IPv4 contains a 32-bits integer address, and IPv6 contains a 64-bits hexadecimal address.
It belongs to a different layer of the OSI model.
In the OSI model, the MAC address belongs to the data-link layer (Layer 2), and the IP address operates in Network Layer (Layer 3).
Along with IP address and MAC address, protocols like DNS (Domain Name System) and DHCP (Dynamic Host Control Protocol) play an important role in a network.
DNS helps resolve human-readable domain names into machine-readable IP addresses, whereas DHCP has a mechanism to assign an IP address to all the devices in a network.