My RaspberryPi 3 running Raspbian Jessie ignores my static ip configuration of adapter wlan1 (USB WiFi) in
/etc/dhcpcd.conf. (At the moment it's physically not possible for me to test wlan0 and eth0.)
Most people seem to have problems with static IP, because they try to configure their network the old way, by editing
/etc/network/interfaces. I'm aware of the fact that DHCPCD is the current way to setup your network.
However, as said above, it doesn't work. My Raspberry gets assigned an IP by the DHCP server.
To be sure it's not a problem caused by some kind of IP cache I changed the DHCP servers address range and my Raspberry immediately got a new IP.
# 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 list of options to request from the DHCP server. option domain_name_servers, domain_name, domain_search, host_name option classless_static_routes # Most distributions have NTP support. option ntp_servers # Respect the network MTU. # Some interface drivers reset when changing the MTU so disabled by default. #option interface_mtu # 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 interface eth0 static ip_address=192.168.178.61/24 static routers=192.168.178.1 static domain_name_servers=192.168.178.1 interface wlan1 static ip_address=192.168.181.61/24 static routers=192.168.181.1 static domain_name_servers=192.168.181.1 timeout 30
Yes, i know, you have to set the adpaters to "manual"
/etc/network/interfaces, this is my file content:
# 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 auto lo iface lo inet loopback auto eth0 iface eth0 inet manual auto wlan0 auto wlan1 allow-hotplug wlan1 iface wlan1 inet manual wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
I checked if the DHCP address has been assigned additionally to the static address, but no:
pi@raspberrypi:~ $ ip -o addr 1: lo inet 127.0.0.1/8 scope host lo\ valid_lft forever preferred_lft forever 1: lo inet6 ::1/128 scope host \ valid_lft forever preferred_lft forever 2: eth0 inet6 fe80::ba27:ebff:fe84:e331/64 scope link tentative \ valid_lft forever preferred_lft forever 3: wlan0 inet6 fe80::2605:fff:fe9a:5dcb/64 scope link tentative \ valid_lft forever preferred_lft forever 4: wlan1 inet 192.168.181.106/24 brd 192.168.181.255 scope global wlan1\ valid_lft forever preferred_lft forever 4: wlan1 inet6 fe80::ba27:ebff:fed1:b664/64 scope link \ valid_lft forever preferred_lft forever
Since I made those configurations I tried multiple things to re-initialize the network modules and adapters multiple times. Here are some commands, I played around with, but not in the same order:
sudo ip addr flush dev wlan1 sudo service dhcpcd restart sudo service networking restart sudo ifdown wlan1 sudo ifup wlan1 sudo reboot sudo systemctl enable dhcpcd sudo systemctl daemon-reload
Now an interesting fact: I have two other RaspberryPi's with almost the same confiuguration. Their SD cards were written with the same image file not long ago. Of course I set a different IP address for each. Surprisingly one of them works as expected, whereas two of them have the problem described in this question.
What is wrong?
Here is something I noticed a few minutes ago. In the network GUI the interface "wlan1" appears multiple times. One with dynamic and one with static IP. However, I can't see multiple interfaces when calling
ifconfig -a or
netstat -i or
ip link show. They are only appearing in the GUI: