Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. And see here for current known issues.

New Member

IP Packet Traverse along the Router and Switch

I have been wondering for a long time how the IP Packet will traverse from end host to a L2 switch to next hop and another routers and finally to another end of a host. What is the source & destination IP address,MAC address along the traversal of the packet?

1 ACCEPTED SOLUTION

Accepted Solutions
Hall of Fame Super Blue

Re: IP Packet Traverse along the Router and Switch

Hi Michael

Excellent explanation. The only thing i would add is when it gets to the default-gateway router.

Before the router resorts to it's default route (if indeed it has one) it will consult it's routing table to find the longest match on the destination host.

If it doesn't have an explicit entry for that subnet and assuming normal routing procedures and ip classless is turned on then it will use the default route.

Edit - oops one more thing.

Step 1 with the router. If the router forwards the packet onto another router then the source MAC is the exiting interface, the destination MAC is the interface on the next hop router that receives the packet.

The IP source and destination will always stay the same.

Jon

5 REPLIES

Re: IP Packet Traverse along the Router and Switch

The L3 header (src & dst IP add) remain unchanged throughout the transit. However, L2 headers (src & dest mac add) change from hop to hop.

Silver

Re: IP Packet Traverse along the Router and Switch

Hi There

If the destination host is on the same subnet as the originating host, then the source IP & MAC will be that of the originator and the destination IP & MAC will be that of the destination host. The packet will not go past the layer 2 switch.

If the destination host is on a different subnet to the originator then the packet will leave the originator with the source IP & MAC of the originator but will have the destination IP address of the destination host BUT the destination MAC of the default gateway.

If the default gateway router is also attached to the subnet that the destination host is on then the router will send the packet out towards the destination host with the source IP address of the originating host BUT the source MAC of the interface on which the packets exits. The packet will have the destination IP address & MAC of the destination host.

If the default gateway router does not have an interface on the same subnet as the destination host then it will do one of two things.

1. If a default route is configured on the router, the router will forward the packet to its default router with the source IP address of the originating host, the source MAC address of the exiting interface, the destination IP address of the destination host and the destination MAC of the next hop routers interface.

2. If the default router has no default route configured it will drop the packet.

I hope this is understandable and does not confuse you more amd more importantly I hope this is correct :).

Best Regards,

Michael

Hall of Fame Super Blue

Re: IP Packet Traverse along the Router and Switch

Hi Michael

Excellent explanation. The only thing i would add is when it gets to the default-gateway router.

Before the router resorts to it's default route (if indeed it has one) it will consult it's routing table to find the longest match on the destination host.

If it doesn't have an explicit entry for that subnet and assuming normal routing procedures and ip classless is turned on then it will use the default route.

Edit - oops one more thing.

Step 1 with the router. If the router forwards the packet onto another router then the source MAC is the exiting interface, the destination MAC is the interface on the next hop router that receives the packet.

The IP source and destination will always stay the same.

Jon

New Member

Re: IP Packet Traverse along the Router and Switch

Thanks a lot Michael and John. Right now, you have solved my issue

New Member

Re: IP Packet Traverse along the Router and Switch

hi there, am i right in saying that when the packet reaches the interface of the other network, if the layer 2 address is not in the forwarding table of the switch, will the router send an arp request then add to the mac address table ?

2300
Views
5
Helpful
5
Replies