0

A colleague of mine is currently trying to fix an issue with a Raspberry Pi 3 machine (latest Rasbian). The isc-dhcpd-server runs without any issues on another similar setup. Inside the /etc/dhcp/dhcpd.conf on both systems the same content can be found including the subnet configuration where it clearly states that 192.168.100.x with netmask 255.255.255.0 has to be used:

# example.org domain and domain name servers configuration
# ...
ddns-update style none;

option subnet-mask 255.255.255.0;
option broadcast-address 192.168.100.255;
option domain-name "project.test";

subnet 192.168.100.0 netmask 255.255.255.0 {
    range 192.168.100.2 192.168.100.253;
}

For some reason though the dhcp server automatically assigns an IP address from a totally different network (note that the Raspberry Pi is not connected to any router etc. and the environment has no connection to other devices or the Internet:

root@rpi:~$ ifconfig
eth0 169.254.221.127 netmask 255.255.0.0 broadcast 169.254.255.255
lo ...

I'm not familiar with dhcp server and all the configuration that is involved in getting it to work properly so I'm probably missing something obvious. Is there some other location where this configuration needs to changed?

Recursively searching inside /etc

grep -rnw * -e "169.254.*"

returned (on both machines) two matches - one in gai.conf and one in networks. The gai.conf is something I've never heard. As for the networks - it's the link-local setting and as it seems this is a default value on many systems (including my own virtual machines that runs Xubuntu 16.04).

  • the adresse you see was not given by the DHCP. it is a fallback that the host assigns to itself (hosts on the same LAN can communicate using those, try top ping on from the other ). if you got that, it means that your dhcp setup is not working for some reason. check the logs and or use tcpdump to see what's going on ) – Raouf M. Bencheraiet Feb 20 '18 at 14:14
1

This address is not DHCP-assigned. The 169.254.0.0/16 range is for "zeroconf" addresses – link-local addresses picked by the system itself, most commonly used as fallback when DHCP is unavailable. If you're seeing this address but not a regular address, it can mean few things:

  • Your DHCP client couldn't obtain a lease and gave up.

  • Or your network profile is actually set to "local-only" (in NetworkManager or similar).

As always, if your DHCP client and server aren't doing what they should, investigate what they are doing – check system logs, use a packet capture tool (Wireshark/tcpdump), and so on.

  1. Is the dhcpd daemon running?
  2. What DHCP client is the rpi using? Is it running? Can you run it in verbose or debug mode?
  3. Does the client send a DHCPDISCOVER, and does the server answer with a DHCPOFFER?
  4. Does the client send a DHCPREQUEST, and does the server answer with a DHCPACK?

The /etc/networks file is not important. Its only purpose (similar to /etc/hosts) is to assign display-names to network prefixes, e.g. when running the route command. Similarly, /etc/gai.conf only contains priorities for sorting DNS lookup results – nothing to do with DHCP.

| improve this answer | |
  • @rbaleksandar : Although grawity said it technically right ("fallback"), let me explain perhaps-more-clearly. The common way for things to work is that when a DHCP client tries to get information from a DHCP client and fails, then it falls back to using the "link local" address range that starts with 169.254. Extremely common causes can involve a problem with the DHCP server (check point #1 from grawity's answer) or just some other networking problem that is preventing the DHCP traffic from occurring the way you probably think it does. – TOOGAM Feb 20 '18 at 14:27
  • Okay, after re-reading stuff a bit, I figured out that "rpi" in point two of @grawity's answer referred to the "Raspberry Pi 3" mentioned in the question. – TOOGAM Feb 20 '18 at 14:28
  • Note that zeroconf addresses are perfectly usable, especially on an isolated network like the OP's network. Using zeroconf addresses spares you the trouble of setting up a DHCP server and configuring clients to use it. – Johan Myréen Feb 20 '18 at 18:02

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.