15

I don't understand why Ethernet MAC addresses are needed. Can't all computers just be connected to the unified network and use IP addresses to communicate?

For example, there is a following mechanism in the Ethernet:

  1. Computer with IP 192.168.1.1 (X.1) wants to send a packet to 192.168.1.2 (X.2)
  2. X.1 uses ARP to get the MAC of X.2
  3. To do so, X.1 needs to send a packet to all computers in the network; only one will answer
  4. X.1 gets a MAC and sends the packet

Wouldn't it be simpler just to do just a one step:

  1. X.1 sends a packet to all computers in the network; only X.2 will process it, others will ignore it

The complementary question would be: Why are IP addresses needed, if all devices have unique MAC addresses?

  • How do computers know that they should ignore the data? Without MAC address they cannot tell which one on the network should process it... – Bakuriu Oct 24 '14 at 14:00
  • 1
    they could use IP address instead of MAC address – user2449761 Oct 24 '14 at 14:08
  • erm... computer <-> IP address is not an injective mapping. I'll reword my question: How do computers know that they should ignore the data? Without MAC address they cannot tell which one on the network should process it... since more than one of them could have the same IP? – Bakuriu Oct 24 '14 at 14:11
  • 4
    they shouldn't have the same IP in the same subnet... this is a conflict – user2449761 Oct 24 '14 at 14:17
  • 1
    The complementary question is serverfault.com/q/410626/102768 – OrangeDog Oct 24 '14 at 23:03

11 Answers 11

30

The different networking layers are there to allow them to be swapped for different technologies.

The two layers you are talking about here are layers 2 and 3. Layer 2 in this scenario is Ethernet - from which MAC addresses arise, and Layer 3 is IP.

Ethernet only works at the local level, between network devices connected to a broadcast network "datalink", whereas IP is a routable protocol and so can target devices on remote networks.

The requirements of each of these are different. Ethernet specifies a family of technologies that allow packets to be sent and received between network devices, whereas IP defines a protocol that allow packets of data to traverse multiple networks.

Neither is reliant on the other, which is what give networking its flexibility. For example, you may choose to connect to your internet service using IP over ethernet, but in your internal network, you might choose to use IP over... paper. Where someone writes down the contents of each packet and physically walks it over to another machine and types it in. Clearly this would not be particularly fast, but it would still be IP provided the person carrying around the bits of paper respecting IP routing rules.

In the real world there are different datalink protocols that you are already using two different ones (although their addressing schemes are the same): 802.3 - ethernet, and 802.11 - wifi.

IP doesn't care what the underlying layer is.

Equally, IP can be swapped out for different network layer protocols (provided it happens for all participants). Such as ATM.

While there is nothing directly preventing the creation of a protocol that encompasses both layer 2 and layer 3, it would be less flexible, and so less attractive, and so unlikely to be used.

  • 2
    For the internal network you should have used RFC1149. (A less technical description) – Scott Chamberlain Oct 24 '14 at 4:03
  • 2
    What, like using hand signal flags? – Scott Chamberlain Oct 24 '14 at 5:06
  • 1
    @ScottChamberlain: I love the ASCII art in the hand signal flags one! – Fred Larson Oct 24 '14 at 15:55
  • 5
    IPoAC is a poor choice for internal communications; pigeons work better outdoors than indoors – cpast Oct 24 '14 at 22:02
  • 2
    @user2449761 people have only listed the silly ones. Instead of ethernet you could use bluetooth, dial-up, GPRS, LTE, USB, DSL, token ring, etc. – OrangeDog Oct 24 '14 at 23:13
8

Where would this decision of whether to process or ignore the packet be done? No answer is really satisfactory:

1) In the switch? Well, that would mean that switches have to understand every protocol that determines which computers are interested in which packets. That would not only increase the cost of switches and reduce their speed but it would make changes in the IP protocol much harder to deply.

2) In the hardware of the Ethernet interface? Well, this would make the network much slower as every data packet has to go to every machine. Technologies like WiFi and bridging networks with slower bridges would be impossible. Having Ethernet running at different speeds interoperating would be impossible. Technologies like IPv6 or IP multicast would require hardware changes to deploy in all Ethernet end stations.

3) In software? Well, this would make computers much slower as they have to deal with a much higher number of network interface interrupts. All the bridging, VPN, and Wifi concerns mentioned above would be issues too.

All of these would make Ethernet unusable without IP and would mean changes in Ethernet would be needed to make changes in IP. Yuck.

Separations of concerns are good.

  • Plus it can greatly reduce overall network performance. For option 3, I send a huge file saturating my 1GBit network, and suddenly everyone else on the network gets that file too and has to ignore it, and doesn't have the bandwidth to send a file to someone else who isn't part of the current file transfer. – PlasmaHH Oct 24 '14 at 9:46
  • doesn't the second option describe how the Ethernet works? All interfaces are getting the same packets, but only one machine will not ignore it (except these in promiscuous mode). The switches are there to speed things up... – user2449761 Oct 24 '14 at 12:48
  • 2
    @user2449761 All packets only go to all computers if you're using ancient networking hardware that has hubs instead of switches. Hubs were originally an option for cost reasons; but now that switches are cheap nobody uses them anymore. – Dan Neely Oct 24 '14 at 14:22
  • @Dan that's what I am talking about... – user2449761 Oct 24 '14 at 14:23
  • 2
    Option 1 is already happening. It is not replacing the use of MAC addresses, at least not yet. But some switching hardware can be configured to either use destination MAC address or use destination IP address to chose outgoing interface. It is possible that in 10 or 20 years the MAC address will only remain for historical purposes, and all routing of packets will be done based on IP address alone. The part about changes to IP being harder to deploy wasn't avoided anyway because backbone routers have been routing based on destination IP address in hardware for years. – kasperd Oct 25 '14 at 12:58
3

IP address and MAC addresses operate on different layers of the internet protocol suite. MAC addresses are used to identify machines within the same broadcast network on layer 2, while IP addresses are used on layer 3 to identify machines throughout different networks.

Even if your computer has an IP address, it still needs a MAC address to find other machines on the same network, since every layer is using underlying layers. On the page mentioned earlier you can find some nice diagrams explaining the protocol suite in detail.

2

Congestion problem is faced by ethernet network as they increase in size. This inturn can choke the network and introduce delay. This is one of the factors that brought in subnet concept. But, with subnets, we need an additional entity called router to enable to packet to travel from a machine in one subnet to a machine in another subnet.

The distance spanned by ethernet cable is another major concern as it can limit the success of transmissions if it goes beyond certain limit. This brought in further new entities in the form of hub / repeater.

Note that all communication mechanisms do not use MAC address for communication. PPP & HDLC do not use MAC address for identification.

Also, note that some networks do not use ethernet. Token ring networks require a different data link layer.

If you send a packet from network A to a device in network B by addressing through mac address of the device in network B, it will get dropped in network A itself. Note that even if there is router between network A and network B, the router will drop the packet as the router works by receiving packets addressed to its mac address but for different ip address.

From the above scenarios, it is very clear that, the internet is not a flat network due to various local/private networks . There are also various network entities between source & destination.

Since the internet is not a flat network, MAC address is not used for all types of communication and some networks required different data link layer other than ethernet, we need IP address for routing it to the desired node regardless of location of the node and this is achieved with network layer.

Also, refer to a similar discussion in https://stackoverflow.com/questions/26290069/arp-vs-ip-why-do-we-need-both

  • In addition to the "avian carriers", "hand signals" and "paper and pencil" examples of alternate Layer 2 , there are some that are wacky yet occasionally useful. IP over SMS, or over Facebook, or even over email. Then there's the old standbys SLIP, PPP, and PPPoE. Those three do NOT present the same sort of face as an Ethernet or WIFI connection -- yet all of these get the IP through, and are completely routable. – Ross Presser Oct 24 '14 at 19:29
2

As others have explained, you need Layer 2 protocols for congestion control in your local network. Layer 3 is used for routing and addressing between networks.

Having said that, a valid question could be: Why can't both layers use the same addressing scheme?

First answer: As others have mentioned, this allows you to switch L2 and/or L3 technologies and everything still works.

Second answer: Even if everybody agreed to have Layer 2 protocols use IP addresses, then you would still have to use two IP addresses, one for Layer 2 and one for Layer 3. Why? NATting. If your computer has a public IP address, then the L2 and L3 addresses could be the same. However, if you use NATting, then your L2 and L3 addresses would be different.

Last comment: When you say everybody receives the message and non-recipients ignore them, you are talking about WiFi. Wired Ethernet does not work like that anymore. It used to be like that when we used coaxial cables and later when we used hubs. Switches only send the messages/packets to the appropriate port (unless you perform an attack on them and saturate their tables).

  • I am very glad you have added the last comment. As you have pointed out: congestion can be managed by the switches. Switches can use the IP addressing scheme only. I also don't understand the NATing argument: we always need two IP addresses at the both sides of NAT. I think the valid question would be: why do we need separate DataLink and Network layers in modern networks? I understand the separation was needed in the 70's, when token ring, pigeons and papers were in use. – user2449761 Oct 24 '14 at 17:40
0

MAC addresses and IP addresses operate on different network layers for different purposes. Getting rid of one of the layers can cause problems, create confusion, or prevent things from working.

Let's say I've got some ancient hardware (say, a million-dollar CNC lathe) that only speaks IPX. In your IP-only network, how would anyone talk to it? Or say I'm connecting an unconfigured computer to a new network. In the absence of MAC addresses, how can the DHCP server tell my computer what IP address to use?

Let's say I've got a server with four gigabit connections to a backbone switch, aggregated into a single virtual connection. In your MAC-only network, what's the address of my server? Or say I've got a computer connected via PPPoA modem and don't have a MAC address. How can anyone connect to it?

0

Hmmm I think this could have been made to work (I've actually /done/ hand MAC address assignment); however if this had been done you would have needed to buy new hardware for IPv6 and there would likely have been no overlap. So in all I don't like the consequences.

0

The I in IP stands for Internetworking Protocol.

Meaning an IP is supposed to be unique amongst ALL networks in the entire world.

IP addresses are supposed to be literally global. If you send traffic to 9.9.9.9 it's supposed to get to wherever 9.9.9.9 is no matter where in the world 9.9.9.9 is physically or which network 9.9.9.9 is on physically.

(This is broken somewhat because of NAT. When TCP/IP was invented NAT was not part of the original plan, and it's a "hack" until IPv6 becomes more prevalent to where it is not needed. Pretend NAT doesn't exist to understand this answer.)

A MAC address is supposed to be unique only in the local network that the host resides on. It is not designed to allow communication between anything that isn't on the same local network. So there is a physical limitation assumed with MAC addresses, but no such limitation with IP addresses.

TCP/IP is based on the notion that:

  • there are local networks where systems can talk to each other directly without a router being involved
  • sometimes computers on one network want to talk to computers on another, and need a router to do that.

If another fundamental mechanism existed where the two above concepts don't apply then IP and MAC would not be needed as they are currently.

If you are designing a protocol or something else that absolutely never needs to talk to machines outside of the same local network, then it's a good idea to just stick with MAC addresses. I think the ATA over Ethernet protocol is like this, since it is designed to allow sharing of ATA drives on the same network and not through the Internet for security purposes.

0

I just had similar thoughts. But I came to the realisation that you need MAC layer. Not even for switching purpose!

The unavoidable problem is that you have other than just the IP protocol, even if we are talking about IP, there are IPv4 and IPv6. How does the networking device know which one it is? so you need MAC as a bootstrapping layer, in the protocol field of it is the next layer, which tells you what is carried over MAC.

-2

You're getting stuck by only thinking about a single OSI layer. IP only works because Ethernet (and others) exists, in the same way that Ethernet only exists because there are physical wires to carry the traffic. It's not "IP or MAC" — the routing of traffic requires MAC addresses to work: IP technology (as well as other, related and unrelated, technologies) sits on top of that. You cannot simply exchange one for the other.

-6

Dynamic IPs my friend! In your local environment (your house, your college, you workplace) you have a network setup. It's not connected directly to the Internet (with a capital 'I') but through a router. This router gets a dynamic IP (in most cases, unless you have a static one) from your ISP, and assigns dynamic (same 'but' as above) addresses to all the computers connected. Why is it done like that? In a line, to provide service to more users than IPs you have. The thing is, you need to be able to identify your MacBook Pro ( :D ) among all the other computers, so you need a UNIQUE address, not a dynamic / shared one. That's your mac. And that's why you need it.

You can read further here

  • 2
    That’s really no reason to employ MAC addresses. – Daniel B Oct 24 '14 at 7:36
  • 1
    The point is: not all computers have a unique IP address, sometimes you don't even want that, so that's a good argument for them having a separate LAN address, which is what a MAC address is. – reinierpost Oct 24 '14 at 9:07
  • 1
    Yes they do. Everything internet-routable is, by definition, uniquely addressable. Otherwise the internet wouldn’t work. There are things like NAT that violate this so called end-to-end principle. In case of NAT you also have a separate LAN address. – Daniel B Oct 24 '14 at 11:46
  • @DanielB I am pretty sure that's not true, but maybe I misunderstand you. For example: can you tell me how you would uniquely address this PC I'm typing on, which is on a local private network, from where you are, with no previous connection established? What about if you wanted to address the computer beside this one instead? – SevenSidedDie Oct 24 '14 at 14:48
  • @DanielB Sure it's not the reason. OP's question: Can't all computers just be connected to the unified network and use IP addresses to communicate? My answer provides information about that question, not you hypothetical question, which would go along the lines of: "Why do we employ MAC addresses on the ethernet model?". Since he/she is asking about why we can't just use IPs, there is my answer. Please, next time read carefuly before downvoting :) – tfrascaroli Oct 24 '14 at 15:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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