cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
4956
Views
10
Helpful
6
Replies

IP Packet Traverse along the Router and Switch

noxkrugger
Level 1
Level 1

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?

3 Accepted Solutions

Accepted Solutions

bvsnarayana03
Level 5
Level 5

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

View solution in original post

keeleym
Level 5
Level 5

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

View solution in original post

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

View solution in original post

6 Replies 6

bvsnarayana03
Level 5
Level 5

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

keeleym
Level 5
Level 5

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

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

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

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 ?

Thank you.. appreciate that
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Review Cisco Networking products for a $25 gift card