1

I know this gets asked a lot, but none of the answers are working for me.

I have a USB to ethernet dongle on my Windows PC that I would like to connect to a raspberry pi (version 4.14.71-v7+). On the windows side, I have the ethernet adapter set to a static IPv4 address: 169.254.162.135, subnet mask 255.255.255.0, and default gateway 169.254.162.1.

On the raspberry pi, if I type the command sudo ifconfig eth0 169.254.162.223, everything works fine, I can ping and connect the two systems.

To make the pi boot with this address automatically, I modified /etc/dhcpcd.conf, adding this to the bottom:

interface eth0
static ip_address=169.254.162.223/24
static routers=169.254.162.1
static domain_name_servers=169.254.162.1

But this isn't working. Even after rebooting, I just get:

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::30ca:fe09:1545:1b84  prefixlen 64  scopeid 0x20<link>
        ether b8:27:eb:ef:d6:df  txqueuelen 1000  (Ethernet)
        RX packets 153  bytes 12781 (12.4 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 35  bytes 3963 (3.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

And I can't ping from either direction. Running sudo service dhcpcd status I get:

Nov 04 19:15:32 raspberrypi dhcpcd[518]: eth0: using static address 169.254.162.223/24
Nov 04 19:15:32 raspberrypi dhcpcd[518]: eth0: adding route to 169.254.162.0/24
Nov 04 19:15:32 raspberrypi dhcpcd[518]: eth0: adding default route via 169.254.162.1
Nov 04 19:15:32 raspberrypi dhcpcd[518]: eth0: deleted route to 169.254.162.0/24
Nov 04 19:15:41 raspberrypi dhcpcd[518]: eth0: no IPv6 Routers available

FYI, I did not modify /etc/network/interfaces, so it is still the default:

# 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

What am I missing here?

  • Your config looks good. Educated guess: this is a problem with the fact you are trying to use a link-local subnet (169.254.x.x/24) together with a static configuration in dhcpcd. Try using (say) addresses in 192.168.0.0/24 instead and see if the problem is magically fixed. – Rob Bricheno Nov 4 '18 at 22:30
  • none of the answers are working for me .... why not? – jsotola Nov 5 '18 at 3:43
  • "I can't ping from either direction" – user2913869 Nov 5 '18 at 18:58
  • Is there also a router in addition to the Windows PC and RasPi and does it has the ip address 169.254.162.1? You should not use this ip range, instead use addresses from e.g. 192.168.1.0/24. – Ingo Nov 8 '18 at 10:44
1

169.254.162.223 is a Link-local address so it is pointless trying to use as a static IPv4 address.

It is even more futile trying to use 169.254.162.1 for a router as Link-local addresses are not routable.

See How to set up Static IP Address

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.