1

This is raspbian stretch.

I have net-tools and iproute2 packages installed. That is so far all ive found that looks like might contain the tool from apt-get.

I just want to use the raspi as an always-on linux machine on my network that can send WoL-packets to other machines on my network. I am looking to use arp to discover IP's. I have all the MAC addresses of the machines on my network that I might want to wake up. Also, nmap may be useful, and is also conspicuously absent.

  • Actually I was able to install nmap with apt-get install nmap, facepalm. question remains for arp: Unable to locate package arp – Steven Lu May 11 '18 at 21:36
  • I was reasonably certain that arp was included with raspbian; i.e. it's not necessary to install it. But clearly, you've tried to run it... would you mind running this & reporting the result: find /usr/sbin -name arp – Seamus May 12 '18 at 2:27
  • @Seamus thanks for the sanity check. my init scripts do not clobber $PATH, but it seems that maybe prezto does clobber it. at any rate, /usr/sbin is not in my path, and i do have the program. – Steven Lu May 12 '18 at 6:12
  • Glad to hear you got that sorted, and thanks for the feedback. Based on that, I've posted an answer below that you may find useful and quite easy to use. – Seamus May 12 '18 at 14:05
4

Good news in case you are looking for the "arp scanning and fingerprinting tool": it's in the Raspbian repository and sudo apt-get update; sudo apt-get install arp-scan should help you.

If you don't know the correct or complete name of a package you can search for it:

  • To query the APT cache for "arp" you can use apt-cache search arp | more. This works even offline. I recommend sudo apt-get update prior to avoid outdated metadata.

  • Another option is to use the bash autocomplete feature: in a terminal window just type (without pressing return) sudo apt-get install arp and hit tab twice. Autocompletion will show (not install) all package names starting with "arp".

  • Sometimes it helps to query the Debian repository with an ordinary browser.

  • Like @goldilocks commented you can use the APT package searching utility apt-file (it's not installed by default) to search targeted for apt-file search -x 'bin/arp$'. This will result in net-tools: /usr/sbin/arp which implies the package net-tools is required.

  • To locate a binary you can use find /usr/sbin -name arp (like @Seamus commented) or whereis -b arp.

  • 1
    If you apt install apt-file you can apt-file search -x 'bin/arp$'. Which implies the required package here is net-tools, not arp-scan (although one may require the other or vice versa). The former includes /usr/sbin/arp, the latter /usr/bin/arp-scan. – goldilocks May 12 '18 at 2:06
  • These are all good points. I did end up checking arp-scan, and interestingly running it without any args sees it segfault immediately. Anyway, I have figured out why arp wasn't found, it wasn't in my $PATH – Steven Lu May 12 '18 at 6:13
1

Assuming you already have the MAC addresses of the host(s) you want to wake, you don't need nmap at all. There are two packages available on RPi that will send the required WoL "magic packet" to the host(s) you choose: etherwake is one, and the other one has the unlikely name of wakeonlan :)

Which one is best? My preference is wakeonlan because it doesn't require root privileges to run (no sudo required). You may install them both, and determine your own preferences:

$ apt-cache search etherwake
etherwake - tool to send magic Wake-on-LAN packets
wakeonlan - Sends 'magic packets' to wake-on-LAN enabled ethernet adapters
$ sudo apt-get update 
$ sudo apt-get install etherwake wakeonlan

And now you're ready! man etherwake and man wakeonlan will fill you in on the details for using either of these packages.

As you already know, the host(s) to be awakened will need to have the "Wake-on-LAN" feature enabled. If they happen to be Raspberry Pi devices (or "adult-sized" Debian hosts), there's a good tutorial/how-to that covers that in the Debian wiki.

  • Yep, I can perform the action using just the MAC address, but upon startup it doesn’t seem like the DHCP assigned IP addresses for a given host will always be the same, so I want to do some kind of scanning to ensure I’m SSHing to the right machine afterwards. – Steven Lu May 12 '18 at 17:55
  • That's one way to do it. I've written up some stuff at github that might help. However, if you have a small "PiFarm" as I do, you begin to feel like you're herding cats. I just add them to my DHCP server as a permanent reservation, so they're always where I can find them. – Seamus May 12 '18 at 18:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.