-1

The way I understand is that MAC address uniquely identifies a NIC on a global level. IP addresses do not because they may go through a NAT box and the ISP may issue a single external IP address for a household or a business.

Let's say a packet comes to to the router doesn't the router check the IP address to see on which host connected to the network is the packet destined for? Why does a MAC address come into play?

I get that we may have Ethernet LANs that do not understand IP addresses but in that case each router has a unique MAC address so why at all bother with IP addresses. I understand that you can do cool things with IP addresses like aggregate but am pretty sure you could come up with a similar technique for MAC addresses.

Can someone clarify this as example coming a router that needs to be forwarded to a particular host on the network and why IP adresses is not enough for the task?

Thanks in advance.

Cagu Mumu
  • 89
  • 1
  • 3
  • Historical reasons basically. I have no doubt that someone could create a network with only IP addresses. – user253751 Jan 23 '20 at 11:55
  • Note that not all networks are Ethernet. For example, SLIP networks (now obsolete) don't have MAC addresses. ATM networks have *different* addresses (VPI/VCI). – user253751 Jan 23 '20 at 11:56
  • 1
    "_MAC address uniquely identifies a NIC on a global level._" That is a myth. A MAC address, for the protocols that use MAC addresses, and only the IEEE protocols do, must only be unique in the local LAN. Many xDSL routers use PPPoA, for the WAN, and that does not use MAC addressing. PPP uses no addressing, and ATM uses VPI/VCI for addressing. – Ron Maupin Jan 23 '20 at 14:27
  • Think of a Wi-Fi vendor. Wi-Fi has multiple regulatory areas in the world, and you cannot use a U.S Wi-Fi device in Europe, or vice versa. A manufacturer can reuse the same MAC address between the incompatible Wi-Fi regions. That will save the manufacturer money on buying OUIs from the IEEE, and the duplicate MAC addresses assigned to the different regions cannot end up on the same LAN. – Ron Maupin Jan 23 '20 at 14:41

2 Answers2

1

It's perfectly easy to imagine how things would work in a small LAN with a default gateway. Anything which is nearby is broadcastable, everything else has to get sent to the default gateway. This is momre-or-less the functionality inside an ethernet switch: it learns where everything is by listening to ethernet addresses. Any ether address it doesn't know gets special treatment.

However, within any arbitrary big router in the network, you'd need to have a list of all the ethernet devices in the world to know where to send them. This is not remotely practical, and in the 1980s was impossible. It's difficult enough with all of the routes there are now for IPv4 addresses: the method of converging all the addresses even for IPv4 is a challenge in the "default-free-zone" of the internet -- the collection of routers for which no default gateway exists or is meaningful.

Also, any network interfaces do not have MAC addresses of any kind, such as SLIP and various long-haul serial interfaces. So the internet designers made nice aggregatable IP addresses.

From the opposite direction, ethernet was specifically designed to be ubiquitous to drive costs down. The ethernet designers specifically were not betting on any particular upper layer protocols, and made their work applicable to all. So the separation of layers gives us both kinds of addresses.

jonathanjo
  • 16,104
  • 2
  • 23
  • 53
1

Why is there a need for a MAC address on top of IP address?

... but am pretty sure you could come up with a similar technique for MAC addresses.

IPv4 and Ethernet are two independent developments.

Therefore a MAC addresses is required for transferring data over Ethernet and a completely different IPv4 address is required for transferring data over IPv4.

Later layer-3 protocols like IPX or the first implementations of IPv6 actually use the MAC address as part of the layer-3 address - just like you would expect it.

(Current IPv6 implementations do no longer contain the MAC address in the IPv6 address any more because of privacy reasons: Web site providers shall not be able to track users.)

It is often said that one advantage of not using the MAC address as part of the layer-3 address is that the address of some server does not have to be changed if the server's NIC is exchanged.

However, you could also manually assign a MAC address (with the "local bit" set) to the server so the MAC address does not change if the server is replaced by a new one.

The fact that IP can also be used over serial lines and other technologies that do not have a MAC address is also not a compelling argument:

IPX can also be used over serial lines and similar technologies; RFC 1551 specifies that the serial ports are assigned a "dummy" MAC address (in the range 02:xx:xx:xx:xx:xx) in this case.

EDIT

that MAC address uniquely identifies a NIC on a global level

Not really.

I already mentioned the "local bit" that allows network administrators to assign a MAC address in a certain range to a NIC manually.

Multiple network administrators may assign the same MAC address to a computer in their network.

Let's say a packet comes to to the router doesn't the router check the IP address to see on which host connected to the network is the packet destined for? Why does a MAC address come into play?

In an Ethernet network each data "frame" (packet) must contain the MAC address of the destination computer in the Ethernet network.

If the IP packet is intended for a computer in another network, the "destination computer in the Ethernet network" is the router because the "final" destination computer is not part of the Ethernet network.

This means that the "destination MAC address" in the frame must be the MAC address of the router, not the MAC address of the final destination.

This is true for protocols like IPX or the "original" IPv6, too.

For such protocols each data packet contains two different "destination MAC addresses": The MAC address of the router (as Ethernet destination address) and the MAC address of the final destination computer (as part of the IPX or IPv6 destination address).

This would not be necessary if the entire Internet would be a single Ethernet network and switches (but not "L3 switches") would be used instead of routers.

Unfortunately, the size of an Ethernet network is limited for different reasons, so it would not be possible to build a network with millions of computers without routers.

Martin Rosenau
  • 2,326
  • 6
  • 10