There are a number of common requirements that require configuration. They are:
- Static IP address
- DNS settings
- Gateway Settings
- Wi-Fi Settings
Being Linux then there are several commands and configuration files that need to be used/edited.
However for most of us using a GUI is easier and PI provide one in the top right task bar.
Making changes using the GUI
To make changes you first need to select the Interface using the drop down box.
In the screen shot below I have configured the Wireless Interface to use a static IP address of 192.168.1.42 and the Ethernet Interface to have an IP address of 192.168.1.41
I’ve also enable the checkbox Automatically configure empty options and because of this the default Gateway (router) and the DNS server addresses will come from the DHCP server.
I have also disabled ipv6 on these interfaces.
Where are the GUI Changes Stored?
If you do some Goggling on configuring static IP addresses etc then you will come across many tutorials that take you through either editing the /etc/networking/interface file or /etc/dhcp/dhclient.conf file.
So the settings you change in the GUI are stored in one of those files is the logical conclusion that I came to.
However not so. If you go to these files they are either mainly empty or mainly commented out.
If you look for the static IP address you’ve just configured in the GUI and which works then it is nowhere to be found.
The answer is in the /etc/dhcpcd.conf file. Obvious really!
Well after spending hours searching online I’d finally found the answer. At least think I have.
If I look at my /etc/dhcpcd.conf file and right at the bottom I see these entries which correspond to my GUI entries.
If I do an ifconfig then this is what I see.
You will notice the Wi-fi has the correct address the Ethernet port doesn’t has I haven’t got a cable plugged into the port but the card is present as you see a MAC address.
You will also notice the IPv6 addresses which I disabled! I’ll work that out another day.
You may also find that it the /etc/dhcpcd.conf is empty if you haven’t made any network changes.
What a Happened to the /etc/networking/interface file
Well all my searching wasn’t in vain, as I stumbled across this article by Scargill which related his tribulations with configuring networking and included a very useful bit of history.
It seems that there are many different networking daemons that you can use on Linux and PI.
Over the years they have moved from the original daemon which used the /etc/networking/interface file to the now more common dhcpd.
But there are other like the wicd which is apparently a wrapper over dhcpd and I found running on my PI that I had upgraded from Stretch to Buster.
To find out what daemons you have running use the command:
In the screen shot below you can see that on my upgrade Pi (Stretch to Buster) both the dhcpcd and the wicd daemons are running.
It seems that most of the tutorials you find on the Internet are not longer valid as they were written for Debian Wheezy and all use the /etc/network/interfaces file.
The file you need to edit for Jessie,Stretch and Buster is the /etc/dhcpcd.conf file.
This is the file that the GUI changes
Dhclient and dhcpcd Daemons
Again most tutorials on the Internet have you changing the /etc/dhcp/dhclient.conf file and also show commands line
to release an IP address.
Doing this on PI has no effect as it uses dhcpcd daemon and not the dhclient daemon.
See this thread –dhclient vs dhcpcd
Implementing IP Address Changes
When you make a change to the IP address or any of the network settings they are not automatically applied you can apply then using the ipconfig config.
You use the ifconfig command to bring the network Interface down and then up and the change will take affect use:
sudo ifconfig wlan0 down #wi-fi sudo ifconfig eth0 down #Ethernet and sudo ifconfig wlan0 up #wi-fi sudo ifconfig eth0 up #Ethernet
Trouble Shooting Tips and Common Q&A
Unusual or Unwanted IP address
If for example you have an IP address of 192.168.1.41 and don’t know where this is coming from. The go to a command prompt and change to the /etc folder and type :
sudo grep 192.168.1.41 -r
I’ve edit the /etc/network/interface File What should I do?
It’s a good idea to change it back but it doesn’t seem to have any effect.
However you can switch back to using the interfaces file by disabling the dhcpcd and enabling the networking daemon
sudo systemctl disable dhcpcd sudo systemctl enable networking
I haven’t tried this
What is the Name of the GUI Used for Configuring Networking?
It is a lxpanel plugin called lxplug-network. See here
Cable Disconnects not Detected by Application
While running an MQTT client I noticed that when I unplugged the network cable the system detected it and displayed a network error however this was not passed to the application.
In addition when it was plugged back in the network was still showing as being down . The solution was to stop and start the interface using:
sudo ipconfig eth0 down
sudo ipconfig eth0 up
You should note that you need to disable it first or it doesn’t work.
There are many different networking options and the default options have changed considerably over the last few years.
Unfortunately most of the tutorial on the Internet relate to the old style networking using the /etc/networking/interfaces file but this is no long used on the raspberry Pi.
Good discussion on networking options
- Understanding DHCP on Home Networks
- 10 Useful Windows Networking Commands
- 10 Useful Linux (Raspberry Pi) Networking Commands
- Setting Up A Static IP Address on Windows 10
The GUI WILL work, but not as mentioned in this tutorial.
1 untick Automatically Configure Empty Options
2 Fill in the static IP address for your device
3 Fill in the Router (eg Gateway) IP
4 Fill in a DNS IP
Done and works. I didn’t disable IPv6 on my pi’s and they lock onto wifi perfectly.
Hope this helps the rest of the gang looking for simple HOWTO.
I wonder if you still monitor this.?
I have an RPI 4 and little or no knowledge of programming. I have loaded my Pi with. Package OPenCPN which is a boat navigation programme including Signal K.
I have given my pi a Static Address and have through a router connected up my sensors, a multiplexer and the Pi all with Ethernet cable. When I ping the multiplexer I am getting the inputs in my Terminal window but cannot get the Signal K software to read the input. Am I missing something obvious.
Can you use the ask steve page and send me a quick sketch.Also when you say static IP address did you do this via DHCP or in the network settings on the PI. If you did it on the PI it may be that is not working correctly. I did that on an old PI and got strange dhcp IP address requests every seconds and had to change it.
Do you have another machine in the same network as the pi that you can ping OK
Sorry Steve not to have replied but had to go to hospital for small Op will be out today and come back to you with a response when I get the pi set up again, couple of days, thanks for your interest.
Just got a Raspberry 4. I have no computer experience. Used wife’s laptop to connect my iPhone to my router, with connectify. I’ve found tutorials on how to use a rpi instead of Connectify . Every time I try a tutorial I lose internet, get dhcpcd lost, and no interface found. Only solution I’ve found is to remove Sd Card format and reinstall noobs.
Perhaps you are looking for this: https://forum.openmediavault.org/index.php?thread/37225-connection-to-dhcpcd-lost/
when you use the raspberry imager, hold control, shift, and X to configure lan settings or enable ssh without having to mess with the command line when booting the pi itself.
Sorry mate. I’m new to Linux, Debian and Raspberry PI but I think in your tutorial, you’ve dropped in dhcpd instead of dhcpcd in a few places, unless i’m reading it wrong.
Also, I’m not having any success with my Raspberry Pi. When I reboot, I can’t get anything connected. It says the ‘Connection to dhcpcd lost’ and the GUI for the Wireless & Wired Network Settings doesn’t come up again.
I can only get access to the GUI once I delete the new entries that are at the bottom of the /etc/dhcpcd.conf which were put in there when I put in my static IP addresses.
You were correct I used dhcpd instead of dhcpcd in a few case and have corrected them . Did you try
to see which daemon you are using. Is the issue you are having new or is it a new pi that you are setting up
I’m having the same issue, David. service –status-all shows that dhcpcd is not running upon reboot after any change to dhcpcd.config. Has anyone found a solution?