I wanted to know how does a packet actually flow in the network .. For example suppose there are two computers A and B behind a router. Packet for A arrives at the router. Is this packet sent to both A and B and then the packets IP is validated with the computers IP to know the final destination? The reason why i asked this question is because i didn't understand how a packet sniffer works internally
All the hosts in IPv4 environment are assigned unique logical IP addresses. When a host wants to send some data to another host on the network, it needs the physical (MAC) address of the destination host. To get the MAC address, the host broadcasts ARP message and asks to give the MAC address whoever is the owner of destination IP address. All the host on that segment receives ARP packet but only the host which has its IP matching with the one in ARP message, replies with its MAC address. Once the sender receives the MAC address of receiving station, data is sent on the physical media.