This is kind of a follow up to this post of mine.
I have the mac-address of my phone (samsung galaxy S9; though it shouldn't matter). I want to check if it's on the network or not. It doesn't have a static ip, so I need to check it using it's mac-address.
I'll refer to the mac-address of my phone with [1]
.
This is the "log" of the events:
#phone connected to network
ping -b 192.168.2.255 -c 20 &> /dev/null
arp | grep -i "[1]"
-> successful
#phone NOT connected to network (turned of wifi on phone)
ping -b 192.168.2.255 -c 20 &> /dev/null
arp | grep -i "[1]"
-> successful
The second time, it shouldn't be successful. The phone isn't connected to the network, but it still shows it in the arp output.
My phone doesn't have a static ip-address, but when connecting it to the network, it almost always gets the same ip-address. That's fine. The ping -b
output has always been correct. When my phone is connected to the network, I see the ip-address that it almost always gets in the list (of the ping
command). When my phone isn't connected, I never see it's "standard" ip-address in the output. So ping works and is "up-to-date".
So I assume that arp isn't "up-to-date" as ping is (but this is just my raw guess). I think that arp doesn't update it's table eventhough ping has "made" a new one. But that is what I think based on a comment of the previous post: "You are already doing a broadcast ping, ping -b 192.168.2.255. This should refill the arp table for any online devices with ip address 192.168.2..*"
Help!