Why are Ethernet/MAC addresses needed?

6,611

Solution 1

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.

Solution 2

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.

Solution 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.

Solution 4

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).

Solution 5

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

Share:
6,611

Related videos on Youtube

user2449761
Author by

user2449761

Updated on September 18, 2022

Comments

  • user2449761
    user2449761 over 1 year

    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?

    • Bakuriu
      Bakuriu over 9 years
      How do computers know that they should ignore the data? Without MAC address they cannot tell which one on the network should process it...
    • user2449761
      user2449761 over 9 years
      they could use IP address instead of MAC address
    • Bakuriu
      Bakuriu over 9 years
      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?
    • user2449761
      user2449761 over 9 years
      they shouldn't have the same IP in the same subnet... this is a conflict
    • OrangeDog
      OrangeDog over 9 years
      The complementary question is serverfault.com/q/410626/102768
    • Lightness Races in Orbit
      Lightness Races in Orbit over 9 years
      @user2449761: And yet, when you consider the multitude of individual networks around the world, there are billions of duplicate IPs in the same subnet, hidden away in their own little networks, behind NAT if connected to the wider internet. MAC addresses are unique globally and you need this.
    • Daniel B
      Daniel B over 9 years
      @LightnessRacesinOrbit Except MAC addresses aren’t unique. They’re “reasonably unique”. Because they only have to be in the same broadcast domain.
    • Lightness Races in Orbit
      Lightness Races in Orbit over 9 years
      @DanielB: Granted. "Unique enough".
  • Scott Chamberlain
    Scott Chamberlain over 9 years
    For the internal network you should have used RFC1149. (A less technical description)
  • Paul
    Paul over 9 years
    @ScottChamberlain Yeah, I knew the pigeon one, but I wanted to take it to a greater level of absurd to make the point
  • Scott Chamberlain
    Scott Chamberlain over 9 years
    What, like using hand signal flags?
  • Paul
    Paul over 9 years
    @ScottChamberlain Aaah, that is far better than walking packets over. Efficient!
  • Daniel B
    Daniel B over 9 years
    That’s really no reason to employ MAC addresses.
  • kinokijuf
    kinokijuf over 9 years
    Your example is not that good because Wi-Fi is sufficienly similar to Ethernet on the software level that it does not need special handling in the layer 3 protocol.
  • reinierpost
    reinierpost over 9 years
    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.
  • PlasmaHH
    PlasmaHH over 9 years
    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.
  • Daniel B
    Daniel B over 9 years
    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.
  • ratchet freak
    ratchet freak over 9 years
    @kinokijuf which is the entire point of layer 2, abstract out the specifics, most details in layer 1 & 2 are linked to hardware anyway and better solved by micro controllers these days
  • user2449761
    user2449761 over 9 years
    Thank you for the answer. I still don't see the point in this modularity and flexibility, if the alternatives to the Ethernet are pigeons and paper, and the 802.3 and 802.11 have the same addressing scheme...
  • Paul
    Paul over 9 years
    @user2449761 David's answer gives a better explanation of the design issues that would arise from not having separation.
  • user2449761
    user2449761 over 9 years
    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
    user2449761 over 9 years
    I added a comment to David's anwser. I still don't see the point :)
  • Dan Is Fiddling By Firelight
    Dan Is Fiddling By Firelight over 9 years
    @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.
  • user2449761
    user2449761 over 9 years
    @Dan that's what I am talking about...
  • SevenSidedDie
    SevenSidedDie over 9 years
    @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?
  • tfrascaroli
    tfrascaroli over 9 years
    @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 :)
  • Daniel B
    Daniel B over 9 years
    @SevenSidedDie: Since you’re probably behind NAT, the end-to-end principle is broken. As such, your computer does not have an internet-routable IP address. Whether or not it has a MAC address is unrelated. -- I did not downvote. Your answer simply misses the point. Whether there’s NAT or not, there’s still no need for MAC addresses. Also, there’s already the internet, which is basically the unified network the OP is talking about.
  • Fred Larson
    Fred Larson over 9 years
    @ScottChamberlain: I love the ASCII art in the hand signal flags one!
  • tfrascaroli
    tfrascaroli over 9 years
    @DanielB IP addresses purposedly have ranges that are private. It was built that way to support private networks and to let routers know what to do with private packets (aka, not to send them over the Internet). Inside such private networks, you need a way to define private and dynamic IPs so everyone connecting to it wouldn't require to set the IP address he/she has to use (although it can be done). This is where MACs come in, and that's how you use them.
  • SevenSidedDie
    SevenSidedDie over 9 years
    @DanielB Perhaps the natural brevity of comments tripped up how you wrote your second comment. It quite strongly appears to say that all computers have unique IPs, because they must be uniquely-addressable for them to be part of the Internet. And yet many devices that are part of the Internet are not uniquely-addressable nor have unique IPs, as this 192.168.x.x computer I'm typing on aptly demonstrates. Topically, the layers of protocols is exactly what enables that.
  • Daniel B
    Daniel B over 9 years
    No, again, and for the last time: MAC addresses are not necessary. It would be perfectly possible to drive a network entirely by IP. Let’s forget about switches and make everyone receive everything. That’s where Ethernet started, after all. Then, do tell, why wouldn’t I be able to just throw a packet to some IP in there? The receiver would surely pick it up. And if it was on another network, there’s the gateway, which knows how to get there. Incidentally, it would also receive the packet. This is simply and totally unrelated to public and private IP ranges and the like.
  • user2449761
    user2449761 over 9 years
    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.
  • Ross Presser
    Ross Presser over 9 years
    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.
  • cpast
    cpast over 9 years
    IPoAC is a poor choice for internal communications; pigeons work better outdoors than indoors
  • OrangeDog
    OrangeDog over 9 years
    @user2449761 people have only listed the silly ones. Instead of ethernet you could use bluetooth, dial-up, GPRS, LTE, USB, DSL, token ring, etc.
  • kasperd
    kasperd over 9 years
    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.
  • tfrascaroli
    tfrascaroli over 9 years
    @DanielB Think about it for just a fraction of a second: If everyone got a static/dynamic general IP, it would have to be from the ISP. Then how do routers know the scope of the local network to not throw every packet out there in the wild? Because you must agree that we indeed need private local networks, so we can set private stuff. How would you handle the requests from the outside? Imagine you want a local server, inside the privacy of your home, and you don't want it connected to the internet, just your PCs. How do you reject outsiders, if you don't even know who they are?