5

My question is simple, i don't really know if I understand it so I'm asking.

Why do we have both addresses, if we know the ip address of the target and source computer, why do we need some physical address? I've had this question so I have googled that and found that network devices communicate via physical address (MAC address), then why do we have ip addresses?

Does it work like that I know target ip address, and my network devices finds using ARP the physical (MAC) address of the computer somewhere else in the world and sends that there?

Can someone really simply illustrate how both addresses work together? Because I'm really confused about it.

  • Let me answer your question with another question: If you know my MAC address, how will you get the data to me? How do you know my computer is in Washington, DC and not in Barcelona, Spain? – Ron Trunk Nov 28 '15 at 15:57
  • Did any answer help you? If so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you can provide your own answer and accept it. – Ron Maupin Aug 7 '17 at 15:20
5

IP is a layer 3 protocol. It doesn't know anything about the physical media, it means that IP can travel through any media (for example: fiber optic, copper cable, air, etc).

IP relies on a layer below (layer 2) that manages the access to the media. In the case of ethernet each device is connected to a common media (copper cable) and then the device has to identify itself to let know the others it is there, and that identification is the MAC address.

Each device has a MAC address that is used by the layer 2 protocol to access the common copper cable and move frames from one device to the other. It seems to be enough to have communication, however layer 2 protocols doesn't scale well if you have hundreds of devices. Then it is needed a layer 3 protocol as IP.

3

The answer is both technical and historical. IP is the network that interconnect several networks. As ethernet nic have a MAC adress at layer 2, something else is needed at layer 3: IP address.

With IP, 2^128 devices are theorically adressable, whereas MAC address are limited to 48 bit. Keep in mind that ethernet is a flat, commuted, broadcast network: it would not scale worldwide.

But I agree with you on one point: it is totally plausible to have an IP network without ethernet, or at least without a broadcast layer 2 network.

3

MAC addresses are assigned with a vendor identification (OUI) and an identification which is unique to the vendor. There is no order to this in a particular LAN since you will have devices from multiple vendors, and even devices from the same vendor will not be in order.

The IEEE assigns OUIs and defines how the LAN works. This only goes as far as the layer-2 boundaries. Layer-2 needs broadcasts to operate, and each and every broadcast must interrupt and be processed by each and every host on the LAN. This can get out of hand very quickly, placing a practical limit on the size of a layer-2 network. Imagine having you PC pounded by broadcasts from every host on the Internet; it couldn't keep up.

There are also multiple types of LANs which are not directly interoperable. For instance, Wi-Fi (IEEE 802.11) can't directly communicate with ethernet (IEEE 802.3). You would need a translation bridge at layer-2 like used to be used between token ring and ethernet, or you move up the stack to layer-3.

This is where layer-3 steps in. Layer-3 is independent of the layer-2 protocol used by the hosts. It has its own addressing which is independent of the layer-2 addressing. Layer-3 addressing is hierarchical, allowing segmentation of layer-2 LANs so that broadcasts and other communications can be isolated.

If that's not enough addresses for you, layer-4 can have its own addresses, too. For instance, TCP and UDP use addresses which are called ports. Upper layers can have addresses, too, but there is no real standardization for those; the application designer can create any addressing desired for an application.

Hosts are unaware of the layer-2 address of other hosts. They need some sort of layer-2 protocol to help with that, and many were developed over the years, but the limitations of layer-2 didn't allow layer-2-only networking to scale to the size of today's networks.

When a host wants to talk to another host at layer-3 (I will assume IP as the layer-3 protocol for this, but the concept applies to any layer-3 protocol), it must determine if the other host is on its own LAN. It can do this by masking the destination address with its mask and comparing it to its own network. If the destination host is not on its LAN it will need to send the traffic to its configured gateway which will be on its LAN. At this point, the host needs to discover the MAC address on it LAN, either the destination host or gateway. To do this, it uses ARP. ARP sends a broadcast asking, "To whom does this layer-3 address belong?" The destination host or gateway will respond with its MAC address, and the sending host will use that to create the frame and send the traffic. The sending host will also cache the layer-3 to layer-2 resolution for a period of time so that if there is more traffic destined for that layer-3 address, it already has that information.

If the layer-2 destination is the gateway, the gateway will get the frame and strip it off, leaving the layer-3 packet. The router will then determine where to send the packet next, and it will create a new layer-2 frame for the new layer-2 segment over which the packet must travel.

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.