Static IP address on RPi WiFi

Dumb question loosely related to SatNOGS ground station. Sorry if it shouldn’t be here.
My 3 RPis have static IP addresses. Since upgrading to buster on my 724 station I can’t seem to give it a static IP address. My router gives the RPi an address so I can connect with SSH and Putty.
Apparently DHCPCD is disabled and it takes instructions from the wpa_supplicant.conf file.

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=AU

network={
ssid=“iiNetxxxxxx”
psk=“0Dxxxxxxxx”
}

I tried adding the static addressing info here but it stops working on WiFi.
something is different when they changed from stretch to buster.
Been searching for answers on the net but lots of old misleading info out there which only adds to the confusion. Apparently there are more ways to configure static addresses and buster is definitely different. I think they don’t use the DHCPCD deamon any more.
Thanks for helping
Bob

Just for clarity, you use DHCP static adresses, not static ones configured on your Pi, right ?

There are 2 ways to use a static address, DHCP static and real static.

  • DHCP static, which from your message is what you use. The static address is defined at the DHCP server (your router) level. The client (your raspberry) doesn’t even know it has a static address and uses a DHCP client as with a dynamic address. There is nothing to configure on your raspberry as by default it will use DHCP. The only thing you need to do is configure your router with the list of static DHCP clients. For each client you’ll need 2 piece of information: the clients MAC address (hardware address of the network interface, wifi in your case) and the desired IP address you want to assign to the client
  • Real static, where no DHCP server is involved. The static address is configured on the client which won’t do any query to a DHCP server. You don’t even need to have a DHCP server on your network.

I’d recomment you use DHCP static especially if your network uses a mix of static and dynamic addresses.

1 Like

My 2 other RPis run Jessy or stretch and both use static addresses set via DHCPCD configuration. Something has changed with buster. Now it looks to be done via wpa_supplicant.conf file or the /etc/network/interfaces file.
Somewhere in my experimentation I came across some text which said DHCP daemon was disabled and in some other web site I read the DHCPCD was no longer supported with buster. All very confusing depending on what you read as some of the info is old.
Looks like I have to go over my old notes I took when I set up the 3 RPis the first time. I had no problems until I upgraded to buster.
Thanks for responding
Bob

dhcpd is definitively still supported in Buster and installed and used by default unless you explicitly configure it otherwise. I have it running as well on servers and raspberries (both Raspbian Buster as well as Debian 64 bit Arm Buster on Raspberry, some freshly installed with Buster some upgraded from Stretch).
If you have a desktop installation and running the NetworkManager, it uses the NetworkManager’s dhcp client instead. What installation do you have on your raspberry, a minimal server image or a desktop image ?

What does
sudo systemctl status dhcpcd
output on your Pi ?

Yes, there is some interaction between wpa_supllicant and dhcpd as wpa_supplicant has to tell dhcpd when the interface is up and ready to get an IP address.

1 Like

Yes at the moment I’m using a dynamic address as I can’t seem to be able to configure my Pi to use a static address.

I used the latest Raspbian lite image from the Raspberry Pi install wiki page.

$ sudo systemctl status dhcpcd
Warning: The unit file, source configuration file or drop-ins of dhcpcd.service
● dhcpcd.service - dhcpcd on all interfaces
Loaded: loaded (/lib/systemd/system/dhcpcd.service; enabled; vendor preset: e
Drop-In: /etc/systemd/system/dhcpcd.service.d
└─wait.conf
Active: failed (Result: exit-code) since Thu 2020-04-09 03:51:11 UTC; 1 day 2
Process: 370 ExecStart=/usr/lib/dhcpcd5/dhcpcd -q -w (code=exited, status=6)

Apr 09 03:51:11 raspberrypi systemd[1]: Starting dhcpcd on all interfaces…
Apr 09 03:51:11 raspberrypi dhcpcd[370]: Not running dhcpcd because /etc/network
Apr 09 03:51:11 raspberrypi dhcpcd[370]: defines some interfaces that will use a
Apr 09 03:51:11 raspberrypi dhcpcd[370]: DHCP client or static address
Apr 09 03:51:11 raspberrypi systemd[1]: dhcpcd.service: Control process exited,
Apr 09 03:51:11 raspberrypi systemd[1]: dhcpcd.service: Failed with result 'exit
Apr 09 03:51:11 raspberrypi systemd[1]: Failed to start dhcpcd on all interfaces

1 Like

Ok, you have dhcpd installed and it tries to start. The output you provided is truncated but it seems dhcpd is not happy about a config in /etc/network/interfaces or any of the files under /etc/network/interfaces.d/
Could you provide a copy of /etc/network/interfaces ?

Alternatively you can just reset the file to the default config:

# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

And remove all files under /etc/network/interfaces.d/

After restarting it will just default to dhcpd on all interfaces, including wifi. So if you configured a static IP on your router it should take it.

If you don’t want to define the static interface on your router you’ll have to set it in /etc/dhcpcd.conf.

Thanks Martin for your response here is my /etc/network/interfaces file

GNU nano 3.2 /etc/network/interfaces

interfaces(5) file used by ifup(8) and ifdown(8)

Please note that this file is written to be used with dhcpcd

For static IP, consult /etc/dhcpcd.conf and ‘man dhcpcd.conf’

Include files from /etc/network/interfaces.d:

source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

allow-hotplug eth0
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet manual

changed manual to static & added 3 lines didn’t work

#address 10.1.1.73
#netmask 255.255.255.0
#gateway 10.1.1.1

    wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
    post-up ifdown eth0

iface default inet dhcp

There are no files in /etc/network/interfaces.d
I have my suspicion about that last statement “iface default inet dhcp”

This part

changed manual to static & added 3 lines didn’t work

#address 10.1.1.73
#netmask 255.255.255.0
#gateway 10.1.1.1
I added it to try and get a static IP. When it failed to work I just commented it out with # and left it there.

It was so easy on the other 2 RPis running Jessy and i think one of them may have been Stretch but it all went bad when I created a new image from the Raspberry Pi wiki https://wiki.satnogs.org/Raspberry_Pi artifacts.zip (Release: 2020030400)

My station 724 is working just fine with .249, It’s just me being pedantic and I want my shack computers to be .70 .71 .72 .73
We have an amazing connected community here helping each other from the other side of the globe in these difficult times. We just need to allow for the difference in time.
Where I live here in Nowra, 160km south from Sydney there is very little amateur activity when it comes to experimenting and trying new things so I’m pretty much a Pioneer here and can’t discuss anything too technical locally.
Thanks Martin
Bob vk2byf