Linux config question

I know this isn’t a homeassistant question and this isn’t a linux forum, but I’m taking advantage of this being one of the most helpful forums with people who happen to be linux knowledgable around. So with all flattery done, here is my question.

My normal setup is to use a reserved dhcp address to tie a machines mac address to a reserved IP address. Think of it as a cross between static and DHCP. This works great for everything except my raspberry pi’s. Some of my RPI’s seem to understand, others won’t pickup the address to save their lives.

I’m doing my network config in the /etc/network/interfaces file.
I set interface eth0 for inet manual, sometimes it gets it and sometimes it doesn’t. Once it gets it, it seems to be rock solid. The problem is getting the RPI to find it the first time.

I have tried inet dhcp and have finally resorted to inet static and all the ip address, netmask, gateway, broadcast stuff to go along with it.

Any thoughts?

To clarify, your DHCP server is setup to assign static IPs out to your Pi’s via their MAC address, but some are not working and require a manually setup static IP address in the interfaces file?

yes that’s right. At work we call them DHCP Reservations.

That is the correct term, I was just making sure I was correctly understanding your situation. I have DHCP reservations setup for multiple services I run on my network from HA to my OctoPi and just setting the interfaces to DHCP has always worked.

For devices having issues pulling the proper IP, check the /var/log/syslog for and DHCP errors as it should be working as configured, unless it is connecting via wired AND wifi at the same time that could throw a wrench in your workings.

Just wired. DHCP is being served by cisco home router. Works for everything else, just RPIs don’t seem to like it… Oh well, I have to go compile openzwave now. Grrrrr LOL

Linksys Cisco or real Cisco? :wink:

If Linksys, stock firmware or modified (ie: Tomato, DD-WRT)?

Linksys Cisco stock firmware last I checked there wasn’t a DD-WRT for this version. It’s their dual wan vpn router.

This may not be a linux solution, but if you want your Raspberry Pi(s) to have a static address, have you thought about assigning the IP address via your router? If your router’s firmware allows it, input the mac address of the Raspberry Pi’s in question into your router and have the router assign the Pi a specific address. This makes the process a lot simpler.

@turboc Are you doing like @gumbo is saying and assigning them in the router? or do you have a separate DHCP server running on your network?

I’m doing what gumbo says. DHCP is served by the Linksys Cisco Router we were talking about.

Then ya i’d see what the syslog says on the Pi to see what’s going on with the DHCP request, the router may not be responding fast enough. It’s hard to say since the router usually doesn’t have decent enough logs to debug from. :disappointed:

Does the Linksys router firmware allow you to enter a DHCP reservation for a particular mac address?

I couldn’t set a static IP address the way I normally do on my Raspberry Pi B 3, so I resorted to using this how to on both my Pi B 3 and Zero W

https://www.modmypi.com/blog/how-to-give-your-raspberry-pi-a-static-ip-address-update

Yes, and it works for every other device I have in the house. Directv boxes, PC’s Mac’s, hubs, TV’s, iphones, etc

Thats what I’ve ended up doing. But I would prefer the DHCP reservation method, and in either case I would like to know why the DHCP reservation isn’t working.

without the log files to see what is going on, it is very hard to diagnose.

I know, I was more hoping that someone had a “oh yea, with RPI’s you need to do this” kind of an answer. It’s not enough of a pain to research it much deeper. :slight_smile:

I’d check the syslog on the Pi to see what the DHCPd is replying to it.

/var/log/syslog

I know it’s the right DHCPd replying to it, because it grabs a different dhcp address than the one reserved for it. Nothing else has a reservation for that address so it’s not a dup address thing. I’ve verified the MAC addressess several times, and cut and pasted it from the address it gets. I cleared the address it got from the dhcp queue so it wouldn’t think it had a reservation already…

What it sounds like to me is happening is that the router think’s it’s already assigned that IP out for some reason or another. If it really bothers you, like it’d bother the crap outta me, factory reset it and put your settings back in. I know it sounds brutal but the leases file may have been corrupted some how in the router’s storage.