Recently, I found myself in a situation where I had to connect to a Raspberry Pi to set it up for a presentation, but I did not have:
- A keyboard and/or other input device to use to type anything into the Pi
- An HDMI cable to connect the Pi to a display so I could view anything on the Pi
- A microSD card reader so I could modify the contents of the Pi's microSD card
Because of this, none of the standard methods of setting a static IP address, reconfiguring the Pi's WiFi configuration, or logging in on the Pi itself to find it's IP address or set things up so I could connect over a local network would work.
I remembered that Mac OS X handily includes an 'Internet Sharing' feature, which sets up a bridged network interface so your Mac is effectively a router and DHCP server to any devices connected to the shared interface.
In my case, I just wanted to take a stock Pi, and be able to connect to it via SSH, but I needed an IP address I could use to connect to it. Since it's configured to use DHCP for it's default wired network connection, I plugged in a standard ethernet cable between my Mac and the Pi's LAN port, then did the following steps:
- Open System Preferences, and go to 'Sharing'
- Click on the 'Internet Sharing' row in the service list, and choose an interface to share from (in my case, WiFi)
- Check the box next to your wired network interface (in my case, 'USB 10/100/1000 LAN')
- Check the 'On' checkbox next to Internet Sharing to enable it
- Wait a few seconds to let things work
- In Terminal, type in
ifconfigto get a list of all interfaces—there should be a new
bridge100interface at the end of the list
- Copy that IP address, then add 1 to the last number. That should be the IP address of the Pi.
ssh [email protected][bridge100-ip-address-plus-one-goes-here], and log in using the default password
Next time, I'll remember to bring a keyboard and HDMI cable. Or a microSD card reader.