Here’s a quick tip, that also applies to any linux machine using dhcpd
.
Every now and then my Raspberry Pi or my router can reboot, and I’m not certain than my Pi will get the same IP address from the DHCP server.
Sure, I could fix it on the DHCP server using the Pi’s MAC address, but if you’re a lazy bum like me you can tell dhcpd
to request a specific IPv4 address.
Add theses lines in /etc/dhcpd.conf
:
interface eth0
static ip_address=192.168.1.42/24
static routers=192.168.1.1
You NIC is probably going to be eth0
, but make sure to set the 2 last lines to the correct parameters (client address, netmask and gateway).
You can get your current IP configuration by running the ifconfig
or ip a
commands.
Once it’s done, restart the dhcpd
service or reboot.