0

I have configured the wireless interface on my Raspberry Pi 3 as follows:

allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
wireless-power off
iface default inet dhcp

and have reserved an address (192.168.1.151) for the interface using its MAC address. This works fine and when I boot the Pi all the services start etc.

But after some amount of time (presumably when the DHCP lease expires) the Pi makes another request for the particular IP it was given after boot and it is rejected (my router is running the DHCP server at 192.168.1.1):

Aug 16 15:19:49 pirate1 dhclient[415]: DHCPREQUEST for 192.168.1.151 on wlan0 to 192.168.1.1 port 67
Aug 16 15:19:49 pirate1 dhclient[415]: DHCPNAK from 192.168.1.1
Aug 16 15:19:49 pirate1 dhcpcd[348]: wlan0: pid 6780 deleted IP address 192.168.1.151/24
Aug 16 15:19:49 pirate1 avahi-daemon[335]: Withdrawing address record for 192.168.1.151 on wlan0.

And I can no longer contact the Pi.

Other servers have their IPs reserved in this way and I do not see this issue so it appears to be Pi specific but not too sure what is going on - restarting the Pi and everything is good again.

# uname -a
Linux pirate1 4.19.58-v7+ #1245 SMP Fri Jul 12 17:25:51 BST 2019 armv7l GNU/Linux
# cat /etc/issue
HypriotOS (Debian GNU/Linux 10) \n \l
dippynark
  • 109
  • 1
  • 1
    I don’t know HypriotOS (and don’t use Debian networking). Your interfaces file is inconsistent and incompatible with dhcpcd – Milliways Aug 16 '19 at 22:36
  • In what way? It's taken from a hypriot repo (https://github.com/hypriot/flash/blob/master/sample/wifi-user-data.yml#L51-L54) plus the wireless-power off bit – dippynark Aug 16 '19 at 22:50
  • You have 2 calls to dhcp in interfaces (one incorrect) - anyway this should be detected by dhcpcd which will then disable itself. – Milliways Aug 16 '19 at 22:54
  • could you be more specific about what is incorrect? and why is it incorrect to configure two interfaces using dhcp? Note that this works for hours before I see the error above – dippynark Aug 16 '19 at 22:56
  • using two interfaces at the same time is not unusual – dippynark Aug 16 '19 at 23:06
  • 1
    using two interfaces at the same time may not be unusual but running 2 incompatible networking systems is. See How to set up networking/WiFi - this is for Raspbian, but should apply to any normal dhcpcd system. – Milliways Aug 17 '19 at 00:04

1 Answers1

1

You are mixing up different networking systems. As far as I can see it is old style Debian ifupdown managed in /etc/network/interfaces and Raspbian default networking dhcpcd. From the log I see a DHCPREQUEST from dhclient so I assume that you also use isc-dhcp-client in addition to dhcpcd. If so you have two dhcp clients running on your RasPi. This cannot work.

You should also note that using ifupdown together with dhcpcd need some special attention. Look at Differences between /etc/dhcpcd.conf and /etc/network/interfaces? what's the issue here.

I would say you should decide what networking system do you want to use and only use that one not mixing up them. On Raspbian you have three networking systems out of the box. Look at three different networking systems on Raspbian about this. I prefer systemd-networkd.

Ingo
  • 42,107
  • 20
  • 85
  • 197