2

When the Sender gets to know that the destination is in a other network ( by doing the AND operation with the subnetting adress of its network ) what are the procedures followed, so the packet does reach at the host side

Suppose we are sending from PC-A to PC-B My questions are

  1. The first packet from the host will contain the destination host's address or default gateway's address as destination ?

    if default gateway's address is there in the header packet as destination, then after reaching to the default gateway's address, how does it know where to ( PC-B ), the data will be sent ? ( because we didn't write the destination address as PC-B rather we wrote destination as default gateway). Does both original Destination address ( PC-B ) and default gateway's address travel at a time ?

  2. Assume that data reached at the last router/network. I am sure this time destination address will be of PC-B. So the question is how does the network decides to drop the packet in PC-B ? By comparing its MAC address or the HOST portion of IP address of PC-B's address ? ( Please I am really going crazy over this logic, I am not getting any satisfactory answer, please kindly describe it )

Thank You

Admin please, if you think the question is been repeated then please post a link in replay but i have not found the valid/satisfactory answer to my second que.

5

I think you are confusing layer 2 (MAC) addressing and layer 3 (IP) addressing. It's a common mistake for beginning networking students. It doesn’t matter whether you are the first hop or the last hop – the process is the same:

PCs and routers use their hardware address to send data to each other, based on their physical connections. In the case of Ethernet, it’s the MAC address. So when one Ethernet device wants to send to another, it uses the MAC address.

PC-A sends a packet with the destination IP address of PC-B. The MAC address will be the MAC address of the default gateway.

An important thing to remember is that as the packet travels from source to destination, the layer three information (IP address) is unchanged. The MAC addresses change as the data moves from one layer 2 segment to another. So as the packet moves from router to router, the destination MAC address will be the MAC of the next-hop router.

The Layer 3 (IP) address is used to determine which physical interface the sender will use, and the MAC address of the device on that interface. Again, whether the recipient is a router or the end host, the process is the same.

The sender uses the network portion of the IP address and the routing table to determine which physical interface to use. If the routing table indicates a next-hop address, the sender uses ARP to determine the MAC address of the next hop.

If there is no next hop, the sender uses ARP to determine the MAC address of the end host. The last hop router will determine that PC-B is on a locally connected network, so will send the data with PC-B's MAC address. Again, the IP addresses are unchanged.

  • Ty Ron, I had never read that from anywhere that IP address doesn't change, now it makes sense. Please one last doubt after reaching the last Router/network it will know that destination host is there, so when it will send the data to the last host, which one it takes as parameter to determine the HOST, MAC address or HOST's IP address. Please clear me if my question is incorrect. Again ty ty. – dillip_beta Jul 7 '14 at 13:43
  • 1
    I'm not sure I understand what you're asking, but when the last hop router sends the packet to the host, it is exactly the same as if PC-A and PC-B are on the same network. The router determines the host is on the local network, based on the IP address. It then creates a layer 2 frame and sets the destination MAC address to PC-B. – Ron Trunk Jul 7 '14 at 14:16
  • ty Ron, ty clearing the basics, I was really struggling there – dillip_beta Jul 8 '14 at 4:30
  • Just to be clear one thing, After the packet reaching to the destination network, in the final network it treats as a LAN for forwarding the data, i.e by the help of MAC address. So my question here is whether we use LAN or WAN in the final delivery of data we take the help of MAC address. So what is the need of host portion ( IP address have Network portion, subnett portion and Host portion ) because we don't take the help of host portion for transmitting the data in the final stage, rather we take the help of MAC address. Thank You RON – dillip_beta Jul 8 '14 at 6:27
  • 1
    I expanded my answer to address your question. Hope it helps. – Ron Trunk Jul 8 '14 at 16:12
4
  1. The frame from the sender will contain the gateway's MAC address. Within that frame the IP packet will contain PC-B's IP address. The first-hop router will forward the packet based on PC-B's IP address using its IP routing table.

  2. If the last-hop router has a directly connected interface in the same network as PC-B but does not have a MAC address for PC-B, it will send an ARP request out onto the network to get PC-B's MAC address. Once it has that, it will forward the packet onto the segment with PC-B's MAC address and PC-B's IP address as the destination.

Edit: If PC-A and PC-B are on the same segment, the router doesn't get involved at all. PC-A sends the ARP request for PC-B, and PC-B responds with its MAC address. PC-A then sends the frame onto the segment using PC-B's MAC address as the destination.

  • Ty ben. Just for my doubt clarification in case of you point of view ( answer no 2 ), if " last hop-router doesn't have the MAC address of PC-B ", my question is does ARP request always send if the destination is in the same network but the source is not having its MAC ? Also does any router is capable of sending a ARP request ? If yes then who in the router is responsible for initiating the ARP request. I know ARP is off topic to this question but it would be very generous of you if you can answer this please. Thank You – dillip_beta Jul 8 '14 at 4:38
  • @dillip_beta I have edited my original answer. Please let me know if that answers your questions. – user6423 Jul 10 '14 at 14:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.