Packet flow in different Network
Last Updated :
25 Oct, 2021
Prerequisite – How ARP works, Packet flow in the same network
To deliver the packet to the destination host, the source IP, destination IP, source MAC address and destination MAC address should be known. Some basic rules for the packet flow:
- If the destination host is present in the same network, then the packet is delivered directly to the destination host.
- If the destination host is present in a different network then the packet is delivered to the default gateway first which in turn delivers the packet to the destination host.
- If ARP is not resolved then ARP will be resolved first.
- MAC address never crosses its broadcast domain.
Explanation –
Here is a topology, in which there is host A (IP address – 10.0.0.10 and MAC address – 000D.BD22.7C22), host C (IP address – 10.0.0.9), host B (IP address – 20.0.0.10), host C (IP address-20.0.0.9 and MAC address – 00E0.A3E2.03DC) and the router (IP address – 10.0.0.20 and MAC address – 000B.BE8E.5201 on fa0/0,IP address – 20.0.0.20 and MAC address – 000B.BE8E.5202 on fa0/1 ).
Now we will try to ping from host A (IP address – 10.0.0.10) to host B (IP address – 20.0.0.10). First, AND operation is performed by source host between source IP address, source subnet mask, and destination IP address, source subnet mask to know if the destination is present in same or different network.
If the result is the same then the destination is in the same network otherwise in a different network. Here, the destination is present in different networks, therefore, the result will be different and the packet will be delivered to a default gateway.
We see that 2 messages are generated ICMP(purple) and ARP(green). ARP has been generated because ARP has not been resolved.
Now as the ARP should be resolved first, therefore the ARP request will be broadcast which is received by switch:
The switch in turn broadcast the ARP request to the host and the router. The PC discards the request and the router accepts it.
Now the ARP reply is unicast to host A by the router as shown in the above figure.
Now the ICMP packet will be unicast to the default gateway (IP address – 10.0.0.20 and MAC address – 000B.BE8E.5201) as shown in the above figures.
Note – The ICMP packet will be unicast to the default gateway as the ARP has been resolved now.
Now the ARP has to be resolved again because the router has to deliver the packet to host B and the ARP table has no entry for host B. Therefore, the ARP request is broadcast in the network 20.0.0.0/24. The packet is received by the Switch which in turn broadcast the request to host B and D. Host D will reject the request and host B will accept it and generate an ARP reply for the MAC address 000B.BE8E.5202 (router fa0/1 MAC address) because the ARP reply has to be given to that MAC address from which the ARP request has been received.
As you can see in the figure, the ARP reply packet is unicast to the router’s interface fa0/1 MAC address(000B.BE8E.5202) and the source MAC is 00E0.A3E2.03DC.
Note – Here, the target MAC address is the MAC address of host B (000B.BE8E.5202). Target MAC address is the MAC address of a device that the host wants to know through its ARP request to resolve ARP.
Now the ICMP echo-request packet will be unicast to the host B as shown in the above 3 figures.
Host B will generate an ICMP echo reply in response to the ICMP echo request for host A which will be delivered to the 20.0.0.20 (router’s interface IP address) first and then unicast to host A.
How does the MAC address never crosses its broadcast domain?
This is the IP and Ethernet header when host A forwards the ICMP echo request to its default gateway. Therefore source IP is 10.0.0.10 and destination IP is 10.0.0.20, source MAC address is 000D.BD22.7C22 (host A MAC address) and destination MAC address is 000B.BE8E.5201 (router’s fa0/0 interface MAC address).
But now when the ICMP echo request message is forwarded from the router’s fa0/1 interface to host B then the source MAC address is changed to 000B.BE8E.5202 (router’s fa0/1 interface MAC address) and destination MAC address is 00E0.A3E2.03DC (host B MAC address).
Here router’s fa0/0 interface MAC address is not used as the source MAC address, instead the fa0/1 MAC address is used as a MAC address. Therefore, fa0/0 is not used in other broadcast domains (20.0.0.0/24 network) therefore MAC address never crosses its broadcast domain. IN this way, PING is performed in 2 different networks.
Our GATE 2026 Courses for CSE & DA offer live and recorded lectures from GATE experts, Quizzes, Subject-Wise Mock Tests, PYQs and practice questions, and Full-Length Mock Tests to ensure you’re well-prepared for the toughest questions.
Take the Three 90 Challenge! Complete 90% of the course in 90 days and earn a 90% refund. Stay motivated, track your progress, and make the most of your preparation time. Plus, enjoy exclusive features like:
--> All India Mock Test
--> Live GATE CSE & DA Mentorship Classes
--> Live Doubt Solving Sessions
Join now and stay ahead in your GATE 2026 journey!
Similar Reads
Packet flow in different Network
Prerequisite - How ARP works, Packet flow in the same network To deliver the packet to the destination host, the source IP, destination IP, source MAC address and destination MAC address should be known. Some basic rules for the packet flow: If the destination host is present in the same network, th
4 min read
Packet flow in the same Network
Prerequisite - How ARP works? To transfer a packet from source to destination, both the MAC address and IP address of the destination should be known. If the destination MAC address is not present then ARP will resolve this issue first then the packet will be delivered to a destination host. There a
5 min read
How do Packets Find a Computer in a Network?
Answer: Packets find a computer in a network by following routing tables and switches or routers forwarding them based on destination IP addresses.Destination IP Address Each packet contains a destination IP address, indicating where it needs to go within the network. Routing Tables Routers maintain
2 min read
Packet Switching and Delays in Computer Network
Packet Switching in computer networks is a method of transferring data to a network in the form of packets. In order to transfer the file fast and efficiently over the network and minimize the transmission latency, the data is broken into small pieces of variable length, called Packet. At the destin
6 min read
How does Ethernet work in wired networking?
Answer: Ethernet divides the received data packets into small parts known as frames. The frame contains information of source and destination address which helps to reach the correct and desired destination. In wired networking CSMA/CD is used by the Ethernet. In this way Ethernet works in wired net
1 min read
Working Of Different layers in Computer Network
Ever wondered how different layers of network work together to send a message. Lets understand some basic terms before getting into details. A Default Gateway serves as an access point or IP router that a networked computer uses to send information to a computer in another network or the internet. A
5 min read
What is a Network Address?
A computer network is a group of interconnected computers that share common or different resources provided on or by network nodes. This sharing or communication between the machines is governed by some set of rules or network protocols. These computers or machines are identified by network addresse
6 min read
What are Gateways in Computer Network?
A gateway is a network node or device that connects two networks that use different transmission protocols. Gateways play an important role in connecting two networks. It works as the entry-exit point for a network because all traffic that passes across the networks must pass through the gateway. Wh
6 min read
How do I Remotely Access a Network PC?
Answer: Use Remote Desktop Protocol (RDP) on Windows, SSH for Linux/Unix, or third-party software like TeamViewer or AnyDesk for cross-platform access.To remotely access a network PC, consider the following methods based on the operating system: WindowsUse Remote Desktop Protocol (RDP). Enable it on
1 min read
Introduction to Telephone Network
Telephone Network is used to provide voice communication. Telephone Network uses Circuit Switching. Originally, the entire network was referred to as a plain old telephone system (POTS) which uses analog signals. With the advancement of technology, i.e. in the computer era, there comes a feature to
2 min read
Difference between Network and Internet
Computers and their systems square measure difficult in their approach, and it gets doubly robust once you need to comprehend 2 terms associated with this subject that act already utilized in the regular language, those mentioned adequately during this article square measure Network and net, they wi
2 min read
Virtual Circuit in Computer Network
Virtual Circuit is the computer network providing connection-oriented service. It is a connection-oriented network. In virtual circuit resource are reserve for the time interval of data transmission between two nodes. This network is a highly reliable medium of transfer. Virtual circuits are costly
2 min read
Next Generation Network (NGN)
Next Generation Network (NGN) refers to a packet-based network and it can be used for both telecommunication services as well as data and it supports mobility. It is able to make use of multiple broadband capabilities, especially Quality of Services (QoS) enabled transport technologies where the ser
3 min read
How to Set Up a LAN Network?
LAN (Local Area Network) is a data communication network that locally connects network devices such as workstations, servers, routers, etc. to share the resources within a small area such as a building or campus. Physical or wireless connections are set up between workstations to share the resources
4 min read
Let's experiment with Networking
Most of us have studied Computer Networks in a very abstract manner. In other words, not many of us know how the abstract concepts of layers and packets translate in real-life networks such as the Internet. Therefore, let us do an experiment and see whether these layers, packets, etc. exist in any r
5 min read
What is Broadcasting in Computer Network?
In computer network, there are various ways in which we can transmit data from one node to another node, one node to multiple node, and many node to many nodes. For each type of transmission, there's a term associated with it. Let's see their examples in brief : For node to node: 'Unicast' also know
9 min read
What is Bridge in Computer Network - Types, Uses, Functions & Differences
The bridge is a networking device in a computer network that is used to connect multiple LANs to a larger LAN. In computer networks, we have multiple networking devices such as bridges, hubs, routers, switches, etc, each device has its own specification and is used for a particular purpose. The brid
6 min read
NAT Hole Punching in Computer Network
Prerequisite - Network Address Translation (NAT) What is NAT hole punching ? The main restriction or disadvantage for a Device under a NAT is that it cannot accept outbound connections. And if any such attempt is made a NAT makes sure that the message reaches the trash can. This restriction is overc
3 min read
How does the Packet Find the Shortest Path in a Computer Network?
Answer: Packets find the shortest path in a computer network using routing algorithms like OSPF or BGP, which calculate the most efficient route based on various metrics.Routing AlgorithmsVarious routing algorithms determine the shortest path for packets to travel from the source to the destination.
1 min read