Course I’m sure you’ve come across the terms IP address and MAC address before. These two components play a role in networking by enabling devices to communicate effectively. They may seem complex with their combination of numbers and letters.
They serve specific and important purposes. It’s quite common for users to get confused between the two and not fully understand their functions. That’s why it’s crucial to have an understanding of each address.
The main difference between a MAC address and an IP address is that the former uniquely identifies a device at the hardware level serving as an identifier for its physical network interface. On the hand an IP address uniquely defines the connection to a device on a network allowing it to change over time or in different network environments.
Many users often mix them up. Struggle to grasp their significance underscoring the need for education in fundamental networking concepts. In our discussion we’ll delve into what exactly IP and MAC addresses are, how they are useful and explore the differences between these two key concepts, in detail.
IP Address
First of all, I would like to introduce what is IP address, IP address (Internet Protocol Address) is the full name of the Internet Protocol address, its original meaning is to configure a unique logical address for each network and each host on the Internet, which is used to distinguish it from the physical address.
So, IP address is divided into: IPv4 and IPv6, we focus on IPv4 address, IP address is composed of 32-bit binary number, they are usually divided into four “8-bit binary number“, we can understand it as four bytes, it is expressed in the format: (A.B.C.D).
Among them, A, B, C, D the four letters of the alphabet for the 0-255 decimal integer.
Example: 192.168.1.1
The initial design of the Internet, in order to facilitate addressing and hierarchical structure of the network, each IP address includes two identification codes (ID), that is, the network ID and host ID. all hosts on the same physical network use the same network ID, a host on the network (including workstations on the network, servers, and routers, etc.) has a host ID with its counterpart.
IP address is divided into:
- Public IP address is divided into: Public address (Public address), we can realize direct access to the Internet through the public IP address.
- Private address (Private address), is divided into five categories: Class A, B, C, D, E. In this one, A, B, C, D, E, D, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E.
In this, A, B, C class private address is by the InternetNIC company in the global scope of the unified allocation, D, E class is a special address.
Class A IP address (applicable to large networks) has a network’s identification (network ID) length of 8 bits and a host’s identification (host ID) length of 24 bits, and it ranges from 1.0.0.1 to 127.255.255.254;
Class B IP addresses (for medium-sized networks) have a network ID of 16 bits and a host ID length of 16 bits, it ranges: 128.0.0.1 to 191.255.255.254;
Class C IP addresses (for small networks) have a network ID of 24 bits and a host ID length of 8 bits, it ranges: 192.0.0.1–223.255.255.254.
Class D address is called multicast address, i.e. multicast address, and it ranges from 224.0.0.0 to 239.255.255.255.
Class E address is mainly used for Internet experimentation and development, its range: 240.0.0.0 to 255.255.255.255
MAC Address
The full name of MAC address (Media Access Control Address) is Media Access Control Address, also known as LAN address, Ethernet address or physical address.
MAC address is used to uniquely identify a NIC in a network, if a device has one or more NICs, each of them will need and have a unique MAC address.
MAC address is 48 bits (6 bytes). The MAC address is 48 bits (6 bytes). The first 24 bits are assigned by the IEEE (Institute of Electrical and Electronics Engineers), and the last 24 bits are set by the actual manufacturer of the network device.
Example broadcast address: FF:FF:FF:FF:FF:FF:FF
To view the local IP as well as MAC address operation: open the command indicator (CMD), type: ipconfig /all Enter, then we can view the MAC address:
OSI
Next, let’s take a look at the OSI model (Open System Interconnection Reference Model), which is a conceptual model of a standard, a framework of standards that attempts to interconnect a variety of computers into networks around the world.
In the OSI model of the physical layer (Physical Layer): It is to provide a physical link, the transmission of electrical or optical signals used to transmit data frames (data frame) on the LAN, it is responsible for the management of computer communications equipment and interoperability between network media. It is responsible for managing the interoperability between computer communication devices and network media. It includes pins, voltages, cable specifications, hubs, repeaters, NICs, host interface cards, and so on.
Layer 2: Data Link Layer (Data Link Layer): The Data Link Layer is responsible for network addressing, error detection and error correction. When the table header and table tail are added to the data packet, it will form a frame. And this layer is also responsible for MAC address.
Layer 3: Network Layer (NL): decides the path selection (data routing) and forwarding of data, and adds the network table header (NH) to the packet to form a packet. The NH contains the network data, e.g. IP address.
Layer 4: Transport Layer (TL): it creates a secure channel to prevent data loss. End-to-end connections are established. The Transport Header (TH) is added to the data to form a packet. The TH contains information about the protocol used, e.g. Transmission Control Protocol (TCP).
Layer 5: Session Layer (Session Layer): Responsible for setting up and maintaining the communication connection between two computers in a computer network during data transmission. The control of the session, maintaining the unidirectional transmission of data, one-to-one, one-to-many control.
Layer 6: Expression Layer (Presentation Layer): encrypts our information data for encryption algorithms; and data transformation. Information data encryption, conversion, compression. Convert the data into a format that is compatible with the receiver’s system format and suitable for transmission.
Layer 7: Application Layer (Application Layer): plays the role of calling, provides the interface for the application software to set up the communication with another application software. For example: HTTP, HTTPS, FTP, TELNET, SSH, SMTP, POP3, HTML, and so on.
Difference between MAC and IP Address
Having said so many concepts, I’ll summarize the difference between IP address and MAC address:
1. For some of the equipment in the network, routers or PCs and for the design of the IP address is designed out of the topology, as long as in the case of not repeating the IP address, it can be changed at will; while the MAC address is burned according to the manufacturer, it generally can not be changed, in general, when a PC’s network card is bad, after the replacement of the network card, the MAC address will be changed. The MAC address will be changed after the replacement of the NIC.
2. In the previous introduction, the most obvious difference between them is the different lengths, the length of the IP address is 32 bits, while the MAC address is 48 bits.
3. Their addressing protocol layer is different, IP address is applied to the network layer of the OSI model, while the MAC address is applied to the data link layer of the OSI model. The data link layer protocol enables data to be passed from one node to another node on the same link (through the MAC address), while the network layer protocol enables data to be passed from one network to another (ARP finds the MAC address of an intermediate node according to the destination IP address and transmits it through the intermediate node so that it finally reaches the destination network).
4. The basis of allocation is different. The allocation of IP addresses is based on our own defined network topology, and the allocation of MAC addresses is based on the manufacturer. One is subjective, while the other is observable.
MAC Adress vs. Ip Address: Comparison Chart
Feature | MAC Address | IP Address |
---|---|---|
Definition | A unique identifier assigned to network interfaces for communications at the physical layer of the network. | An address assigned to devices on a network that identifies the device at the network layer. |
Purpose | Used for communication within the same network segment; it helps in directing data packets to the correct hardware. | Used for identifying devices on a network and routing traffic from one device to another, potentially across different networks. |
Assignation | Burned into the device’s hardware by the manufacturer, making it a permanent address. | Dynamically assigned by the network or can be statically set by an administrator. Changes depending on the network it connects to. |
Format | Consists of 6 bytes (48 bits), typically represented as six pairs of hexadecimal numbers separated by colons (e.g., 01:23:45:67:89:ab). | IPv4 is represented by four sets of numbers separated by dots (e.g., 192.168.1.1), while IPv6 uses eight groups of four hexadecimal digits separated by colons (e.g., 2001:0db8:85a3:0000:0000:8a2e:0370:7334). |
Layer of Operation | Operates at the data link layer (Layer 2) of the OSI model. | Operates at the network layer (Layer 3) of the OSI model. |
Scope | Local network segment; not routable across different networks. | Global or local; routable across different networks. |
Changeability | Generally, unchangeable but can be masked or spoofed by software. | Easily changeable, either manually by a user or automatically by DHCP (Dynamic Host Configuration Protocol). |
Visibility | Only visible within the local network segment. | Visible across networks, used for routing traffic on the internet or within large networks. |
FAQ
What is a MAC address?
A MAC (Media Access Control) address is a unique identifier assigned to a network interface controller for communications at the data link layer of a network segment.
What is an IP address?
An IP (Internet Protocol) address is a numerical label assigned to each device connected to a computer network that uses the Internet Protocol for communication.
How are MAC addresses and IP addresses different?
MAC addresses are hardware addresses that are assigned to network interfaces, while IP addresses are logical addresses assigned to devices on a network.
Can a MAC address change?
MAC addresses are typically hard-coded into the network interface hardware and cannot be changed, whereas IP addresses can be dynamically assigned and changed.
Can two devices have the same MAC address?
No, each network interface has a unique MAC address, and no two devices should have the same MAC address on a network.
Can two devices have the same IP address?
No, each device on a network must have a unique IP address to ensure proper communication and routing of data packets.
Which layer of the OSI model do MAC addresses operate at?
MAC addresses operate at the data link layer (Layer 2) of the OSI model, while IP addresses operate at the network layer (Layer 3).
Can a device have multiple MAC addresses?
Yes, some devices may have multiple network interfaces, each with its own unique MAC address.
Can a device have multiple IP addresses?
Yes, a device can have multiple IP addresses assigned to its network interfaces, allowing it to communicate on different subnets or networks.
Are MAC addresses visible outside of the local network?
MAC addresses are usually only seen within the network segment and cannot be used to route data across different networks. On the hand IP addresses are specifically designed for routing data, between various networks.