Please help me with one doubt regarding ARP requests. Based on my understanding the subnet of an IP is identified by it's Subnet Mask so consider this scenario:-
Suppose Device1 with IP- 30.129.33.225 needs to talk to a Device2 with IP- 30.113.220.62.
i)If Device1 know the Subnet Mask of Device2 IP-
It calculates and finds out Device2 to be on a different subnet hence for the communication IT SENDS THE DATAGRAM(packet) to THE DEFAULT GATEWAY---NO ARP REQUESTS.
ii) If Device1 doesn't know the Subnet Mask of Device2 IP -
This is my doubt. What does Device1 do? Does it send a broadcast ARP request thinking of Device2 to be on the same subnet as its? How does any networking device calculate the subnet mask or how do they identify the subnet of an IP and decide whether to ARP or route to GATEWAY.
The scenario is important because in my case Device1 is a Network Device Discovery Appliance, it fetches IPs from the Switch MAC table/ARP Tables and then pings the IPs to find out if they are alive/exists. To my knowledge Switch MAC Table/ARP Tables does not contain Subnet Mask. Only Route Table has Subnet Mask information I believe. So does Device1 send an ARP broadcast of the form "who has 30.113.220.62(Device2 IP)" "tell 30.129.33.225(Device1 IP)" or Device1 calculates the mask by some means and finds out Device2 to be in different network hence routes the packet to Default Gateway?
Please guide me. Thank you