0

I have a problem that I have been chasing for a while where no Raspberry Pi on my network will get a DHCP assignment over Ethernet. WiFi is OK, but I am tired of setting up all of my Raspberries with static IPs.

On my home network, I have 45 devices. Most are on WiFi/DHCP, and a few are on Ethernet/DHCP. My servers are on Ethernet/Static IP. Only the Raspberry Pis are giving me a problem of getting an IP by DHCP over Ethernet.

It is entirely possible that my crap of a router provided by Verizon (FIOS) doesn't like the Raspberry Pi. I have an NAS device that also has a DHCP server, but it is currently disabled. In order to rule out the DHCP server in the router, could I somehow tell this Raspberry to use the DHCP server on my NAS? (Can I even run more than one DHCP server on my network?)

3

To elaborate the answer from @Milliways: there must run only one DHCP server on a subnet (broadcast domain). if you run two DHCP server you definitely run into problems. This implies that you cannot address a specific DHCP server. This all is by design and definition of the DHCP protocol. It prohibits running more than one DHCP server on a subnet. There is a concept that you can have a second fall back DHCP server if the first one fails but this is a complicated process between the two DHCP server so the clients only see one DHCP server all the time.

When a device starts up it does not have an ip address so it cannot participate on the IP communication. It can only send a broadcast with mac address to all other devices and ask "someone out there, please give me an ip address". This makes clear why there must be only one DHCP server. Otherwise all DHCP server will response. But broadcasts cannot pass a router. So you need a DHCP server for each subnet.

For example you have two subnets 192.168.10.0/24 and 192.168.20.0/24 connected by a router. Then you can setup a DHCP server for each subnet. They will not conflict because the router will block the broadcasts. You can also setup a DHCP relay on the router if it provide this option. Then you need only one DHCP server. The relay will transfer the requests from the other subnet. This has the advantage that you only have to manage one DHCP server.

Most router with a wifi access point and wired ethernet connections will bridge the subnet of the wifi with the subnet of wired ethernet so you only have one subnet for all connected clients. This is what a bridge does: it merges different physical subnets to one broadcast domain. Here you must have also only one DHCP server for all devices.

Because we don't know what exactly is your network configuration you have to decide what to use:

  • two DHCP server on different subnets or
  • one DHCP server on one subnet and a DHCP relay on the router for the other subnets or
  • one DHCP server for a broadcast domain with bridged subnets
1

You should only have a single DHCP server on a network.

You can have multiple networks, each with independent DHCP servers. Generally the devices will use the DHCP server on the network (or network segment) to which they are attached.

Your question has insufficient information to provide a more detailed answer.

  • What else do you need? I can get a DHCP IP over Ethernet on everything BUT any Raspberry Pi. – user3573562 Jan 18 at 3:46
  • 1
    At the least you would need to describe the network topology. You seem to have asked similar questions, but if your router doesn't work the simplest course would be to replace it or disable DHCP on the router and attach a router and connect the Pi to that. I have several routers in my home network, but only a single DHCP serever. No amount of fiddling with the Pi is going to make it work. – Milliways Jan 18 at 3:55
  • OK, only one DHCP per net. I kind of like the idea of running my own DHCP server on a Raspberry Pi but the router is also my WiFi AP and I have several static leases defined on the present router. Sounds like a major project. – user3573562 Jan 18 at 4:34
  • Yes, I've asked similar questions over the past months- I have been chasing this problem at least that long. I plan to try Seamus' test, but it will have to wait until no one else is using the net. More details to follow. – user3573562 Jan 20 at 3:32
1

It is possible that your Verizon router doesn't like your Raspberry Pi, but I don't think that's your problem. Why? Because RPi's DHCP client daemon dhcpcd is fairly robust, and not known for being an issue. You may wish to read man dhcpcd to learn the details, and discover options, log file locations, etc. Reading man dhcpcd will help you learn DHCP!!

However, it is certainly possible to enable the DHCP server on your NAS, and investigate whether or not that makes any difference. As @Ingo has mentioned, you must have only a single DHCP server on your subnet at any given time. Therefore, before you enable the DHCP on your NAS, you must disable the DHCP server in your Verizon router.

Once you've done that, you should be able to reboot your RPi, and evaluate whether or not that's made any difference. You won't need to make any adjustments or changes to the RPi config files; the RPi should find the new DHCP server automatically. If it doesn't, then I'll hazard a guess that your RPi was mis-configured somehow. But we'll cross that bridge (no pun intended) when we come to it. Let us know how this works, and we'll go from there.

0

You can set your DHCP server by typing:

sudo leafpad /etc/resolv.conf

Then change values of domain (named server) or nameserver (ip gateway) e.g.

domain attlocal.net
nameserver 192.168.1.254
  • I submitted an edit to remove the spammy link. Please see How not to be a spammer. – tripleee Jan 18 at 6:02
  • why its not spammy link? i have legit tutorials in DIY section. – zenofall Jan 18 at 6:11
  • Did you read the page I linked to? The third bullet point explains this pretty clearly I think. Which parts do you still need clarification on? – tripleee Jan 18 at 6:17
  • Thanks, i had missed that. Appreciate it. I won't do it again. – zenofall Jan 18 at 6:24
  • 3
    Editing /etc/resolv.conf is an exercise in futility - it will be overwritten as the comment "# Generated by resolvconf" in the file itself indicates. – Milliways Jan 18 at 6:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.