ian-whitestone / rpi-security-system

Building a home security system with a raspberry pi + Python + Slack
11 stars 2 forks source link

dynamic IP addresses #16

Closed ian-whitestone closed 6 years ago

ian-whitestone commented 6 years ago

While I was on vacation, I lost control over the system since the IP address changed on my raspberry pi.

Need to investigate the best way to assign a static IP.

ian-whitestone commented 6 years ago

Solved by changing the DHCP lease time on my router to forever:

quote from here:

"The customary way to keep a device consistent in its IP address usage is to assign it a static address. However, if your DHCP server (which is probably in your router) supports one of two features — configurable lease times or reservations — you'll be able to use DHCP while reducing the frequency of address changes or eliminating them altogether. If your router supports either feature, you'll find the settings under DHCP, LAN or a similar-worded heading."

ian-whitestone commented 6 years ago

Okay that didn't work, the IP was changed again 😒

Followed instructions here, and added the following to the end of my /etc/dhcpcd.conf file:

interface eth0

static ip_address=192.168.0.17/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1

interface wlan0

static ip_address=192.168.0.17/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1