What is the difference between MAC address and IP address?
In computer networks, all the network devices can connect and communicate with each other. But a question always arises in our mind that how one device will uniquely identify the other device in the network. This can be possible only with the help of the MAC and IP addresses. Now, again there is a confusion between these two. So, before defining them, let us first take an example to explain them.
For Example, if someone has to send a courier to some other person. The sender has to specify two things about the receiver in order to successfully send the courier. The two things are - Receiver's address(it may contain house number, street, city, state, and pin code), and the receiver's name(in order to specifically identify the right person to deliver the courier). If we correlate this example in networking, then the IP address will be the address of the network connection in which multiple devices can be present, and the MAC address will be the address of specific nodes, where we want to deliver the data.
We'll learn about these two addresses in detail. We'll also learn the dissimilarities between them. Now let us see about them one by one.
IP Address(Internet Protocol Address)
An IP address is an address that uniquely identifies a network connection. It is termed as the 'Logical Address' which is provided to a connection in a network.
IP addresses are generally provided by the administrator of the network or the Internet Service Providers(ISP). It can be static or dynamic in nature. It may be temporary and keep on changing each time whenever a device connects to different networks. IP addresses are available in binary form. It is mainly used in routing operation as it specifically identifies a network connection. It is used in the network layer of the OSI or TCP/IP reference models.
There are mainly two types of IP addresses:
- IPv4(Internet Protocol Version 4): IPv4 is a 32-bits address. This address is available in decimal form along with dots(.) in between. For Example - 192.168.0.11. The header field of the IPv4 is 20 bytes, and the checksum bits are present in the header for error control. The IPsec support(for security feature) is optional in IPv4. The optional fields are also available in the IPv4 addressing. It supports a packet size of up to 576 bytes. The IPv4 addressing can be used for Multicasting and Broadcasting the data packets.
- IPv6(Internet Protocol Version 6): IPv6 is a 128-bits address. This address is available in hexadecimal form along with semi-colons(:) in between. For Example: 2FFE:F300:0213:AB01:0132:7289:2134:ABDC. The header field of the IPv6 is 40 bytes, but the checksum bits are not present in the header file. The IPsec support(for security feature) is mandatory in IPv6. The optional fields are not also available in IPv6 addressing. It supports a packet size of up to 1280 bytes. The IPv6 addressing can not be used for broadcasting.
MAC Address(Media Access Control Address)
MAC address is the address that uniquely identifies a node on the network. It is also called the physical address, or the Burnt-In address, or the software address. The MAC address is provided by the manufacturer of the NIC(Network Interface Card). It is embedded into the hardware and remains constant for that device.
MAC is a 48 bits address which either contains 6 groups of 2 hexadecimal digits, or 3 groups of 4 hexadecimal devices. These hexadecimal digits can be separated either by hyphens(-) or colons(:). For example: 23-AB-CD-EF-56-78, OR 23AB:CDEF:5678. The 48 bits MAC address has two parts of 24 bits each. The first 24 bits represent the OUI(Organization Unique Identifier), and the next 24 bits represent the vendor's specific information. The MAC address works on the Data-Link Layer of the OSI or TCP/IP reference models.
Following are the dissimilarities between the MAC and IP address:
- Purpose: IP address is mainly used to identify the connection of a node on the network, while the MAC address is used to identify the unique address of that node.
- Address Type: The IP address is a software-based or logical address, while the MAC address is a hardware-based, burnt-in, or physical address.
- Address Provider: The IP address is provided by the administrator of the network, DHCP(Dynamic Host Configuration Protocol), or the ISP(Internet Service Provider). On the other hand, the MAC address is provided by the device manufacturer and is embedded in the NIC(Network Interface Card).
- Address Length and Representation: In IP address, Ipv4 has an address length of 32-bits, while IPv6 has an address length of 128-bits. On the other hand, the MAC address is a 48-bits address. Also, the IP address is represented in the binary format with dots(.) in between, while the MAC address is represented in the hexadecimal formal with hyphens(-) or colons(:) in between.
- Network Classes: The IP addresses uses all kinds of network classes, i.e., A, B, C, D, and E for addressing a connection. On the other hand, no such network classes are used for addressing the MAC address for a specific device.
- Subnetting: Subnetting is the process of dividing a network into two or more small networks. IP address uses subnetting, while the MAC address does not use it.
- Flexibility: The IP address is flexible in nature, it gets changed whenever a device connects to some other network. On the other hand, the MAC addresses are not flexible and remain constant for a device.
- Network Traffic Used: The IP address can be used for Multicasting or Broadcasting, while the MAC address can be used for broadcasting.
- Implementation Layer: The IP address or logical addressing is implemented in the Network layer of the OSI or TCP/IP model. On the other hand, the MAC address or physical addressing is implemented in the Data-Link layer of the OSI or TCP/IP reference model.
This is all about the IP and MAC addresses, and the dissimilarities between them. Hope you learned something new today. That's it for this blog.
Keep Learning :)