How does a frame retrieve the recipient's MAC address?

5

2

I am studying a Network+ book named All-in-one CompTia Network+ by Mike Meyers.

In chapter 2 he talks about frames and how he represents them as canisters and the data within the frame contains the recipients mac address, senders mac address, data, and sequence number.

What I don't understand is if the sender is sending a file via the network to the recipient, and this frame contains this data, how does the frame know what the recipients MAC address is before sending it?

In regards to TCP/IP when it contains the recipients IP address, that's understandable how it retrieves that value. But I don't understand how it can retrieve the MAC address, because if that frame comes from the senders computer, goes into the router and copies itself to each and every computer that exists on the network, how did it have the MAC address to know where to go?

Let me know if I'm not making sense.

Sarmen B.

Posted 2012-09-09T20:42:24.690

Reputation: 599

Answers

2

The sender transmits an ARP request (or in IPv6, a Neighbor Solicitation). Basically that is a frame which yells 'which MAC has this IP?'

The owner of that IP will then reply with an almost identical packet, stating 'I have this IP'. That answer also contains the MAC.

This only works on the local network. For all IP traffic not on the local network the packet gets sent to the default gateway. (And obviously, that default gateway is a computer on the local network).

Edit1: Link to the relevant Wikipedia article on ARP

Edit2: The ARP request 'who has this' is obviously a broadcast.

Hennes

Posted 2012-09-09T20:42:24.690

Reputation: 60 739

thanks for the reply, maybe im thinking too deep, or the book will explain later, but say i send a file to a computer named fonzo will the senders computer ask what the mac address of fonzo is? is that how its making the relation? – Sarmen B. – 2012-09-09T20:48:18.353

No. The computer will look up which IP the computer named fonzo has. If it does not know that it will use DNS. Once it has the IP it will look if the PC is on the local network. If it is not the packet for fonzo gets sent to the default gateway. No MAC is needed other than that for the DG. If it is local then it will broadcast an ARP request. Fonzo will answer with a ARP reply. And then the sender has all the information it needs. – Hennes – 2012-09-09T20:50:36.190

Sarmen: Aye, for IPv6 there is that. And there are fixed ARP tables, and computers 'helpfully' answering ARP request for other computers which they remember as being local. But lets leave that for more advanced chapters. :) – Hennes – 2012-09-09T20:54:28.220

This answer is actually wrong. ARP asks the opposite question: who has this ip address and it uses an Ethernet broadcast packet to do it. The result is then stored in the ARP cache. – Brian – 2012-09-10T01:51:17.907

You are right. I reversed them. Will fix. (Mutters a vague excuse of typing an easy answer without engaging the brain). – Hennes – 2012-09-10T11:31:00.790

3

Computers look up the MAC addresses using the ARP protocol, or from their own ARP caches.

Frames are not passed on by routers (you're thinking of hubs or switches), they're de-encapsulated, and then re-encapsulated as new frames with the new MAC addresses for the next hop. A frames and MAC addresses only apply to the local segment, they never get further than that.

rbsec

Posted 2012-09-09T20:42:24.690

Reputation: 71

thanks for the reply, i havent learned about the ARP protocol yet, hopefully it will make more sense when i get there. – Sarmen B. – 2012-09-09T20:50:02.797