【Know routing in seconds】With IP address, is MAC address still necessary?

2023.04.17

【Know routing in seconds】With IP address, is MAC address still necessary?


On the network, it is rare for both parties to communicate to be in the same local area network (LAN). Usually, they can only be connected to each other through the transfer of multiple computers and network devices. Because the IP address is unique in one LAN, but in different LANs, the IP address may be the same, and the IP address can be changed manually, which may cause duplicate IP addresses.

I don’t know if you are confused: Why do we need a MAC address when we have an IP address?

What is the connection between them? What's the difference? Is one of them redundant?

Rumors spread to the ears of "IP address" and "MAC address", and they were also very distressed. Mr. Document handed them the microphone today, let's see what they say?

PART 01, Confessions of MAC&IP

MAC address says:

I am a MAC address, working at the data link layer and living on a physical network card.

picture

I am very specific to my relationship, and I never change my mind. My "CP" is the same network card all my life. Our relationship is very stable, and each network card has only a unique MAC address, unlike IP addresses, which are different from each other.

IP address says:

I am an IP address, working at the network layer and living in the IP protocol cluster.

picture

Some people say that I have "lived in thousands of flowers, not a single leaf touches my body", and I often "group CP" with different devices, especially the MAC address, and often say that I see different things and think differently.

But in fact, life is not easy. I only have one "CP" at the same time, and the CP combination with this device expired. Before I had time to take a break, I was arranged to "group CP" with another device.

stop stop stop! Are you two off topic?

Let the document gentleman introduce it seriously!

PART 02. What is a MAC address?

MAC address, the full name is Media Access Control Address, literally translated as media access control address, also known as physical address and hardware address.

When each network card leaves the factory, the manufacturer will mark it with a globally unique serial number, just like our ID number.

picture

In other words, the MAC address is not for the device, but for the network card.

Taking a computer as an example, there are several network cards on the computer, and there are several MAC addresses. For example, a notebook computer has both wired and wireless networking methods, and there are two network cards: a wired network card and a wireless network card, that is, there are two MAC addresses.

PART 03. What is the IP address?

IP address, the full name is Internet Protocol Address, literally translated as Internet Protocol Address.

It is mainly used to distinguish different networked devices in the Internet.

The IP address provides a unique logical address identification for each device connected to the Internet (public network). Through the IP address, we can accurately find the target device on the Internet and establish communication with it. Just like the receiving address filled in when shopping online in real life.

picture

The difference between an IP address and a MAC address is that in order to ensure the efficient operation of the network, the IP address is dynamically assigned and can also be modified manually, just like you can move around, or you can go to a "windy place" to have a look~

But the MAC address cannot be changed at will, just like your ID number, no matter where you move, the ID number is the most effective certificate to prove "you are you"~

PART 04, IP&MAC difference?

In fact, there are many differences between MAC addresses and IP addresses. The document gentleman has sorted out the differences between MAC addresses and IP addresses, so that you can understand them at a glance~


MAC address

IP address

Format

00:16:3E:00:F3:C9

6 hexadecimal numbers, separated by ":"

Among them, the first 6 digits of hexadecimal number represent the serial number of the network hardware manufacturer

196.168.10.10

4 8-bit binary numbers, separated by "."

(Take the most widely used IPv4 address as an example)

address type

physical address

logical address

Is it variable

normal, not changeable

Can be changed manually, or reassigned automatically

Allocation

fixed/static allocation

Dynamic/Static Allocation

use

Identify network adapters and devices

Realize data transmission, determine data packet sending and receiving

network level

Data Link Layer (Layer 2)

Network layer (three layers)

PART 05. Why both are indispensable?

Simply put, the purpose of generating IP addresses and MAC addresses is to facilitate devices on the network to find each other accurately.

Following the previous example, we compare the MAC address to an ID number and the IP address to a residential address.

If you only have the ID card number (MAC address), you will definitely not find your beloved document gentleman in the vast crowd.

picture

If you only have the address (IP address), you have found Mr. Document’s home, but who is Mr. Document at home? Still can't tell.

picture

But if you use the address (IP address) and the ID number (MAC address) together, you can first find the province→city→district→street→community, and then use the ID number (MAC address) to easily find out where the The document king of the code words in front of the screen.

picture

Similarly, when the device communicates, the IP address and the MAC address are also indispensable.

On the network, it is rare for both parties to communicate to be in the same local area network (LAN). Usually, they can only be connected to each other through the transfer of multiple computers and network devices. Because the IP address is unique in one LAN, but in different LANs, the IP address may be the same, and the IP address can be changed manually, which may cause duplicate IP addresses. But the MAC address is unique, and the MAC addresses on different devices are completely different, so different LANs rely on MAC addresses to identify different devices, thereby avoiding IP address conflicts.

picture

Therefore, "IP address + MAC address" is the real "CP". Only when they are used together can the only device in the network be identified, and data transmission will not go wrong.