0

I want to assign a static IP-address to the Wireless LAN interface on my raspberry pi, but after setting the address in /etc/network/interfaces

as follows:

auto wlan0
iface wlan0 inet static
address 192.168.1.4
netmask 255.255.0.0
gateway 192.168.1.1

and then after rebooting my raspberry pi, the WiFi is disabled with the message "country code not set".

But the country code is set in /etc/wpa_supplicant/wpa_supplicant.conf The third line is country=BE

When removing the wlan0 setting in /etc/network/interfaces and rebooting the raspberry pi, the Wi-Fi is enabled again. (but with a useless 169.254.0.0/16 ip-address)

1
  • 2
    Why do you think the file contains "# Please note that this file is written to be used with dhcpcd # For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf' "? Why dou want to set a static IP-address in the first place?
    – Milliways
    Feb 25, 2019 at 10:36

1 Answer 1

0

Raspbian networking is not managed by ifupdown in /etc/network/interfaces. Please don't ignore the hint in it:

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

You should edit /etc/dhcpcd.conf and set static entries in it. You will find examples there.

If you really want to manage your static ip address in /etc/network/interfaces then you should either exclude the interface from managing by dhcpcd or you disable dhcpcd complete. But then you have to do all other network stuff also by yourself.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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