My Pi is connected to my router by Ethernet.
Attempting to set up a static IP address for my Pi, I added the following lines to dhcpcd.conf
:
interface eth0
static ip_address=192.168.0.2/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1
interface wlan0
static ip_address=192.168.0.2/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1
I rebooted and found that I couldn't connect to my Pi with SSH using 192.168.0.2
as the IP address. I connected to my router and found that the Pi appeared to be connected by Ethernet but with the following IP address: fe80::340b:6d47:32d:fb60
. I am able to connect to my Pi via SSH using this address. There's a (6) icon next to this address which makes me think that the issue is to do with IPv6 vs. IPv4. I notice that in the example static IP adress configuration there's a field called static ip6_address
but I don't know how I should use it.
If I run hostname -I
I get: 192.168.0.2
.
If I run ip a
the output under eth0
is the following:
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether b8:27:eb:9f:26:20 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.2/24 brd 192.168.0.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::340b:6d47:32d:fb60/64 scope link
valid_lft forever preferred_lft forever
Why is the set static IP address not working, and how can I remedy this?
inet 192.168.0.2/24
. Why it doesn't work I can't tell you, but it likely is to do with IPv6. When IPv4 and v6 are enabled (which is normal), you will have two addresses. They should both work.192.168.0.1
(some home systems use192.168.0.254
, some use192.168.1.1
or192.168.1.254
). Before setting a static address look at what's assigned by DHCP. Also if the router supports it do the static assignment in the router (that's less likely to conflict with DHCP pools). So the first move the OP needs to do is look at settings on their laptop with ipconfig /all (windows) or ifconfig -a (Linux/OSX).ip route show
? that will show what the Pi thinks it's network set up is.