1

I cant understand it: If each and every device in a local network has a unique local IP address, why do we still use the MAC address (ARP) to exchange data between devices on the same local network?

Why dont we just use the local IP address for local network communication instead of using the MAC address?

For what I know the router knows anyway when the IP address needs to go outside to the internet due to its subnet mask, is this correct?

4
  • That's important for DHCP/dynamically allocated local IP. Also that MAC & IP relation is saved in ISP router ARP table.
    – Biswapriyo
    Commented Aug 19, 2017 at 17:05
  • I just wrote an answer but deleted it again … I misread your post. Why do you think IP addresses are not used for local communication? Of course they are! All the higher level protocols (TCP, UDP) require IP to function, even on a local network.
    – slhck
    Commented Aug 19, 2017 at 17:15
  • Thanks for the quick replay guys, i dont understand what ARP used for if not for that? why do my router and computer should have ARP table with MAC_addr : IP ?
    – xsss
    Commented Aug 19, 2017 at 17:25
  • Because no network will work without this link layer. All data has to physically pass through it at some point. See my updated answer.
    – slhck
    Commented Aug 19, 2017 at 17:31

2 Answers 2

3

As you may know, MAC addresses and IP addresses exist on different layers of the ISO/OSI scheme or the TCP/IP suite. Make sure you understand the concepts behind these layers.

Note that the primary reason why we are using both IP and link layers is a historical one. It's mostly because IP addresses are 1) dynamic and 2) much more convenient to handle. Here's an interesting recent article that sheds more light on this history. Of course, it could have been different, but the Internet has evolved over decades, and it had to be backwards-compatible most of the time, so it's not like we could have come up with the best design from the start.

You're asking why we still use the MAC address to exchange data between devices on the same local network? Because:

  1. it's the only way you can actually unambiguously address a device that is connected to the same link (e.g., Ethernet)
  2. all communication has to pass through the link layer (MAC) anyway

You need to understand that because of the layered communication model, you can only address an end point at the same layer at which your protocol operates. For example, a TCP connection can only address a remote server with a certain IP address and port number. At the same time, TCP does not make decisions about how the underlying IP routing works. In other words, TCP doesn't care about—and is incapable of steering—how the IP protocol handles its connection data. The same goes for the IP protocol: it cannot decide where to physically send the data, but it doesn't have to, because there's the MAC layer.

The IP protocol is indeed used to uniquely address a certain device on your network, but when it's time for a switch to decide where to actually physically send the data (or the device itself when it has a MAC address cache), it needs to translate that IP address to the MAC address to which that IP address was assigned to.

With the massive address space that IPv6 offers, you could argue that MAC addresses are not needed anymore, because IPv6 offers both dynamic assignment and you can ensure that all assigned addresses are unique—but for several reasons (as explained in the article I linked to above), that's not what we're working with today.

3
  • 1
    The article is interesting, but some of the conclusions regarding IP and MAC are outright backwards. Commented Aug 19, 2017 at 18:43
  • @grawity Would be interesting to hear what exactly you're referring to? Guy's a fiber engineer at Google, apparently.
    – slhck
    Commented Aug 19, 2017 at 19:22
  • "The point of all this is that ethernet and IP were getting further and further intertwined. They're nowadays almost inseparable. […] You write your IP routing table using IP addresses, but of course you know you're lying when you name the router by IP address; you're just indirectly saying that you want to route via a MAC address." – Author implies they're inseparable because of this 'lie', but not only the former part is still completely wrong, the latter 'lie' is exactly what allows them to remain independent... Commented Aug 20, 2017 at 11:08
0

This is because if the way Ethernet is designed. For a start, please realize that Ethernet can (and prior to the emergence of the internet frequently did) use other protocols.

If you only had IP(V4) addresses it would make finding other systems in a lan very difficult because it would be very hard to implement routing in a simple, ordered fashion.

IpV4 is designed to be able to work on a large range of network topologies. Abstracting it away from the hardware - which is what Using MAC addresses allows makes it much easier to support other topologies.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .