I'm setting up a Raspberry Pi Zero as an ethernet gadget using the instructions here.

That generally works but until I can log in to the Pi and configure it to use a static IP address it uses for its IP address a random one picked from the link-local range (169.254.0.1-169.254.255.255). Since I can't guess what that random address is I can't log in to the Pi to configure its static address or anything else.

This Pi is headless, so I can't log in to it directly to get its IP address or configure it to use a static address.

The Chromebook I'm configuring the Pi from doesn't support ZeroConf so I can't use raspberrypi.local instead of its IP address to reach the Pi.

If so, I could configure the static IP address for the Pi when I'm setting up its SD card. Needless to say, I can't modify that card's /rootfs from the Chromebook on which I'm doing this setup (Chrome OS can only mount ext4 partitions like /rootfs read-only).

Setting a static IP address from /boot would allow me to set up Pi Zeros using only Chromebooks, something which would be very useful when travelling and in classes.

While I realise another user did ask you to edit in details (this is fine if it's before it would invalidate answers), I've rolled your question back because: 1) Your edits invalidated answers that had already been added. This is inconsiderate of other users, and confusing to posterity; in future, ask a new question if you are substantially changing the criteria, 2) Your final version of the question is really about how to scan a network with a chromebook, and has nothing much to do with the Pi, or the (more or less unchanged) title of the question. That makes it off-topic here.
– goldilocks♦Aug 2 '18 at 12:31

2 Answers
2

If you can mount the root partition of your SD Card with the ext4 file system on a PC you simply can set a static ip address in /etc/dhcpcd.conf. There are some examples in it. You may consider to boot with a linux live system, e.g. from Debian or Ubuntu or SystemRescue or something else.

You can also use a network scanner running on your operating system. On Linux you can use nmap for example:

debian ~$ sudo nmap -sn 169.254.0.0/16 | grep -B 2 B8:27:EB

Here you will scan for devices from Raspberry Pi Foundation which MAC addresses start with B8:27:EB. Scanning about 65000 ip addresses in this example tooks a time. Maybe you can reduce the range if you can guess what subnet your ip address can be in, e.g. 169.254.7.0/24 with 255 ip addresses.

Thanks for the answer, unfortunately I'm trying to set up Pi's with Chromebooks, which can't mount ext4 file systems. It wouldn't make sense for me to maintain a Mac, Windows or Linux computer just to set up Pi's. On the other hand, I could use a pre-configured Pi for this (I'd set it up once with a borrowed Mac, Windows, or Linux system, then I wouldn't need Mac, Windows, or Linux other than the Linux on the Pi). I would however like to avoid if possible having to have a Pi around just to set up other Pi's.
– dharcourtApr 16 '18 at 3:48

Thanks also for the nmap idea. Although I couldn't use nmap from the Chromebook, I might be able to use Chrome's chrome.socket APIs to create an extension that would achieve a similar purpose, searching 169.254.*.* addresses for Pi's newly set up on the local network. I'll investigate...
– dharcourtApr 16 '18 at 3:50

@Ingo's solution might also work (I've not tried it), but of course you need a PC of some sort that can mount an EXT4 filesystem. Many Linux distros can, and I've heard Windoze PCs can do this, but again I've not tried it myself. I do know you can't mount EXT4 from OS X, and so that limits my range of approaches.
– SeamusApr 15 '18 at 17:28

Thanks for the detailed answer, however I'm looking for a solution that would avoid running Chromebooks in developer mode as this would negate many of the security benefits of using Chromebooks. Additionally most Chromebooks running in schools and enterprises are enrolled in GSuite and have their developer mode disabled.
– dharcourtApr 16 '18 at 3:58

1

You're welcome, and sorry that didn't help. If I could make a suggestion though: including all of your requirements in the OP would help us help you. I'd take another run at a solution, but frankly, after reading your comments to the two answers already provided, I am so unclear on what you're trying to do that I feel it would be a waste of time.
– SeamusApr 16 '18 at 12:39

@dharcourt You might check whether arp is available in crosh without enabling developer mode. Many such commands are, and I have no way to test.
– Bob BrownApr 17 '18 at 12:09

@BobBrown: arp is unfortunately not available in crosh. A list of crosh commands can be found online here and here, though commands are occasionally added and removed over time and may vary by Chromebook model. My Chromebook's crosh supports as subset of the commands listed online, and as far as I can tell none of those provides arp-like functionality.
– dharcourtApr 17 '18 at 17:10