09-16-2007 10:46 PM - edited 03-05-2019 06:30 PM
Hi all
when a pc needs to talk to another one on a lan, how does the arp broadcast work, is ip involved at all ? as on my packet sniffer is says "arp broadcast who is x.x.x.x tell x.x.x.x ? does it need to talk via ip first ?
cheers
Carl
09-16-2007 10:59 PM
No it doesn't. It cannot talk IP yet because it does not know the MAC address yet. That is what ARP is all about. ARP is Ethertype 0x0806, whereas ARP is 0x0800.
Kevin Dorrell
Luxembourg
09-17-2007 12:25 AM
can you explain to me then what exactly happens when pc a talks to pc b on same lan, and also if routed ?
cheers
09-17-2007 12:40 AM
Carl
Same subnet
===========
Pc A = 192.168.5.2 255.255.255.0
Pc B = 192.168.5.3 255.255.255.0
Pc A wants to send packet to PC B. First PC A compares the destination IP address with it's subnet mask ie.
192.168.5.3 255.255.255.0
From this it determines the network is 192.168.5 and it knows it's own network is 192.168.5 so it's knows that PC B is on the same subnet.
So it checks it's arp table. Assuming PC B mac-address is not in ARP table it broadcasts out an ARP
source Mac = Pc A nic
destination Mac = Broadcast address
All PC's on subnet receive the broadcast but only B has the correct IP address contained within the arp packet so B responds with it's own mac-address back to A. Both A and B now record each others mac-address to IP address mapping in their arp tables.
A can now send traffic to B and vice-versa.
Routed
======
Pc A = 192.168.5.2 255.255.255.0
Pc B = 192.168.10.2 255.255.255.0
Again PC A compares destination IP address with it's own subnet mask.
The destination network is 192.168.10 and PC A knows it's network is 192.168.5 so it knows it is not on the same subnet.
So PC A consults it's routing table. Most pc's only have a default gateway so lets assume that is the case. The default gateway for PC A is 192.168.5.1.
So it checks it's arp table and again assuming it isn't there it arps out for 192.168.5.1 mac-address.
The router answers and PC A sends packet
source mac - PC A
destination mac - 192.168.5.1 ( router )
source IP - 192.168.5.2
destination IP - 192.168.10.2
Packet arrives at router. The router looks up the destination IP address 192.168.10.2 and sees that it has a different interface connected to that subnet. So it looks up the mac-address of PC B.
Again if it isn't in there it will broadcast an ARP for PC B's mac-address. Once it has it it then sends the packet to PC B
source Mac address - 192.168.10.1 (router interface connected to 192.168.10.x subnet)
destination mac address - PC B
source IP address - 192.168.5.2 (PC A)
destination IP address - 192.168.10.2(PC B)
HTH
Jon
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide