4

I am trying to familiarize myself at the moment with the Ethernet network protocol. However, when looking at the standard a Ethernet frame needs a destination MAC address, and the source address MAC is usually programmed onto the device. My questions is how does the a device get that initial destination address. Such as when you plugin a computer into the network first time how does it discover it's neighbors MAC addresses. Like you need to talk with default gateway to get an IP address to send data outside of the network. I have tried looking at the the standards, and I am not sure to exactly search for.

I found this wiki article Link Layer Discovery Protocol, but it looks to be standardized in 2005 and Ethernet is older than that. So what was done before that? It also seems to be a bit more than just give MAC address.

  • IPv4: ARP, IPv6: ND. LLDP is a method for devices to know something about their link partner. (see also: Cisco's CDP) – Ricky Beam May 20 '15 at 2:56
  • 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 could provide and accept your own answer. – Ron Maupin Aug 11 '17 at 16:54
3

To get the MAC address for a given IP(v4) address, your computer will use the Address Resolution Protocol. For IPv6, the Neighbor Discovery Protocol does the same thing.

The purpose of LLDP is to discover other devices on the network, and the messages are always sent from your own MAC address to well known destination MAC addresses.

3

Ethernet relies on a destination MAC address for frame delivery. The source MAC address will be the MAC address of the outgoing interface which sent the frame. This outgoing interface could be that of the originating node, or of an intermediate router between the originating node and the destination node.

The "neighbor discovery" you're referring to, on an IP network, is the ARP process. Using the term "neighbor discovery" is somewhat of a misnomer here, because there could be multiple devices on the same physical segment that the end host or node is connected to. It all depends on what source host wants to send data to what destination host. All hosts will maintain an ARP table which is essentially a mapping of IP addresses to MAC addresses, which the host will use to send frames to, including that of a gateway, which is used to get traffic off of the local segment.

I would suggest reading more about how ARP works on an Ethernet network. This is essentially an on-demand process that is used to determine the destination MAC address (which is used by Ethernet) that is associated with a given destination IP address in order to pass frames from one host to another.

LLDP is used to provide additional information (other than information that would normally be obtained via the ARP process) between two directly connected nodes, whether it be switch to switch, host to switch, host to router, host to host, etc.

  • Okay let's leave IP out of it. Is there any way just using Ethernet that I can discover the MAC addresses of devices I am connected to? Is there a special broadcast address kinda like LLDP. Since i need a destination address to send to send a Ethernet frame? The reason I ask is because other protocols in the past have built on top of Ethernet. – Keith May 19 '15 at 22:15
  • 1
    You could send a frame to the MAC address equivalent of a broadcast address, which would be ff:ff:ff:ff:ff:ff. However this is non-trivial, because you would then need to be dependent on the hosts to interpret this frame correctly and the means of which to respond to it. In other words, you need to write software in order to make this work. What problem are you trying to solve here? – John Jensen May 19 '15 at 22:40
  • okay so I could structure an Ethernet packet with the destination address as ff:ff:ff:ff:ff:ff, and stuff and DHCP request in that Ethernet frame? Would that work? Would that work for ARP too? – Keith May 19 '15 at 23:28
  • I am curious because I am playing the microchip ENC28J60 and I am trying to learn how networking works at the low level, by trying to implement it myself. A bottom up approach shall I say. – Keith May 19 '15 at 23:36
  • 1
    There is no reason for your computer to discover all the MAC addresses on the network until it actually needs to communicate with someone. You can't really "leave IP out of it", IP is what creates that need to speak to some other host, and then ARP takes care of resolving the MAC address in order to construct a layer two frame that will take the layer three packet to the proper destination. I would suggest reading some already existing Q&As on ARP to learn more. – Eddie May 20 '15 at 0:00

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.