187

I am reading up on TCP/IP and other related protocols and technologies. MAC addresses are described as being (reasonably :) unique, and as having a large possibility space (several hundred trillions), while also being assigned to all network interfaces. What are the historical and technical reasons why IPv4 or IPv6 addresses are used instead of MAC addresses for internetwork communication?

Am I missing something fundamental or is it just a silly reason (e.g. building on top of legacy tech)?

11
  • 55
    Pedantic correction: reasonably unique; cards with identical HW MAC addresses have been sighted in the wild - this is a "fun" network issue to debug. Jul 24, 2012 at 13:42
  • 11
    I personally witnessed a buggy driver which actually assigned the same MAC address to different network cards on different machines (which had unique HW addresses before installing that driver). Well, that was painful.
    – Massimo
    Jul 24, 2012 at 15:08
  • 3
    Massimo, I have seen the exact same thing. That's not uncommon for a driver to do that in development and the programmers to forget to turn that component of when it goes production. @Felix, it is also common for manufacturers to reuse MACs over time and in different parts of the world. A card sold in 2005 in the US might have the same MAC as one sold in China in 2013, for example. Jul 24, 2012 at 15:17
  • 30
    Addressing a packet with a MAC address would be like addressing a letter with a social security number.
    – Mikey
    Jul 24, 2012 at 17:35
  • 14
    How would you know where a specific MAC-address is right now? Up front, without needing to have every node on the internet notified when you move to another net? Jul 25, 2012 at 13:43

13 Answers 13

352

The MAC address might be unique, but there's nothing special about the number that would indicate where it is. MAC 00-00-00-00-00-00 might be on the other side of the planet from 00-00-00-00-00-01.

IP is an arbitrary numbering scheme imposed in a hierarchical fashion on a group of computers to logically distinguish them as a group (that's what a subnet is). Sending messages between those groups is done by routing tables, themselves divided into multiple levels so that we don't have to keep track of every single subnet. For instance, 17.x.x.x is within the Apple network. From there, Apple will know where each of its thousands of subnets are located and how to get to them (nobody else needs to know this information, they just need to know that 17.anything goes to Apple).

It's also pretty easy to relate this to another pair of systems. You have a State Issued ID Number, why would you need a mailing address if that ID number is already unique to just you? You need the mailing address because it's an arbitrary system that describes where the unique destination for communications to you should go.

22
  • 25
    This is a great answer. I would have added that MAC addresses are ultimately used in IP communications once the computers determine they're on the same subnet; that's why ARP poisoning works as an attack. The same thing with a default gateway, the computer addresses packets destined for another subnet to the MAC address returned by the ARP lookup for the default gateway IP. Layer-3 / IP addressing is mostly used by routers and only used by the host to determine if the destination is on the same subnet.
    – Sean C.
    Jul 24, 2012 at 13:38
  • 7
    @SeanC, MAC addresses are ultimately used in IP communications over 802.1 based line protocols (Ethernet, WiFi, Token Ring, etc). But not over ATM protocols, such as PoSDH and IPoATM.
    – Chris S
    Jul 24, 2012 at 14:06
  • 25
    Also, you can keep the same IP address when your network card (or whole computer) needs replacing. Imagine how annoying it would be without the IP abstraction.
    – OrangeDog
    Jul 24, 2012 at 14:10
  • 3
    @ChrisS I have a friend who as a sys admin, received a batch of cards from a single vendor and the cards only had one MAC address in the entire palette. The vendor said that the cards did not get mixed in to the retail distribution correctly so that there were duplicates, since the order was a direct drop from the factory. Before the cards went to retail distribution, they were supposed to get mixed together to spread the dupes around. So for a given vendor, MAC addressees aren't unique, much less across vendors.
    – user35861
    Jul 24, 2012 at 15:09
  • 4
    There are a variety of historical reasons for duplicate mac-address occurances including vendor firmware bugs. Jul 24, 2012 at 15:54
75

Because the routing tables would become impossibly large.

IP addresses are allocated hierarchically, so a router can group routes by address prefixes. The number of autonomous systems present on the net now is reasonable enough to fit in today's hardware.

On the other hand, the distribition of MAC addresses across the network is random and completely unrelated to topology. Routes grouping would be impossible, every router would need to keep track of routes for every single device that relays traffic trough it. That is what layer 2 switches do, and that does not scale well beyond a certain number of hosts.

2
  • Can you elaborate on this? Why would they? Why is that not the case with IPv*? Jul 24, 2012 at 12:53
  • 3
    There's no intrinsic reason that router tables using a MAC-formatted address would be "impossibly large" compared to IPv4/6 formats. The problem is that allocation of IP addresses is tied up with a hierarchy that makes WAN routing feasible. MAC addresses are assigned for Ethernet devices by manufactures (and can be changed in software), and as the hardware device moves around, making those ad hoc revisions to WAN routing tables would be an "impossibly large" task.
    – hardmath
    Jul 24, 2012 at 14:41
35

The world doesn't run exclusively on ethernet(at least historically). The IP layer is independant of the hardware layer beneath it.

PPP nodes don't have Mac addresses. Neither do arcnet, token ring, fddi, hppi. Those other standards may not be as relevent today, but ethernet may be replaced with other technologies in the future and it would be transparent to the IP layer.

There's a longer discussion about how we keep inventing new hardware protocols and calling them ethernet, but I digress...

6
  • 5
    Token Ring does have MAC addresses.
    – Chris S
    Jul 24, 2012 at 17:22
  • You mean they can't switch to ipv6 either because the PPP node doesn't have a v6 address? (Or at least didn't have one 5-10 years ago). As far as i can tell that never stopped the deployment of ipv6 today. This doesn't make a difference for MAC either.
    – Dorus
    Jul 25, 2012 at 21:00
  • 6
    @Dorus: Your comment does not make sense. PPP nodes can have both IPv4 and IPv6 addresses, precisely becauses IP builds on the underlying protocols, such as Ethernet or PPP. However, PPP nodes do not have a MAC address (because the PPP standard does not have them).
    – sleske
    Jul 26, 2012 at 7:30
  • 3 years on (and a bit more knowledgeable), I would love to read that "longer discussion about how we keep inventing new hardware protocols and calling them ethernet." ;P Dec 20, 2015 at 8:47
  • This is a good start - standards.ieee.org/events/ethernet/history.html Jan 25, 2016 at 1:52
30

Further to the hierarchical routing of IP, having them separate from MAC addresses allows you to change your network card or whole computer while retaining the same IP address (and thus logical network topology).

This abstraction allows for much more flexible and maintainable networking.

23

Take a look at the OSI model: http://en.wikipedia.org/wiki/OSI_model

This explains why it doesn't make sense to make routing, a layer 3 concept, decisions based on a physical, layer 2, mechanism.

Modern networking is broken into many different layers to accomplish your end to end communication. Your network card (what is addressed by the mac address [physical address]) needs to only be responsible for communicating with peers on it's physical network.

The communication that you are allowed to accomplish with your MAC address is going to be limited to other devices that reside within physical contact to your machine. On the internet, for example, you are not physically connected to each machine. That's why we make use of TCP/IP (a layer 3, logical address) mechanism when we need to communicate with a machine that we are not physically connected to.

1
  • 6
    +1 for mentioning the OSI model.
    – Massimo
    Jul 24, 2012 at 17:35
7

b0fh is right - but also because MAC addresses are not always unique.

See for example in virtualization scenarios. Here multiple hosts can serve virtual machines with the same MAC addresses.

0
4

Routing tables for MAC addresses would need almost every single device with a MAC address listed. Routing to the Internet for IP is a single entry 0.0.0.0/0. For networks classes they break down as 10.0.0.0/8 172.16.0.0/16 and 192.168.0.0/24. Many of these can be aggregated like 172.16.0.0/12 and 192.168.0.0/16 further reducing the routing table size.

Routes are searched in reverse order in to the number of one bits in their mask. This makes routing to 192.168.100.0/24 work when there is a route for 192.168.0.0/16 and another for 0.0.0.0/0 (default route).

EDIT: Originally, the IP range was broken into several classes; A, B, and C being the most significant. The A class made up the first half of the address range, the B range the next quarter, and the C range the next eight of the range. These classes had masks of 8, 16, and 24 bits respectively. Later the strict usage of these masks was dropped and address allocation were done in a variety of sizes.

The size of the allocation is always a power of 2 and the lowest and highest address in each allocation are reserved. Each allocation will also have an address for a router. This is often the lowest or highest non-reserved address. The smallest practical allocation is a /30 address.

IPv6 uses the same form of allocation with a /64 the smallest allocation that can appear on the Internet. Typically, and ISP will be given much larger allocation, which is all the Internet routers would need to know about. Expected allocations are specified in the RFCs. The ISP would need to know how to route its own subnet, and what addresses to route to which interconnect routers. This is significantly simpler than knowing how to route each mac address.

4
  • 7
    There are no Classes in networking anymore and haven't been since 1994. =[
    – Chris S
    Jul 24, 2012 at 13:51
  • @ChrisS IPv4 PTR lookups are still done by class, although delegation is possible. The aggregations still apply with or without classes, and B and C aggregations still applied even before classless networks.
    – BillThor
    Jul 25, 2012 at 2:37
  • 2
    PTR lookups are done by Octet, there are no classes. See RFC 1517 to 1520.
    – Chris S
    Jul 26, 2012 at 1:27
  • 2
    @ChrisS Among the people I work with, the classes are used to refer to the number of octets in the netmask A=1, B=2, and C=3. We don't associate them with there historical ranges, and will break the A class 10.0.0.0 into B and C chunks. Classes live on in tradition, if not their original meaning.
    – BillThor
    Jul 26, 2012 at 3:16
2

I think the main point they're trying to put across is that MAC addresses are determined by vendors, so there is no coherent addressing scheme that could be adhered to in a local subnet due to the huge variety of manufacturers that make interfaces.

MAC addresses are used when the destination address is in the local subnet (192.168.0.x, for example). When traffic does not match the local subnet, the computer refers to the routing table. Generally the routing table will tell any traffic that does not match the local subnet (0.0.0.0) to head to the local gateway, at which point any affiliation to MAC addresses are stripped entirely. The only way MAC addresses could be used globally would be to have one, huge, flat subnet, which would be wholly unworkable.

2

The MAC address can be the same on different ethernet adapters on the same machine. SUN had one uniqe MAC address for each machine. So the ethernet cards for SUN computers didn't have any unique MAC address, the machine did.

So when you connected the machine to two different networks, it had the same MAC address on both networks.

2

MAC addresses are the addresses of the link layer(2n) in ISO/OSI model and TCP/IP model. It means MAC addresses are used to connect nodes inside a local network (point to point). IP addresses are the addresses of the network layer(3rd) inside Internet (end to end).

Both addresses are used in their layer only and are not intended to be used outside it.

1

MAC address of a target IP-address is only useful, for packet delivery, within a single local broadcast domain.

1

People here stated that the problem of using MAC addresses instead of IPv4 addresses is the routing, because the routing tables would grow large -- however, that assumes IPv4 routers. It is possible to have small routing tables, and if you're interested how, look for Flat namespace routing. One of the papers describing that technique is this one: http://www.cs.uiuc.edu/~caesar/papers/rofl.pdf

2
  • 2
    ROFL proposes that every router within as AS keep track of every single host within that AS... And use cryptographic hashes for host identifiers... So not only will there be millions of entries in the routing tables and monstrous transfer/upkeep requirements, but cryptographic algorithms are required to interpret the table. The author is out of his mind. IP might have shortcomings, but at least there aren't insane assumptions in the basic design.
    – Chris S
    Jul 25, 2012 at 23:12
  • In ROFL only first hop routers need to keep the set of connected nodes, not of all nodes in the AS. Section #2 mentions caching, but that is an optimization. Crypto is only necessary when nodes are joining the router, not for the interpretation of the routing table. Routing is done on a DHT, which is much more resilient than hierarchical routing. Aug 15, 2012 at 9:23
1

My recollection is that MAC addresses are really Ethernet addresses. Ethernet addresses are divided into two parts: a vendor part - which identifies the vender of the ethernet card and an address part which is assigned by the vendor. It is up to the vendor to make them unique - or not.

So the 48 bit MAC address space isn't used efficiently nor - as mentioned several times above - hierarchically.

The address is designed to have unique addresses on a local, CSMA network network.

At least, to the best I recall.

IP addresses are designed to scale much more generally and to solve a different problem.

1
  • MAC Addresses are required to be unique - it doesn't always happen as other have noted, but it is a requirement. Manufacturers can get more than one Vendor ID. There are about 4 million possible vendor IDs (in the MAC48 address space, there's also an upcoming MAC64 address space) and less than a tenth have been assigned. Within each Vendor ID there are 16 million device IDs, it takes a while for a even large vendors to run out.
    – Chris S
    Jul 26, 2012 at 1:20

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