If my computer has an IP address,why does it need a MAC address?
-
3In order to give the best answer to you, could you expand your question to include why you think you would not need a MAC address if your computer has an IP address?– Brett LykinsSep 22, 2013 at 16:10
-
1I would recommend picking up a good basic book on Networking and reading it; will be worth it. It will answer this question and many more: amazon.com/Computer-Networking-Top-Down-Approach-Edition/dp/…– Manoj PandeySep 22, 2013 at 18:02
-
5This sounds pehaps snarky, but it is the simplest way to reduce the confusion. Why did you put an ethernet NIC in your computer? Answer that question, and it answers the question about the necessity of a mac address.– Mike PenningtonSep 22, 2013 at 18:39
-
5@Reprovo, the only place where comments/answers really make this statement is when the OP responds to Teun Vink's answer with a desire to avoid networking models in the answers. If you don't know the why's and how's of the network models, you really don't understand your network and "getting the job done" will either be much more painful or create additional problems. There are many things you don't really need to know as a network professional (for example, how bits are put on the wire, etc), but the network models are not something they can avoid getting at least a basic understanding.– YLearnFeb 9, 2014 at 14:17
-
2@user1369975, I think you are missing the point. We are not saying the question is invalid, nor are we saying people don't need to learn. However this is a site for network engineers/professionals and asking to frame an answer here while ignoring the basic foundations of networking is not reasonable. If you want an answer not directed at other network professionals, you should ask it on one of the other sites such as SuperUser.– YLearnFeb 10, 2014 at 18:07
10 Answers
Without going into OSI model, TCP layer, etc.:
Back in time, networks were created: some computers would communicate with each other to share something. TO do that, they need to know who was talking and who was being talked to. So, instead of giving each computer a name, we gave them an ID. This ID is called MAC address, is should uniquely identify each computer.
(ok, identify each network card, but back that time, you could think of one MAC address for each computer).
There wasn't a unique specification on how computers would talk to each other: many protocols appeared: TCP/IP, IPX/SPX, and so on. Each protocol would specify things as they thought were ok. For example, IPX/SPX would address each computer using the MAC address and some more information.
But the TCP/IP protocol was designed a little bit different: they decided that having an virtual address, made of 4 bytes (0.0.0.0 to 255.255.255.255) was enough, and was even easier to manage: it doesn't matter if your network cards all have a similar MAC address or not; we'll group our computer so that all TCP/IP address that began with 10.0.x.x. are part of the engineering group, and those of 10.1.x.x. are the printers, and...
So, if a TCP/IP address needs to communicate with another, is just uses the TCP/IP address. But the network devices need to know to which network card that message is going, so they, somehow, translate the TCP/IP address with to the MAC address.
Why not simply eliminate the MAC and instead use just TCP/IP ?
some reasons:
- easy to group TCP/IP addresses,
- all devices are built to take care of the MAC address, in that low-level requirement, and would need to be changed.
- despite being the vast majority (I think :-P ), some other protocols are still in use and they rely on the MAC address.
-
Why not simply eliminate the MAC and instead use just TCP/IP ? perhaps we don't need the services of the whole stack Feb 11, 2022 at 20:35
MAC addresses and IP 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 (especially the router/gateway to the rest of the network/internet), since every layer is using underlying layers. On the page mentioned earlier you can find some nice diagrams explaining the protocol suite in detail.
-
,thanks a lot for your answer but it would be better if anyone could give an answer,without going into the specifications of the O.S.I. Layer or T.C.P. Layer Sep 22, 2013 at 16:44
-
12If that's too hard, this really isn't the site for you. You could argue this question is off-topic as it is, since this is considered common knowledge for network engineers.– Teun Vink ♦Sep 22, 2013 at 17:04
-
11@user1369975, the models you reference are the frameworks for how networks are designed to operate (both hardware and software). Without that basic understanding, there would be no meaningful answer to your question. That would be similar to asking (about a US citizen), "if they have a name why they need a social security number" without allowing mention of government in the answer.– YLearnSep 22, 2013 at 18:45
-
6Think of a MAC address as a description of a house on your street. To your neighbors, they will all understand "The green house" or "Mr. Johnsons house" or "The duplex on the corner" -- These are comparable to a MAC address, descriptive only locally. An IP address is publically routable, so it would be like using the full addres: 123 Main St, Somewhere, CA 92069. Then I guess IP to MAC would be like the mailman coming to the street and yelling "WHO IS AT 123 MAIN?!?!?" and Mr. Johnson hearing him and saying "Here, the green house!" I guess? Horrible analogy. Sep 26, 2013 at 10:27
-
3That explains why it's needed given the current architecture. But why was the architecture designed that way in the first place? I could easily imagine a world where there are only local IP addresses and WAN IP addresses. It's technically possible. Jul 27, 2015 at 10:34
When you understand that IP-to-IP communication is really just a series of MAC-to-MAC communication taking place at each router hop, then you'll see why both are necessary.
The IP header of a packet leaving your workstation destined to an IP in a different subnet will maintain the source IP and destination IP, forgetting about NAT for the moment. [Later, I will discuss what happens when the destination is within the same subnet.] The Ethernet header contains your source MAC and the destination MAC of your default gateway. There's no knowledge of the final destination MAC from your perspective. That first router will rewrite the source MAC to itself and the destination MAC to the next router hop, and so on, until the packet arrives at the last router that is directly connected to the destination subnet.
To attempt a simple illustration, consider the L2/L3 headers as a packet moves from the source IP (sIP) to a destination IP (dIP) and the source and destination MACs are rewritten along the way -- fs=first-source and ld=last-destination, and r1-r3 are routers:
fsMAC-r1MAC / sIP-dIP
r1MAC-r2MAC / sIP-dIP
r2MAC-r3MAC / sIP-dIP
r3MAC-ldMAC / sIP-dIP
Any L2 switches involved will not modify the MAC addresses.
Now for communication to another IP within your subnet, direct MAC communication is needed, but to get that MAC addr requires the ARP protocol that uses a broadcast in the subnet to find it. By the way, this is how your workstation gets the MAC address of your default gateway that must exist in your same subnet.
-
6So to summarize,
MAC
is what gets the message from one hop to another, while IP keeps track of the original source and destination. This seems analogous to a post office, where I address my letter to Grandma in Phoenix, but the mailman who picks it up from the mailbox only cares about bringing it to the post office, and the post office only cares about bringing it to the sorting center etc... Jun 24, 2014 at 17:17 -
5My question however is, why have a separate protocol for MAC? Why not just determine the next IP address to hop to, and store current source/destination IPs alongside original source/destination IPs? Jun 24, 2014 at 17:18
-
@Imray: First problem with eliminating the MAC protocol requires a redesign/rewrite of the Ethernet and TCP/IP standards. Second, IP is not the only protocol at L3 that uses MAC addresses at L2 to communicate. Third, MAC addresses are normally tied to hardware (burned-in) addresses on NICs while the IP at the higher level are allowed to be somewhat arbitrary for flexibility. Fourth, MACs are only locally relevant while IPs are globally relevant (not considering more recent changes with NAT'ing and private addresses that were not part of the original design). Jun 28, 2014 at 8:20
There isn't anything physically stopping you from designing a network which has just IP addresses for L2 and L3. Then 'ethernet switch' would learn the SIP address of incoming packets and flood or forward towards a DIP address.
However, this network would only ever support IP, when the next-generation of IPvX come's, it would not work, as the 'ethernet switch' couldn't support that protocol. You also couldn't run various other protocols, like IPX and AppleTalk, or some new protocol you're developing and testing in your home.
Abstraction layers increase development speed and encourage innovation, as you don't need to rebuild the whole house to change a window.
Now you could have ran the same ethernet switches and migrated your network in between from IPX to IPv4 to IPv6, without touching your LAN at all.
-
There is nothing physically stopping you from designing this network, other than these components, which exist only in your imagination: A) an ethernet switch that learns source IP addresses B) an ethernet NIC without a mac address Sep 23, 2013 at 13:02
-
IP doesn't provide any mechanism for forwarding across broadcast-type networks, so your "switch" would essentially be a brouter.– Zac67 ♦Feb 13, 2022 at 13:43
The IP address and MAC address serve different (but crucial) purposes:
The MAC address gets a frame from one NIC to the next. The IP address gets a packet from one Computer to the Server
So given the following:
Source Computer <---> RouterA <---> RouterB <---> Destination Server
What directs the packet from the "Source" to the "Destination" is the IP address. But what gets the packet from the Source Computer to RouterA, and then from RouterA to RouterB, and then from RouterB to Destination is the MAC addresses.
You can see the relationship in this illustration:
-
3Of course, it is very common for the router-to-router links to use a protocol that doesn't have MAC addresses.– Ron Maupin ♦Apr 12, 2018 at 14:49
-
@RonMaupin Yes. Of course. But... how is that relevant given the question asked specifically about MAC addresses =)?– EddieApr 12, 2018 at 14:53
-
5It just seems that your answer implies there will be a MAC address assigned at every hop, which can be misleading. It also works if your diagram shows MAC addresses on only the first and last hops. It is a bit incomplete, which is why I made the comment.– Ron Maupin ♦Apr 12, 2018 at 14:58
-
1MAC addresses appear only on IEEE type of devices 802.3 (Ethernet), 802.11 (Wifi) etc. On serial links such as HDLC, FrameRelay, ATM there are no MAC addresses Feb 11, 2022 at 20:16
To start with, this is a very good question, which touches upon the basic network foundations.
The bottom line to your question is, we don't really need a MAC address in order to achieve connectivity. Theoretically, a network could be built implementing IP addresses alone!
However, some practical difficulties may arise out of using such a scheme. If you expect to manually assign an IP address to each network device, then you may avoid the major pitfalls. However, if you need to automatically assign IP addresses, as when there are too many network nodes to manually administer, then there is no way to make sure each node is allocated exactly a single IP address, or a predetermined number of them, because you cannot tell one from the other, unless the address distribution entity can uniquely and unequivocally identify the requesting device, e.g. by its MAC address, which is assumed to be unique for any device in a LAN.
Such an unidentifiable device may repeatedly ask for additional IP addresses and, eventually, wreak havoc on the network viability.
Back to the topic, all you need to establish an IP-only network, is to let network interface adapter's Data Link Layer pass through any data frame it receives, directly to the Network Layer, regardless of any MAC comparable address type, where it can be filtered according to its destination IP address, instead of being filtered at the Data Layer.
Just to illustrate the concept, assume a network is established by interconnecting RS-232 UART ports: UART devices don't have MAC addresses, or any other unique identifier, for that matter, yet you could construct a local network using UARTs and IP addresses alone, providing you install the proper UART drivers.
Hope this passage gave you some insights on the subject.
To be as simple as possible:
A Mac Address is the physical or virtual address of your NIC card or network interface. From a computer on a network's standpoint, it is the physical address of that computer's NIC card. It is used to bring information to that computer on Layer 2 of the OSI model.
The IP address is required on layer 3. You require it to communicate with computers on different subnets and devices.The IP Address verifies "where" the device is located within a network.
The IP addresses and Mac Addresses are used in tandem. Address Resolution Protocol is used to link the two together by resolving IP Addresses to Mac Addresses within the Link Layer within a single network.
You might want to also check here for a more in-depth explanation.
-
1Keeping it Simple: If you have a Name, you identify yourself in the locality. You need to have a SSN, to keep you identified at the Global level Mar 14, 2014 at 11:57
The IP protocol provides the foundation to support the notion of subnets and routing. This means IP doesn't assume your destination is on the same network as you-if it's not, your traffic needs to be forwarded through an intermediary device such as a router. IP has TTL and Hop Limit fields that support this.
Ethernet assumes that the destination MAC is directly reachable when data is shipped out of its interface. Ethernet was originally designed when the most common way to connect computers in a network was through a physical bus topology. Even though almost all wired Ethernet traffic is switched now, logically, it still works like a bus topology. So the underlying assumption with Ethernet is that the node with the destination MAC is physically on the same network as the source. There is no such assumption with IP.
I guess you could "hack" Ethernet into doing subnets and routing. But you might as well engineer a protocol that doesn't rely on the low-level details and assumptions of Ethernet, and that's why we have IP.
To keep things simple, we can't use MAC addresses for the simple reason that the space of these addresses is FLAT. Why do we mean by that?
Knowing the MAC address doesn't inform you about the location (routing) of that address. So we need a more hierarchical type of addresses, addresses that we can summarize.
For analogy purposes imagine that every house in the world has a unique number, if I decide to send you a letter by specifying only your number, the mailing service will have no idea how to reach you (the only way is to copy that letter and send it to everyone in the world, hoping that one of these copies will reach you eventually -- this is what we call flooding--)
To solve this problem, we use a more hierarchical type of addressing (house number + street name + district name + town + county name). This time, the mailing service has not to know the exact location of an address, but just a part of it (and this is exactly what happens with IP: Routers have route summaries)
MAC address represents the hardware ones(IDs), its assembled it is constant and different systems in our network made by different vendors have very different range of mac address so that they are difficult to arrange as a network. But using IP address we can arrange the devices in our network in arrange that is simultaneous addresses.
Also we can not send our mac address to outside networks