I recently installed OSMC (Open Source Media Center) on a Raspberry Pi 3. Initially I simply let it connect via DHCP and completed the installation and configuration. This went as expected with no obvious issues. Another post will detail out the project, install and lessons learned.
My project required that the Raspberry Pi be setup for DHCP since it will likely be used in multiple locations. However while in locations I control, I wanted to have a consistent IP and so I setup a DHCP reservation within the DHCPD.conf (OpenBSD).
Disclaimer: The issue I outline was not related to OSMC or the Raspberry Pi, but since this was the project I was working on when it happened it all gets some attention.
DHCP Reservation - I got lazy and did something I typically wouldn't or knew I shouldn't. Since I was in the middle of configuring and using the IP address that DHCP assigned, I did the unthinkable and setup the reservation with the same IP. My intent was to complete the setup and then find a suitable IP for it.
Setup was completed, device was running for a week and then because of another issue, DHCP was restarted and at some point the Pi was restarted. The PI wouldn't reconnected to the wireless after the restart. I won't go through every step of troubleshooting but multiple steps were taken like removing the Wifi setup and reconfiguring, connecting to a guest network etc.
On first review of the DHCP logs, I saw nothing that stood out. The PI would only get an IP if I removed the reservation. I don't troubleshoot DHCP much these days, it has just worked so well unless there has been a syntax error in the configuration. After a little more digging, I found an error in /var/log/messages stating that I either needed to remove the reservation or fix the .leases file (/var/db/dhcpd.leases). This struck me as I had eventually changed the reservation to an IP not in the DHCP range.
More investigation revealed that the IP I had chosen for DHCP reservation, actually had been used before (at some point in time) and there was a lease still in the DHCP.leases file with the same IP. I'm not sure the odds on this but strangely this occurred in two locations during my testing.
Had I taken the steps that I knew or once knew to do without fail, this issue would never have occurred. I documented this as a reminder to myself and hopefully to help someone else who might make a similar mistake.
The moment I removed the offending line in the DHCP.leases file, I saw the PI connect to the IP stated in the reservation.
No comments:
Post a Comment