Layer 2

Unanswered Question
Sep 29th, 2008

Hi, I am bit confused in Layer 2 data link layer as Network layer knows the destination address to send the data then why it requires MAC address of the reciever machine. Can anyone explain perfectly?

I have this problem too.
0 votes
  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 0 (0 ratings)
Loading.
Tarun Lohumi Tue, 09/30/2008 - 00:33

IP's are used to communicate only across 2 LAN's, when communicating inside a LAN only MAC Addresses are used which are on the datalink layer.

The last lookup would always be for a MAC Address - never for a IP. Once it is determined which port that MAC address is on frame is forwarded on that port.

Joseph W. Doherty Tue, 09/30/2008 - 04:42

If the network layer has an L3 address, e.g. an IP address, it doesn't know where the host is physically on a L2 segment since hosts actually look for L2 frames that contain their L2 address, or MAC address. A host will "broadcast" a L2 frame that effectively says whatever host "owns" the L3 address please respond with your L2 address. Within IP this is accomplished using ARP. Once the sending host sees the L2 address it records the translation from an L3 address to an L2 address. Again within IP, this is seen in the ARP table on the host.

ray_stone Tue, 09/30/2008 - 04:53

Thanks!! Agreed!! As I know ARP works on L3 layer and machine send a broadcast in a same network where no router comes in between the hosts sender and reciever to know the exact machine but what happens when the request is for the other machine which is hosted in the other network and where router comes between Sender and Reciever as I know router drops the broadcast. Now how sender machine will reach to reciever machine and can you explain all parts of layer 2 as well. Thanks!!

Joseph W. Doherty Tue, 09/30/2008 - 05:24

"what happens when the request is for the other machine which is hosted in the other network and where router comes between Sender and Reciever as I know router drops the broadcast"

If there's a router between subnets, one of two things happens. Either the source (sending) host doesn't realize the destination (receiving) host isn't on the same network segment and it broadcasts for the destination's MAC, or the source host knows the destination host isn't on the same network segment and hands off the packet to a gateway router. The latter is usually accomplished by the source host having a gateway router address, the former by the router "pretending" to be the destination host (proxy).

Once the gateway router gets the L3 packet, it will forward the L3 packet toward the destination network segment (this assumes it either "knows" the destination host's network or has some type of default route that will eventually get the packet to the destination host's network).

Routers, if more than one, will forward the L3 packet hop by hop toward the destination network. Once the router is reached that's connected to the destination segment (which could have been the first gateway router too), it will behave much like a source host in that it too will obtain the destination host's MAC address and forward the L3 packet within a newly constructed L2 frame.

migcrown1 Mon, 10/20/2008 - 10:12

I'm fairly new here so please correct me if I'm wrong, but to my knowledge data that is sent from the user to the sender goes through a process of encapsulation and de-encapsulation. during these processes, the frame being sent or received by the data link layer (layer 2) should contain information that it understands in order to route it to the correct destination. This is the MAC address. As the frame is moved either to the network layer or the physical layer, the info or the "frame" is translated for it to be understood by the next layer and then routed to the destination.

Joseph W. Doherty Mon, 10/20/2008 - 15:15

No, not exactly. Frame isn't translated for it to be understood by the next layer and then routed to the destination. It's more the converse.

Initially, you work down the logical stack layers as you transmit, performing encapsulation (e.g. TCP segment is encapulated within packet which is encapsulated with frame), and the converse upon receipt. You may go up and down layers 1 and 2 multiple times as you transit a network.

For instance, IP routing is done at layer 3, and the packet logically remains the same from source to destination. Within Ethernet, the layer 3 packet is encapsulated in layer 2 frame which has a MAC to get the frame to the next physical destination on the same logical wire. "Transit" routers interfaces will be the frame's source and destination MAC and they will change every L3 hop.

fjcardenas-1 Tue, 10/21/2008 - 05:58

Lets try:

Imagine you are a packet (L3) and you want to travel from McAllen to London to visit your cousin, so you know the address from your home (Source IP Address) and you know your cousin's address in London (Destination IP Address). You will need several transportation means and there will be several stops (Routers).

You jump into the bus (encapsulation) that will provide service to you and it knows it's source address in McAllen (source MAC Address) and it knows it's destination in Houston (Destination MAC Address in it first stop). Once you get to Houston (first stop or router) you forget about the previous used MAC address and you find the next transportation mean to go to London.. so, you jump into the airplane and it knows it's source address (Source MAC Address) and knows where it is going (Destination MAC Address)... once you get out of the airplane in London you get into a taxi cab and you hand him the destination address (Destination IP address) so that he knows where to go.... the taxi cab knows his source address in the airport (Source MAC address) and with the address you handed him he finds out the destination address (MAC address).... once it gets to it's destination address you get out of the taxi (de-capsulation) and you (the packet) get to the final destination (your cousin's address in London - destination IP address).

I hope this makes sense.

Please rate it if it was helpful.

Actions

This Discussion