-2

I learned that in a local network computers that communicate inside this network not only need the IP address, but also a MAC address.

Is this a relict from the early days of computer networking?

Because when I have the IP address, I have the "address" )or the identity) of the host I want to talk to. No need to get the MAC address of the destination host. You also do not require MAC addresses when you talk to a computer in the public network - here also you just need the IP address.

It seems that MAC addresses are used to do an IP-MAC mapping inside a switch in a LAN, but it seems redundant since the switch already should know which port leads to which host with a given IP address. The switch knows the IP addresses of the connected hosts, it knows at which port to send the data from to the correct host with the correct IP address.

I also know a MAC address identifies a physical hardware device in a host. Maybe it is needed when a host has multiple hardware network devices? In an analogy, the IP address would be the postal address where to deliver a package to, and the MAC address would identify the entry to take (like main entry, rear entry, chimney)? Is that the reason of a MAC address? But if so, it still would not matter. It would not matter through which hardware device the data has been delivered, as long as the data has been delivered to the correct address (IP address)...

I've read What is the exact use of a MAC address? but don't feel it provides a satisfactory answer.

Alex
  • 570
  • 4
  • 31
  • 60
  • 1
    It’s because of protocol layering and modularity. – Daniel B Feb 10 '23 at 07:56
  • I do not understand what you mean by that – Alex Feb 10 '23 at 08:19
  • Does this answer your question? [What is the exact use of a MAC address?](https://superuser.com/questions/623511/what-is-the-exact-use-of-a-mac-address) – Peregrino69 Feb 10 '23 at 08:22
  • No, saw that answer before but it does not really explain the use of MAC addresses, i.e. why they are required instead of just IP addresses. I also saw a video in which the routing is explained in detail and where the MAC addresses are used in a switch - but still the IP addresses can be used instead of MAC addresses. – Alex Feb 10 '23 at 08:24
  • It'd be a good idea to put "I've seen this" in your question... I flagged this as a duplicate, but retraced the flag now and try to provide more satisfactory answer. – Peregrino69 Feb 10 '23 at 08:38
  • 1
    Is a network without MAC addresses and only IP addresses technically feasible? Yes, absolutely. It would not be Ethernet anymore though. – Daniel B Feb 10 '23 at 08:38
  • So it is more a "historical" reason then ? – Alex Feb 10 '23 at 08:40
  • IP can run over other media than Ethernet. For example, wireless, a modem, the new interstellar ansible protocol that will be developed in the next century. Protocol layering means you can do whatever you want on the lower protocol, for example use MAC addresses; it doesn't affect the IP protocol. – dirkt Feb 10 '23 at 08:42
  • But why would you use MAC addresses? What is the purpose of using MAC addresses instead of just the IP address? The IP address uniquely identifies a host with whom I want to communicate. What is the benefit of a MAC address in that context? Also, in the public area you don't require a MAC address at all! It does not serve a purpose. – Alex Feb 10 '23 at 08:43
  • Read about the OSI model. – gronostaj Feb 10 '23 at 08:49
  • So it IS historical! Ok thanks – Alex Feb 10 '23 at 08:59
  • 1
    Not so historical. Network layering is not just "historical", it's practical. – Nikita Kipriyanov Feb 10 '23 at 09:16
  • @NikitaKipriyanov Then I do not understand. As far as I can see everything in a LAN can also be done using an IP address instand of a MAC address. An ARP table would not be required and the MAC address table would become an IP address table in a switch. I still do not understand in what cirumstances a MAC address is essentially required... – Alex Feb 10 '23 at 09:18
  • You can run IP over other layer 2 protocol than Ethernet and... there will be no MAC addresses (if that protocol doesn't use them). But that will be the exactly same IP supported by the same code in the OS. MACs need to distinguish between hosts in the Ethernet segment (and in different segments there could be the same MACs). IPs are globally unique (at least, seen like this). Take @gronostaj advice, learn OSI model to understand why there are different kinds of "addresses" in the network. Those are on different layers. – Nikita Kipriyanov Feb 10 '23 at 09:22
  • I understand there are different layers, but I just learned how routing is done in a LAN and I do not see any reason why to use MAC addresses. Just because the OSI model says so, we do it? But am I correct you also could create a switch with does not use MAC addresses at all and all internet would work as before without any changes to the hosts? Would that work? If not why not? – Alex Feb 10 '23 at 09:24
  • MAC addresses distinguish nodes in a multiple access network which Ethernet and WiFi are. There are multiple hosts behind a single link, you select which one you need by specifying its MAC. Of course switch can read IP and forward based on that and there are switches that do exactly that (L3 switches), but suddenly you introduce IPv6 and that switch becomes a brick of a garbage, because this is not IP anymore and addresses are different and it doesn't know how to work with them. Yet, if you are able to run IPv6 over Ethernet (you are), all old switches are still valid and will happily work. – Nikita Kipriyanov Feb 10 '23 at 09:28
  • Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/142753/discussion-between-alex-and-nikita-kipriyanov). – Alex Feb 10 '23 at 09:29
  • Don't continue with questions. Just accept it is like this and learn OSI to really understand layering, because your questions show clearly you currently don't understand what it is for. It is for code reuse, hardware reuse and several other economical and technical reasons. This creates need to have addresses on all layers. Why aren't you ask "why IP addresses, why switch can't just see the computer *name* and forward packets to it"? This is the same thing, just even higher layer is in play. Host name is "address" of some kind, too. URL is address of some kind, too. All of them are needed. – Nikita Kipriyanov Feb 10 '23 at 09:32
  • I do not understand. Why is more information that just the IP address required, if in public area I ONLY USE ONE SINGLE IP ADDRESS? It work without a MAC address! I do not need to know the MAC address of the server of a website, for example. What you just said that you need more than the "address" of a host is incorrect. Sending a letter to a house I also only need the address... – Alex Feb 10 '23 at 09:37

4 Answers4

2

Networking isn't quite as simple as it seems. We're talking about a layer cake, there's a lot of things happening under the surface. It's important to understand that communication has 2 levels; physical and logical.

Everything networking is defined by IEEE 802 standards. Ethernet is governed by 802.3, WiFi 802.11.

The first layer is Physical, OSI Model Layer 1. Here we have only electricity, radiomagnetic radiation and light; actual physical cables, antennas and interfaces. Everything on this layer is dumb, the devices have no awareness of each other whatsoever.

On top of physical is the Data Link Layer, OSI Model Layer 2. This is where the ones and zeros get translated to modulations of the signal, and vice versa. This is the minimum requirement for devices to be aware of each other, and to be able to communicate at all. Because multiple interfaces can be connected to a single L2 network segment, each interface must have a unique L2 identifier, i.e. hardware address - the MAC address.

The Protocol Data Unit on this layer is called frame, and the structure is:

+--------------+-----------------+---------+------------+
| SenderL2Addr | RecipientL2Addr | Payload | ErrorCheck |
+--------------+-----------------+---------+------------+

L2 frames can only be forwarded within the same subnet and broadcast domain. Devices in the same subnet / bcast domain communicate using L2 addressing.

Next one up is the Network Layer, OSI model Layer 3. This layer handles transmissions between networks. To allow communication on this layer each device must have a unique L3 identifier - the IP address.

The protocols on this layer neither do nor need to have any knowledge of physical medium, and they don't care about pysical transmission; that's L2 job. The PDU on this layer is called a packet, and the structure is:

+--------------+-----------------+---------+------------+
| SenderL3Addr | RecipientL3Addr | Payload | ErrorCheck |
+--------------+-----------------+---------+------------+

During transmission the L3 packet is encapsulated in the L2 frame, it's the payload. So when the data hits the wire, the frame actually looks like this:

+-----------+-----------+-----------+-----------+---------+--------+
| SndL2Addr | RcpL2Addr | SndL3Addr | RcpL3Addr | Payload | ErrChk |
+-----------+-----------+-----------+-----------+---------+--------+

Because IP is a L3 protocol, it has no method for handling actual data forwarding on the physical level. So without L2 protocols data simply cannot move between systems.

Of course it would be theoretically possible to remove L2 with its addressing from the picture entirely. However - as already said - this means we're not talking about 802.3 and .11 anymore. New standards would be required, all protocols would need to be re-written from the ground up, new chipsets would need to be designed, manufacturing processes changed to produce them, new devices would need to be designed, new manufacturing processes to produce those...

Excluding certain enterprise-class networking devices L3 is handled on software, but L2 is on hardware; i.e. chips. That means your phone wouldn't be able to communicate using WiFi, as its WiFi hardware is designed according to 802.11 standard.

The only realistic way for the transition to happen would be through natural device retirement cycle. That's a slllloooowwwww process.

The idea of re-designing networking this way is magnitudes more demanding than IPv6 adoption. It was introduced 1995, but took off only about a decade ago. The adoption globally is around 40%. So while I can imagine a future where MAC addressing is scrapped (tho' I don't really see a reason why) it's VERY far in the future indeed.

Peregrino69
  • 4,526
  • 2
  • 22
  • 30
1

Some more context: I learned that MAC addresses are used in a Switch of a LAN to map the port of a switch to a certain MAC address. But why not map the port of a switch to a certain IP address? That should work exactly the same way to route a package from a source to a destination host ...

It would, but then your switch would be limited to IPv4/IPv6 (or even just IPv4 if it was older). It would practically just become an IP router.

But there actually exist various other things that run over Ethernet but are not IP, such as several "pro audio" protocols – and in the past, there used to be even more.

(For example, an IPv4 LAN would have coexisted with a NetWare IPX-based LAN, and/or a Xerox XNS LAN, and/or a DECnet LAN, and/or an OSI CLNP LAN... all on the same ethernet.)

When Xerox originally invented Ethernet, it did use the same addressing at both Ethernet level and network (Xerox Pup) level. According to their own articles, this turned out to be too inflexible.

u1686_grawity
  • 426,297
  • 64
  • 894
  • 966
  • But I am asking about the connectivity of computers by IP address. When learning about the OSI model layer 3 is only about IP, and so is my question. So when talking about the IP alone, why taking the deviation of creating an IP-MAC mapping at all? Without that mapping things might work easier and faster, no? – Alex Feb 10 '23 at 16:50
  • For one – "When learning about the OSI model layer 3 is only about IP" – Only if you completely disregard how the OSI model even came to be. The original OSI layer 3 protocol wasn't IP, it was CLNP – IP was its competitor, and not even the most popular one at that. If your learning materials imply that IP is the only layer 3 protocol to ever exist, they're lying (by omission or otherwise). – u1686_grawity Feb 10 '23 at 18:51
  • Not to mention that even now, there are two different protocols – with different address lengths – so it still doesn't make any sense to "talk about the IP alone". – u1686_grawity Feb 10 '23 at 18:58
0

A MAC address (although it can be spoofed) is the only way to uniquely address a device or network interface. An IP address (I assume you're talking about IPv4) is not unique, can be randomly assigned to other interfaces and needs to be aligned to the network the device is connected to. A device can have more than one IP address and having a dynamic IPv4 address (as in DHCP) can be very useful. DHCP cannot work without a MAC address or something very much like it.

Then there is the important fact that IP (v4) is not the only network protocol.

StarCat
  • 1,165
  • 1
  • 7
  • 12
  • Then I do not understand how my local computer is able to talk to google.com, or 8.8.8.8 without a MAC address? You just said IP addresses are not unique, so how can I talk to computers outside the LAN using IP addresses only? – Alex Feb 10 '23 at 08:18
  • Accessible host all bear unique IP addresses. At least, you see them as unique, there could be NAT, but for you it's all hidden in logic of system performing NAT and all peer IP addresses are unique. And, contrary, in different segments there could be same MACs, and this actually happens frequently in case of VLANs, because all VLAN subinterfaces have the same MAC but exist in different segments. – Nikita Kipriyanov Feb 10 '23 at 09:23
  • @Alex: To be honest, you should read about the basics of networking, especially how different protocol layers work together.. To answer your question, one would have to start at the very beginning, this is not the purpose of this site. – Rob Feb 10 '23 at 09:52
  • Yes I looked into it and I realized that in the LAN all should work find using IP adresses only. A host has an IP address and a switch knows which port goes to which IP address. No MAC addresses required. – Alex Feb 10 '23 at 09:53
  • @NikitaKipriyanov So the MAC address identifies a specific hardware in my computer. I understand the MAC address is part of an Ethernet frame. But still, for the routing of data from one computer to another computer a MAC address does not seem neccessary, as the destination computer has a specific IP address. The MAC address then only tells the computer which hardware device should handle the data it received from another computer. Maybe that is the purpose of a MAC address? That the correct hardware device handles the incoming data? – Alex Feb 10 '23 at 10:09
  • @Rob Yes I am looking into this, I see videos and tutorial. But none of them actually explains the basic WHY a MAC address is used for routing, hence my question! – Alex Feb 10 '23 at 10:09
  • I just watched the video https://www.youtube.com/watch?v=LkolbURrtTs but it is still not clear my the MAC address has to be used. The first router might have an IP address at 10.1.1.1, so sending the data to that router should be enough so that is can route the data to the destination address. So no MAC address required. – Alex Feb 10 '23 at 16:47
-1

No, MAC is not a rudiment. It's a requirement precisely for Ethernet and WiFi due to their multi-access feature, to distinguish peers behind the same link. MAC is not always needed; think of a serial link with IP running over PPP, there are no MAC addresses, because there is only one peer on the other side of the link, and no need to distinguish between them.

Think about physical city. There are postal addresses (like "100 East Davie Street Raleigh, NC 27601. United States"), and there are routes in terms of metro stations, like go to line 1 or A or "red" and travel up to station "station". And you can't use a car or a bus, you are required to use the metro to travel around the city.

The first (postal) is like IP address. The second (station name) is like MAC address. Continuing the example, if there is a single railroad line and there are no intermediate stops, there is no need to even have names for stations, you always travel to "other end"; this is how PPP works.

Nikita Kipriyanov
  • 2,564
  • 11
  • 28
  • So a MAC address is a requirement only if computers in a LAN communicate without a switch? Sorry, I still do not understand – Alex Feb 10 '23 at 09:43
  • Why can't you just tell me? I will look into OSI model and will come back with questions – Alex Feb 10 '23 at 09:45
  • Can you suggest a tutorial, video that addresses exactly my question of the WHY a MAC address is needed? – Alex Feb 10 '23 at 09:52