Drive corruption, Containers, and Static IPs. Oh My!
Shortly after publishing the first post in this series to get a headless Raspberry Pi setup, the flash drive in my Home Automation Pi (running Home Assistant) became corrupted. No real problem, as I can easily recreate the setup since I use Docker containers and have my configuration in Github. I popped a new flash drive in the RPi and it would not get the same IP Address from my router. I tried for at least an hour to get my router to provision the same IP to my Pi. I finally gave up and decided to just configure my Pi with it's own static IP.
Static IP for your Raspberry Pi
SSH into your Pi (using your IP address, of course):
ssh pi@192.168.1.5
Now we edit /etc/dhcp.conf...
sudo nano /etc/dhcpcd.conf
Look for the line: "# Example static IP configuration:"
Then uncomment the lines underneath and edit based on your network configuration:
interface eth0
static ip_address=192.168.1.5/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1 8.8.8.8
CTRL-X, Y, Enter to save your changes.
Reboot your device:
sudo reboot
Disable Wifi
I know, I know I said that I hardly ever use wired LAN connections any more but for a few things I think it's worthwhile. One place I use a wired connection is my Home Automation server
sudo nano /etc/modprobe.d/raspi-blacklist.conf
add:
blacklist brcmfmac
blacklist brcmutil
CTRL-X, Y, Enter to save your changes.
Reboot your device:
sudo reboot
Conclusion
Well this was short and sweet. Now we have a static IP for our Raspberry Pi and we've disabled the WiFi (well I have - you don't have to disable your WiFi).