12

I learnt that in ARP Protocol, to send a packet from one machine to another machine we need to know the MAC Address of the destination machine but since the destination has already been assigned a unique IP Address then isn't sending MAC Address redundant ?

Note-

  • I understand in TCP/IP there are various layers and among those is Data link layer whose its primary function is to check if the machines MAC Address matches the packets destination MAC Address.
    But since the packet already contains the Destination IP Address so why can't we send the packet further to the Network Layer to match the packets destination IP address with the machines IP address without making this check at the data link layer with MAC address.
    Please do not mark this question as dublicate because I've read previous Q&A on this topic but nothing explains the reason why this check isn't made at the network layer instead of data link layer.
    Kindly explain. Thank you.
0

3 Answers 3

9

Don't confuse the network layers. Each layer has a specific purpose. Also, don't assume that there is only one protocol for each layer. Layer-2 has many protocols, some of which use MAC addresses, and some which don't. Of those that use MAC addresses, some use 48-bit MAC addresses, and some use 64-bit MAC addresses. There are also multiple layer-3 protocols. IPv4, the most used, but not the only, layer-3 protocol, uses 32-bit addresses, but it is being replaced with IPv6, which uses 128-bit addresses. You don't want to replace or upgrade all your layer-2 devices each time you want to run a different layer-3 protocol.

MAC addresses are layer-2 addresses, and they are used to deliver layer-2 frames on a LAN. Switches are layer-2 devices, and they use MAC addresses to create a table of which host is connected to which switch interface. A switch will look at the source MAC address to build its MAC address table, and it will look at the destination MAC address, look it up in its MAC address table, and deliver the frame to the correct port. Absent a destination address in its MAC address table, the switch needs to flood the frame our every other interface, and that is pretty inefficient and wasteful of bandwidth on all the other interfaces. Switches do not look inside the frame to inspect the IP address. This allows layer-2 and switches to carry any layer-3 protocol (IPv4, IPX, IPv6, etc.).

IP addresses are layer-3 addresses, and they are only looked at by layer-3 devices, e.g. routers. A router receiving a layer-2 frame will strip the frame from the layer-3 packet, and it will look up the IP address in its routing table to see to which interface the packet should be switched. The router will build a new layer-2 frame for the new LAN connected to the destination interface.

Layer-2 (MAC address, etc.) is for devices connected to the same layer-2 domain, and layer-3 (IP address, etc.) allows you to send data to other layer-2 domains.

1
  • I'll be the storyteller to @rommaupin s super smart cyborg. Sep 9, 2016 at 18:54
16

There is a historical reason for this, as @ronmaupin alludes to.

In small networks, you don't need a layer 3 protocol. All the devices are directly addressable, so layer 2 addresses work fine. As networks got bigger and became interconnected, there was a need to know how to get from one network to another. That is the function of routing, which is done at layer 3.

IP was not the only (or even the most popular) L3 protocol, and Ethernet was not the only layer 2 protocol. That is why there are layers. You can isolate the function of one from the other. It made developing network software easier because you didn't have to have a special version for every type of network.

The layer 3 function doesn't know or care whether you use Ethernet, token ring, PPP, or a dozen other obsolete network protocols. Similarly, the layer 2 protocol doesn't care if you're using IP, IPX, or something else.

The price you pay for layering is that you have to "map" between a 32 bit IP address and a 48 bit MAC address (for Ethernet). That is the purpose of the ARP protocol - to map between layer 2 and layer 3.

4

IP addresses are like your hair cut. It typically doesn't change often, but when it does you can be completely unrecognizable. The MAC address is like your fingerprint. You may not look the same, but your fingerprint never changes.

MAC addresses allow us to do several things.

  1. They allow us to identify the manufacturer of an item.
  2. They provide an unchanging (essentially) identification for an item.
  3. It allows for less hardware intensive packet transfer in LANs.
8
  • But when sending packets from source to destination we often know the destination for example, www.google.com has a static IP address so what is the use of having MAC address here ? Sep 9, 2016 at 17:09
  • The purpose of the MAC address is to provide a unique identification for each device. There aren't enough IP addresses to do that. Not to mention that IP addresses can be easily changed. Sep 9, 2016 at 17:12
  • 1
    Did you not read what I wrote? There are vastly more unique MAC addresses than there are IP addresses. There aren't enough IP addresses to give every device a unique IP address. Sep 9, 2016 at 17:22
  • 1
    I like this analogy so much I had to type these words.
    – INV3NT3D
    Sep 9, 2016 at 18:52
  • 1
    You're speaking, of course, about IPv4. IPv6 has more than enough addresses. Your other points are quite valid.
    – Ron Trunk
    Sep 9, 2016 at 22:28

Not the answer you're looking for? Browse other questions tagged or ask your own question.