When packets forwarded from IP layer to layer 2 (bridge /switch),how it reaches the destination address using routing table entries and exchange routing information back to layer3.
Asked
Active
Viewed 5,310 times
0
-
2Related: https://superuser.com/questions/1192669/mac-vs-ip-routing – Mokubai Nov 14 '17 at 08:04
-
1The link between layer 2 and layer 3 is ARP : https://en.wikipedia.org/wiki/Address_Resolution_Protocol – pim Nov 14 '17 at 10:23
1 Answers
2
MAC addresses (layer 2) and routing tables (layer 3) are not related at all.
The routing table is used to find out if a packet should be delivered locally, or routed to some network interface using a known gateway address.
Once the decision is made to route if through some network interface, the packet is delivered by layer 2 in exactly the same way as a direct packet to the gateway IP would: The ARP (address resolution protocol) cache is consulted to find out if a MAC address for the destination IP address (gateway IP address) is known. If not, the ARP protocol is used to obtain the MAC address of the destination, and then the packet is sent to this MAC address, using the source MAC address of the network interface it is sent out from.
dirkt
- 16,421
- 3
- 31
- 37
-
-
As I wrote: Layer 3 hands the packet with the destination IP address (gateway) down to Layer 2. Layer 2 uses ARP to find the MAC address, and pack it into an Ethernet frame. Layer 2 doesn't know about routing tables. Layer 3 doesn't know about MAC addresses. There's a well-defined hand-over point between layers, which is the same for routed and local packets, but the layers are not **related** in any way. – dirkt Nov 15 '17 at 10:19
-
-
-
Your explanation is good,but still i am not clear how they are not related/ – Rakshith KR Nov 15 '17 at 12:24