1
2
I'd like to be able to connect a Raspberry Pi to a company network via Ethernet and discover its IP address using ARP. I would like to be able to do this on both Windows and *nix machines.
However, after I initially connect the RPi to the network I can't find it in the ARP table using arp -a
(at least on Windows 7). If I hook the RPi up to a monitor and use ifconfig
to find its address on the network, I see it's using an address that isn't present in the ARP table.
If I then try to connect to the RPI using the address I've found from ifconfig
, the connection succeeds. After doing this the RPi shows up in the ARP table at that address.
I have limited knowledge of ARP. Can anyone explain what the cause of this is, and if there's a way I can either get the RPi to reliably show up in the ARP table after connecting to the network or force it to show up using a kind of scan. As stated above, I'd need a solution that works for both Windows and *nix machines.
1Relevant username haha. I'll try this on Monday when I get into work again. – Tagc – 2017-07-15T00:21:05.323
This helped get me off to a great start. I've made some improvements here (https://pastebin.com/fDfghrX4). This helped get me off to a great start. There were about 100 dynamic entries, so I filtered by a part of the MAC address that all Pi's share. After another 20 minutes of googling and bashing my head against my desk, I also figured how to extract just the part of the string with the IP address (how is batch this terrible?).
– Tagc – 2017-07-17T07:39:14.257If you edit your answer to incorporate this (hesitant if I should edit it myself), I'd be happy to accept this answer as the best solution. – Tagc – 2017-07-17T07:39:55.390
Just as an aside, since you can execute batch files using git bash, I can now just execute
ssh tagc@$(./find-pi.bat)
to login to my RPi, regardless of the IP address our company's DHCP server has assigned it. :) I also double-typed something by accident in my second comment, sorry about that. – Tagc – 2017-07-17T07:48:02.887@Tagc Had to change to get more than one PI. Your first for would only get the last one as one set command would overwrite the previous. Otherwise good idea to use the manufacturer prefix to catch all Raspberry PIs. I have a batch which uses this to identify all manufacturers MAC from http://standards-oui.ieee.org/oui.txt
– LotPings – 2017-07-17T08:57:46.067I only anticipate having one RPi connected to the network, but thanks. – Tagc – 2017-07-17T09:20:48.170
@Tagc Thanks. Well I needed a more general solution (having a zoo of an a,b+,22b,23,2*0w) and follow up readers can participate the advantage. – LotPings – 2017-07-17T09:30:38.340