1

In computer networking, each device/host is assigned 2 different unique address. One physical address, MAC and one logic address, IPv4/IPv6, to make communication possible between any 2 hosts in the network/internet.

MAC address is flat addressing scheme. So, if all devices were connected in a flat structure instead of hierarchical(as in case of today's internet), and identification of a host had to be made with only MAC address, it would have been very inefficient. (Analogically, it is like finding an item in a sorted linked list DS)

However, IPv4 addressing scheme is hierarchical in nature, so identification of a host is much efficient. Using the network portion of the IP address you will first identify which network the host is in and then with the host portion of the IP address you will find the exact host within that network. (Analogically, it is like finding an item in a Binary Search Tree DS).

So my question is - If a host can be identified in the network/internet by just using a hierarchical addressing scheme say, IPv4 (both to identify across network and within network), then why do we need an additional address scheme (MAC address) alongside (which helps in just within the local network)?

PS: Lot of explanations are made from fellow friends, considering layer 2 and 3 of the current architecture. But why was the architecture designed that way in the first place? I could easily imagine a world where there are only local IP addresses. It's technically possible. Isn't it?

Deepak
  • 687
  • 1
  • 7
  • 22
  • Your LAN protocols that use MAC addresses (ethernet, token ring, Wi-Fi, etc.) are defined and maintained by the IEEE. IP (_Internetwork_ Protocol) is used to communicate between LANs, hence the Intenetwork in the name, and it is defined and maintained by the IETF. Tjhose are two completely separate organizations. The creators of ethernet had no idea that IP was going to succeed, and the creators of IP had no idea that ethernet would become dominant. – Ron Maupin Mar 19 '18 at 19:01

3 Answers3

3

You need to keep in mind that today's major protocols - TCP/IP for layers 3 &4 and Ethernet for layers 1 & 2 - were developed separately. They both solve the tasks in their respective layers in different ways.

When Ethernet was initially developed, TCP/IP wasn't ready and it would take 15 years for it to gain general acceptance. How do you built hardware for a protocol that isn't finished?

The guys developing TCP/IP built on whatever they had on hand. For Ethernet's incompatible addressing scheme a translation had to developed - ARP (which by the way is replaced by the more efficient NDP for IPv6).

Additionally, when Ethernet was young there where many, competing L3 networks out there - IPX, NetBIOS, Apple/Ethertalk, ...

Actually, the separate addressing mechanisms give a network designer additional degrees of freedom - he can map multiple IP addresses to a single MAC or vice versa, use virtual IP addressing, invent new ways to do things (like anycast) or similar. All this wouldn't be possible with a strict end-to-end addressing scheme.

Pure effiency on the link level is just one side of the medal. For overall effiency, you'd have to also count what you can do and how easily you can do it. Throw in scalability and cost effectiveness and take a look at the whole thing.

If Ethernet wouldn't work so well with IP, one of the alternatives would've made the ubiquitous network standard today.

Zac67
  • 81,287
  • 3
  • 67
  • 131
0

The problem you have described is a good illustration of the interaction between Layers 2 & 3 of the OSI model. MAC addresses operate at Layer 2, and are how Ethernet frames are addressed. For example, if Host A and Host B are connected to an Ethernet switch, and wish to communicate, they can do this by sending each other correctly-addressed Ethernet frames. As each packet arrives on the switch, the switch will use its MAC address table to look up which port the destination host is connected to, and send the packet on its way. To send traffic in an Ethernet network, a host must know which MAC address to send the packet to.

So far so good. But applications don't use MAC addresses, they prefer to use an IP address. How to get a packet to the right destination, if packets can only be sent on the wire using MAC address, but applications only know how to use an IP address? The answer lies with ARP - Address Resolution Protocol. This protocol maps IP addresses to MAC addresses, and is how each host knows how to send packets on the wire with the correct MAC. Hosts keep an ARP look-up table which they use to map IP addresses to MAC addresses.

In the example above, imagine Host A (10.0.0.5) wishes to send a packet to Host B (10.0.0.6). The sequence looks like this:

  1. Host A, wanting to send to 10.0.0.6, consults its ARP table for that IP.
  2. Not having an existing entry matching that IP, an ARP request is broadcast on the local Ethernet network to find the MAC address for that IP (arp who-has 10.0.0.6 tell 10.0.0.5)
  3. Host B, seeing the ARP request sent to the Ethernet broadcast replies with an ARP response (arp reply 10.0.0.6 is-at 00:25:90:03:b3:98)
  4. Host A now knows that Host B is reachable by MAC address 00:25:90:03:b3:98, and can send requests on the wire using that MAC.

To specifically answer your question, the reason a hierarchical address scheme is used (IPv4) even when hosts are connected to the same Ethernet network is because applications only know how to use IP addresses. It wouldn't be practical for applications to determine whether or not the destination IP they are talking to is connected to the same Ethernet network, and switch between using MAC address if they are, and IP address if they're not.

For further reading, check out Networking Basics: How ARP Works, it has a great description of the protocol and how it relates to this situation.

djluko
  • 1
  • 1
0

So if you're familar with why object oriented programming is so successful, then you know it's because it models real life.

Having a MAC address on your network interface card is like having a license plate on your car. Your home address would be like having your IP address ... if someone wants to look at your car they have to find your home address first (which never changes), then your license plate.

IP addresses have a pattern associated with them that is always true, including geographic location, since that information is registered in a publicly accessible database.

Also. you have many MAC addresses in your home, and they can change often. However, I can get a single IP address and it doesn't matter what my Mac address is, my IP address doesn't change and that is convenient for me.

DNS servers would have to work triple time trying to keep up with all the Mac addresses and who has what Mac address. Assigning a DNS name to an IP address comes with FAR FEWER changes over time than would a MAC address.

In short - IP addresses are much more convenient to use than MAC addresses for human beings, but a MAC address is necessary for switches to keep track of which packets go where, and which wire to place the packet on... its a low level addressing scheme and is not suitable for daily usage by people.

Michael Sims
  • 101
  • 1