SamPhoenix
Posts: 6
Joined: Wed Feb 03, 2016 11:35 pm

dhcpcd static IP error...

Wed Feb 14, 2018 9:20 pm

I have been using my pi as a homeassistant hub and assigned it a static ip address... It had been working fine for a while and a few days ago it stopped connecting to the network. Upon restarting it, I saw that the it said that dhcpcd.service failed to start so I look into it and find:

Code: Select all

Not running dhcpcd becsuse /etc/network/interfaces defines some interfaces that will use a DHCP client or static address
I have no idea how to fix this... Any help would be appreciated.

SurferTim
Posts: 1769
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: dhcpcd static IP error...

Wed Feb 14, 2018 10:14 pm

Post the contents of your /etc/network/interfaces file.

SamPhoenix
Posts: 6
Joined: Wed Feb 03, 2016 11:35 pm

Re: dhcpcd static IP error...

Wed Feb 14, 2018 10:53 pm

Code: Select all

auto lo

iface lo inet loopback

iface eth0 inet static
 address 192.168.0.4
 netmask 255.255.255.0
 gateway 192.168.0.1
 dns-nameservers 8.8.8.8 8.8.4.4
 
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant.conf
iface default inet dhcp

SurferTim
Posts: 1769
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: dhcpcd static IP error...

Wed Feb 14, 2018 10:58 pm

If you are using the Stretch version of Raspbian, remove all that. There should be only one uncommented line in /etc/network/interfaces unless you are setting up a bridge, which you aren't.

SamPhoenix
Posts: 6
Joined: Wed Feb 03, 2016 11:35 pm

Re: dhcpcd static IP error...

Wed Feb 14, 2018 11:09 pm

I am, so what should I do to keep the static IP but have it actually working?

SurferTim
Posts: 1769
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: dhcpcd static IP error...

Thu Feb 15, 2018 1:21 am

If you are using Stretch, open /etc/dhcpcd.conf with a text editor. There are plenty of commented out examples there.

SamPhoenix
Posts: 6
Joined: Wed Feb 03, 2016 11:35 pm

Re: dhcpcd static IP error...

Thu Feb 15, 2018 1:49 am

But I'm confused about what you told me to remove and keep and what needs to be added.

User avatar
rpdom
Posts: 17173
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: dhcpcd static IP error...

Thu Feb 15, 2018 7:43 am

The current version of /etc/network/interfaces contains the following lines only:

Code: Select all

# 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
If you want to set a static IP on an interface, do what it says and
consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
or ask here with details of what you want to set and we'll tell you what you need to put in /etc/dhcpcd.conf

pcmanbob
Posts: 9464
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: dhcpcd static IP error...

Thu Feb 15, 2018 12:21 pm

rpdom wrote:
Thu Feb 15, 2018 7:43 am
The current version of /etc/network/interfaces contains the following lines only:

Code: Select all

# 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
If you want to set a static IP on an interface, do what it says and
consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
or ask here with details of what you want to set and we'll tell you what you need to put in /etc/dhcpcd.conf

Or there are always the excellent learning resources that are available on the pi web site

https://www.raspberrypi.org/learning/ne ... p-address/
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

lizaborne00
Posts: 1
Joined: Sat Mar 30, 2019 2:52 pm

Re: dhcpcd static IP error...

Sat Mar 30, 2019 2:59 pm

as per my opinion you reinstall and update your system

Return to “Troubleshooting”