Yesterday I had to switch my home network back from DHCP to static IPs, but my Raspberry Pi 3B (with the current Raspbian) keeps on using an invalid IP address, namely:
eth0 Link encap:Ethernet HWaddr b8:27:eb:4c:cb:8c
inet addr:169.254.168.86 Bcast:169.254.255.255 Mask:255.255.0.0
inet6 addr: fe80::243a:4333:fc91:c87/64 Scope:Link
The address isn't even valid for my network, as its address is now this one: 169.254.164.0/24
After reading a couple of answers here at SE, I edited my /etc/dhcpcd.conf as follows:
# A sample configuration for dhcpcd.
# See dhcpcd.conf(5) for details.
# Allow users of this group to interact with dhcpcd via the control socket.
#controlgroup wheel
# Inform the DHCP server of our hostname for DDNS.
hostname
# Use the hardware address of the interface for the Client ID.
clientid
# or
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
#duid
# Persist interface configuration when dhcpcd exits.
persistent
# Rapid commit support.
# Safe to enable by default because it requires the equivalent option set
# on the server to actually work.
option rapid_commit
# A ServerID is required by RFC2131.
require dhcp_server_identifier
# Generate Stable Private IPv6 Addresses instead of hardware based ones
slaac private
# A hook script is provided to lookup the hostname if not set by the DHCP
# server, but it should not be run by default.
nohook lookup-hostname
# Configures eth0 for a static IP address and routing.
# Added 2017/12/25 by JR.
interface eth0
static ip_address = 169.254.164.3/24
static routers = 169.254.164.1
static domain_name_servers = 212.6.64.14
The DHCP client restarts nicely:
● dhcpcd.service - dhcpcd on all interfaces
Loaded: loaded (/lib/systemd/system/dhcpcd.service; enabled)
Active: active (running) since Sun 2017-12-24 22:28:40 CET; 12min ago
Process: 1396 ExecStop=/sbin/dhcpcd -x (code=exited, status=0/SUCCESS)
Process: 1401 ExecStart=/sbin/dhcpcd -q -b (code=exited, status=0/SUCCESS)
Main PID: 1402 (dhcpcd)
CGroup: /system.slice/dhcpcd.service
└─1402 /sbin/dhcpcd -q -b
Dec 24 22:28:40 autoradio dhcpcd[1401]: dev: loaded udev
Dec 24 22:28:40 autoradio systemd[1]: Started dhcpcd on all interfaces.
Dec 24 22:28:40 autoradio dhcpcd[1402]: DUID 00:01:00:01:1e:da:f2:49:b8:27:eb:94:1f:4d
Dec 24 22:28:40 autoradio dhcpcd[1402]: eth0: IAID eb:4c:cb:8c
Dec 24 22:28:40 autoradio dhcpcd[1402]: wlan0: waiting for carrier
Dec 24 22:28:40 autoradio dhcpcd[1402]: eth0: soliciting a DHCP lease
Dec 24 22:28:40 autoradio dhcpcd[1402]: eth0: soliciting an IPv6 router
Dec 24 22:28:50 autoradio dhcpcd[1402]: eth0: using IPv4LL address 169.254.168.86
Dec 24 22:28:50 autoradio dhcpcd[1402]: eth0: adding route to 169.254.0.0/16
Dec 24 22:28:52 autoradio dhcpcd[1402]: eth0: no IPv6 Routers available
But: The client neither sets the IP address, nor standard route, so that I've gotta do this manually. Why? Does anybody know what's wrong here? Any help would be greatly appreciated.
UPDATE: The server is now complaining about a "martial" IP of my Raspi:
[15741.931325] IPv4: martian source 169.254.164.1 from 169.254.168.86, on dev eth2
[15741.931331] ll header: 00000000: ff ff ff ff ff ff b8 27 eb 4c cb 8c 08 06 .......'.L....
UPDATE #2: Upon another user's request, here's the current dhcpcd.conf:
pi@autoradio:~ $ cat /etc/dhcpcd.conf
hostname
persistent
option rapid_commit
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
option ntp_servers
require dhcp_server_identifier
slaac private
nohook lookup-hostname
# Configures eth0 for a static IP address and routing.
# Added 2017/12/25 by JR.
interface eth0
#static ip_address = 169.254.164.3/24
#static routers = 169.254.164.1
#static domain_name_servers = 212.6.64.14
ip=169.254.164.3::169.254.164.1:255.255.255.0:autoradio:eth0:off
Now everything works. Thank you! – Neppomuk Dec 26 '17 at 13:59