alanchandler42
Posts: 10
Joined: Tue Sep 10, 2019 9:29 am

Understanding relationship between dhcpcd.conf and /etc/network/interfaces

Tue Sep 17, 2019 12:46 pm

I've been going round in circles on this on for a day now.

For a long while I have been using a raspberry pi as my home nameserver/dhcp server using dsnmasq.conf (its also the mail server and runs a home web site as well, along with firewalls). As a result I turned off dhcp serving on my router. A long story cut short is that tried to upgrade it to buster and everything broke. I am only able to access this site because I turned on dhcp service on my router.

I have trying to rebuild my sd card from the raspbian-lite package - where I had it all working and ready to switch over to btrfs - only to find that btrfs-convert has been removed from btrfs tools - -corrupted my image - need to start again.

I have been slowly trying to piece together what is wrong. One thing seems to have been persistent interfaces - which meant setting eth0 to static meant nothing - only it took a while to realise this, but although I used raspi-config to turn off persistent interfaces (which now means I actually have an eth0), the comment in /etc/network/interfaces is that I should look at dhcpcd.conf man page to work out how to set static ip addresses. I don't understand what it is saying

It doesn't help that I am talking about dhcpcd and not dhcpd - and previous posts I have found here confuse the two.

How should I set dhcpcd up so I can have a static interface, and use localhost for name serving after I have set up dnsmasq
- and whilst I am at at how do I turn the wlan off.

Andyroo

Re: Understanding relationship between dhcpcd.conf and /etc/network/interfaces

Tue Sep 17, 2019 2:29 pm

To set up a static IP just add your equivalent of

Code: Select all

interface eth0
static ip_address=192.168.1.11/24
static routers=192.168.1.254
static domain_name_servers=192.168.1.2
hostname = web.local
to /etc/dhcpcd.conf. No need to touch the interfaces files for this

To disable WiFi and/or Bluetooth add the required into /boot/config.txt

Code: Select all

# Disable Bluetooth and WiFi
dtoverlay=disable-bt
dtoverlay=disable-wifi
As for name serving - not learnt that yet as I use the menu options on pi-hole :lol: (well more :oops: )

edit: Tidy up of disable intro.

alanchandler42
Posts: 10
Joined: Tue Sep 10, 2019 9:29 am

Re: Understanding relationship between dhcpcd.conf and /etc/network/interfaces

Tue Sep 17, 2019 4:11 pm

Thanks grateful for that. Going to work on it now

alanchandler42
Posts: 10
Joined: Tue Sep 10, 2019 9:29 am

Re: Understanding relationship between dhcpcd.conf and /etc/network/interfaces

Tue Sep 17, 2019 7:06 pm

It works although there is a peculiar funny which might be related to dhcpcd

Before the last change if I reboot the raspberry pi, dnsmasq stops acting as a name server on the network (it works locally to itself) until I restart dnsmasq. It was rejecting local machines as they weren't on the same local subnet the first time through

I had to change dnsmasq.conf to tell it to explicitly listen on the eth0 interface (which disables the ---local-servers flag) for it not do do this. Its almost as though when it comes to look the first time at what its local subnet is, it gets it wrong. When it restarts later, it gets it right

Return to “Advanced users”