Skip to main content

When a MAC address itself is unique, why do we still need an IP address to uniquely identify a system on a network?

It is not possible to route a MAC address since it works on a layer above Ethernet. To understand why IP addressing is used in a computer network or over the internet you need to understand how IP routing works.

Basic IP Routing
When your computer (PC1) wants to send a packet to some IP address (IPv4) like x.x.x.x, then the first check is if the destination address is in the same IP network as the PC1 itself. If x.x.x.x is in the same network, then the destination IP can be reached directly, otherwise the packet needs to be sent to the route configured on PC1 and if a route for the destination network / host is not configured explicitly, the packet is routed to the default gateway configured on PC1. Well that was about how IP routing works at a very high-level. Routers also use dynamic routing protocols and algorithms to find the best possible path.

MAC addresses
Once the packet has reached the local network of the destination computer, the communication happens over the Ethernet which is the data link layer. This is where MAC addresses are used to communicate. The sender (which in this case could be a router or the source computer PC1 if it was in the same network) needs to get the MAC address of the destination computer. There is a special protocol ARP (address resolution protocol) that is used for that. Once the sender has retrieved the MAC address of the next hop, he sends the data. Before sending the data packet over the Ethernet, it is divided into shorter pieces called frames.

MAC addresses are needed for communication within the Local Area Network. IP address comes into the picture when the packet has to be routed to a different network.


Why MAC address are used locally only?

With MAC addresses, there is no hierarchy, and thus packet forwarding  would not be possible. So, MAC addresses are not used for packet  transfer.

And also, a host  (e.g., a computer) cannot determine from the MAC address of another  host whether that host is on the same network as the sending host, or on  a network bridged to that network. This is the weakness of a MAC  address and the reason why it is not used for determining the location  of a host. Instead, determining a host's location, whether it is on the  same network or another network, can only be accomplished by means of  the IP address.

To  route by MAC addresses, routers would have to account for every machine  on the network individually which is a impossible for a  network the size of the Internet.

Why we need IP when MACs are so unique?
To explain this in layman’s terms, let us compare IP routing to our postal address and routers to various post offices worldwide. Now let’s say your friend in Virginia, USA mails you a post card to your residence address which is like 101 Ganesh Society, Nariman Point, Mumbai-400001, Maharashtra, India. The post card will be first delivered to India then Maharashtra then Mumbai till it finally reaches your apartment.

Now let’s assume your another friend in India were to post you a postcard from New Delhi and he only knows your Aadhar Id (an unique Id for Indian citizen). Will the post office be able to deliver the post card without even referring your postal address online? The answer is No. This is simply because every post office worldwide relies on each other to deliver the posts.

Now, once again let's use the analogy of post office and unique ID and assume we had to use only the MAC address or a Unique ID or Aadhar Id to deliver information to another computer somewhere across the world. In this case we would require a single gigantic post office somewhere in first place. All the posts would be collected by this giant post office and then distributed to each person across the world. Which would also mean that if this post office was to be setup in New York, the post card from your friend in New Delhi would have to travel to New York before reaching you. This post office might have to handle millions of mails and parcels daily. They would have to maintain postal records for literally each person in the world so that their logistics team may deliver posts to respective people directly (Since there is no other post office to do the job). This may require infinite amount of resources and delivery teams travelling from just one central post office to each house in the world which is again next to impossible.

Similarly in the case of computer networks or an Internet, it is not possible to hook every single computer in the world to one network router or switch. We need to break this into smaller network segments, also known as subnets.

Comments

Popular posts from this blog

.NET Core: Session Wrapper Design Pattern For ASP.NET Core

Here, we'll learn about Session Wrapper design pattern to ease the access of Session. We'll make our access of session "Typed". Also, we may apply any validation or constraint in this wrapper class. Step 1 - Create a Session Manager class   In this example, we are going to store two items in Session (i.e. ID & LoginName). We are injecting IHttpContextAccessor so that we can access the Session variable.  We are creating properties which are actually accessing Session variable and returning the data or writing the data to Session. We have added one helping property "IsLoggedIn" which is using other properties to make a decision. We may have more such helping/wrapper properties. using Microsoft.AspNetCore.Http; public class SessionManager       {           private readonly ISession _session;           private const String ID_KEY = "_ID";           private const String LOGIN_KEY = "_LoginName";           publ

Facade Design Pattern

Facade Intent Provide a unified interface to a set of interfaces in a subsystem. Facade defines a higher-level interface that makes the subsystem easier to use. Motivation Structuring a system into subsystems helps reduce complexity. A common design goal is to minimize the communication and dependencies between subsystems. One way to achieve this goal is to introduce a  facade  object that provides a single, simplified interface to the more general facilities of a subsystem. Consider for example a programming environment that gives applications access to its compiler subsystem. This subsystem contains classes such as Scanner, Parser, ProgramNode, BytecodeStream, and ProgramNodeBuilder that implement the compiler. Some specialized applications might need to access these classes directly. But most clients of a compiler generally don't care about details like parsing and code generation; they merely want to compile some code. For them, the powerful but low-level

Tabla - An Indian classical instrument for Rythm

Tabla Indian music has fascinated the West for many years. The tabla in particular has attracted the attention of a number of American and European percussionists. It has been used in popular music as early as the 60's and is heard in the popular media even today. However, many percussionists shy away from this instrument. The reasons for not "getting into it" are varied. Sometimes it is the lack of instruments; sometimes lack of teachers; sometimes it is the belief that tabla is just too difficult. These are legitimate concerns but they are not insurmountable obstacles. This article will address the concerns of a musician just wishing to get started in tabla. We will discuss the theory of Indian music, how to purchase tabla, the basic technique, and compositional theory. All of this information should make the job of getting started much easier. We should first familiarize ourselves with the extensive theory of Indian music. Indian music is one of the oldest musical trad

How to make a Method Thread Safe?

In multi-threaded applications where multiple threads make calls to the methods of a single object, it is necessary that those calls be synchronized. If code is not synchronized, then one thread might interrupt another thread and the object could be left in an invalid state. A class whose members are protected from such interruptions is called thread-safe. Although, there is no rule that makes the code thread safe, the only thing you can do is make sure that your code will work no matter how many times is it being actively executed, each thread can be interrupted at any point, with each thread being in its own state/location , and this for each function (static or otherwise) that is accessing common objects. If a method (instance or static) only references variables scoped within that method then it is thread safe because each thread has its own stack: In this instance, multiple threads could call ThreadSafeMethod concurrently without issue. public class Thing { publ

Create VHD using DISKPART

Create Virtual Harddisk Using DISKPART Open the   Elevated Command Prompt   with Administrator Privileges and type the following commands: DISKPART CREATE VDISK FILE="c:\win7\win7.vhd" MAXIMUM=20000 SELECT VDISK FILE="c:\win7\win7.vhd" ATTACH VDISK CREATE PARTITION PRIMARY ASSIGN LETTER=X FORMAT QUICK LABEL=Windows7 EXIT This will create the  VHD  file of primary partition. You will see the newly attached disk in Disk Management with Drive Letter X: Attaching and Detaching VHD in  Windows 7 Right Click  on My Computer and Click ' Manage ' that will open up  Computer Management , in that click on  Disk Management . Just like previous part. Then Right Click on Disk Management and select  'Attach VHD'.  This will open new windows  'Attach Virtual Hard Disk ' Click on  OK  and that will attach the existing Virtual Hard Disk. Now, if you don't want to make write anything on the VHD, we