Simple network configuration for a headless Raspberry Pi
I have a new Raspberry Pi 3 B, and I didn't want to bother with a monitor and keyboard for it. The Internet showed me what turned out to be a fairly simple configuration if you know your way around systems, but I didn't find it all put together in one place. So here's the quick sketch:
The most straightforward thing was to plug an Ethernet cable between my Macbook and the Pi. On the Macbook, I could configure the wired network interface by hand, or in System Preferences, with a static IP address in a private network, like 192.168.77.1.
For a brand-new Pi, I plugged the microSD card into the Macbook USB with an adapter for the micro card. The boot partition gets mounted on the Mac, so I edited cmdline.txt
to include ip=192.168.77.2
. I also created an empty file called ssh
, which causes the Pi to run an ssh daemon one time at boot.
Boot the system, then ssh from the Mac to the Pi using the numeric IP address. Change the default password, and turn on the ssh daemon with raspi-config
.
That's it. The Macbook and the Pi talk to each other just fine, which is good for local hacking. The next step is to set it up on the WiFi, but because I can get its wireless MAC address, I can set a fixed address in my DHCP server, and then it can just sit on the network.