Hi every body!
let say we have following set up:
Mac address of h1 is mh1
mac address of r is mr
mac address of h2 is m2
h1 has following config:
ip address 126.96.36.199/24
default gateway 188.8.131.52/24
arp table at h1:
Let say h1 sends a packet (184.108.40.206) ,the ip address of h2.
h1 sends the packet to r
r delivers the packet to h2.
h2 sends the packet to h1.
h1 builds its arp table with following entry.
My question if h1 sends another packet, it will send it again to r. So why does h1 build arp entry for h2 which h1 will never check. every time h1 has to sends a packet to h2, it first finds if the destined packet 'ip is on same same subnet as h1's ip. if it is not, it simply sends a packet to gateway . So in this situation though h1 builds an entry "220.127.116.11 macr" but it is not using this entry. The logic h1 uses to decide if the packet needs to be sent to gateway is simple: check if the destined ip address is on same subnet as h1.If not, sends it to gateway. So why waste memory by building entry 18.104.22.168 macr?
Thanks a lot!
Giuseppe is exactly right.
Hosts will only ARP for addresses that are on the same subnet.
first of all H1 will create an entry for H2 only if it set to use itself as its default gateway (= it is relaying on proxy-arp).
if H1 has default gateway 22.214.171.124 it uses the ARP process to find the MAC address of its default gateway and creates only one entry for it.
if you use arp -g you cannot find an entry for 126.96.36.199 on H1.
For example I'm connected to the internet, my pc has a default gateway I didn't ping any other device in the subnet
C:\Documents and Settings\eitaltel15>arp -g
Interfaccia: 10.55.49.57 --- 0x2
Indirizzo Internet Indirizzo fisico Tipo
10.55.49.1 00-e0-b6-05-f4-39 dinamico
as you see only one entry.
check if the def gateway = pc ip address in this case the PC will ARP for every possible address.
Hope to help