grindax
Posts: 8
Joined: Mon Mar 11, 2013 1:47 pm

Static IP configured, but DHCP still getting used

Mon Aug 31, 2015 12:40 am

On a fresh install of the latest version of Raspbian (2015-05-05), I'm simply trying to configure my network interface (wired) with a static IP. For some reason, in addition to the static IP I've configured, when the Raspberry Pi boots it's still requesting and using a dynamic IP address as well.

I've edited the /etc/network/interfaces file so that it contains only this:

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 192.168.1.4
netmask 255.255.255.0
gateway 192.168.1.1

When I reboot, I see these messages:

[....] Configuring network interfaces...done.
INIT: Entering runlevel: 2
[info] Using makefile-style concurrent boot in runlevel 2.
[info] Initializing cgroups.
dhcpcd[1915]: version 6.7.1 starting
dhcpcd[1915]: all: IPv6 kernel autoconf disabled
dhcpcd[1915]: eth0: adding address fe80::12e5:378a:f785:494f
dhcpcd[1915]: if_addaddress6: Operation not supported
dhcpcd[1915]: DUID 00:01:00:01:1c:dd:6b:61:80:1f:02:9b:bb:90
dhcpcd[1915]: eth0: IAID eb:7c:ee:6c
dhcpcd[1915]: eth0: rebinding lease of 192.168.1.35
[....] Network Interface Plugging Daemon...skip eth0...done.
[....] Starting enhanced syslogd: rsyslogd.
[....] Starting periodic command scheduler: cron.
[....] Starting system message bus: dbus.
[....] Starting Avahi mDNS/DNS-SD Daemon: avahi-daemon.
[....] Starting NTP server: ntpd.
[....] Starting OpenBSD Secure Shell server: sshd.
dhcpcd[1915]: eth0: leased 192.168.1.35 for 86400 seconds
dhcpcd[1915]: eth0: adding route to 192.168.1.0/24
dhcpcd[1915]: eth0: adding default route via 192.168.1.1
dhcpcd[1915]: forked to background, child pid 2247
My IP address is 192.168.1.4 192.168.1.35


Does anyone know why it's still requesting an IP address from DHCP?

Milliways
Posts: 434
Joined: Fri Apr 25, 2014 12:18 am
Location: Sydney, Australia

Re: Static IP configured, but DHCP still getting used

Mon Aug 31, 2015 4:59 am

/etc/network/interfaces file is not used by the latest Raspbian which is using `dhcpcd`
DougieLawson wrote:
raspberrypi-net-mods package is badly broken.
This is a misguided/half-baked attempt to make it easier to setup WiFi via the GUI.

If you search this site you will find lots of discussion about attempts to use static address with dhcpcd

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

Re: Static IP configured, but DHCP still getting used

Mon Aug 31, 2015 7:07 am

The original dhcpcd respected the interfaces file. The new dhcpcd5 seems to ignore it.

Your options are:

1) Remove dhcpcd5 if you don't want to use DHCP at all, then use the /etc/network/interfaces file.
or
2) Configure the static address in /etc/dhcpcd.conf instead
or
3) Remove dhcpcd5 and install dhcpcd or isc-dhcp-client instead, then use the /etc/network/interfaces file.

grindax
Posts: 8
Joined: Mon Mar 11, 2013 1:47 pm

Re: Static IP configured, but DHCP still getting used

Mon Aug 31, 2015 9:30 am

Thanks for the replies, they were very helpful.
I'll go ahead and do the configuration of the static IP address in /etc/dhcpcd.conf instead, as suggested.

Return to “Raspbian”