Recent releases of Raspbian have adopted the use of dhcpcd to manage both dynamic and static interface configuration. If you would prefer to use the traditional /etc/network/interfaces mechanism instead, follow these steps.

  1. First, disable dhcpcd and wpa_supplicant.

    systemctl disable --now dhdpcd wpa_supplicant
    
  2. You will need a wpa_supplicant configuration for wlan0 in /etc/wpa_supplicant/wpa_supplicant-wlan0.conf.

    If you already have an appropriate configuration in /etc/wpa_supplicant/wpa_supplicant.conf, you can just symlink the file:

     cd /etc/wpa_supplicant
     ln -s wpa_supplicant.conf wpa_supplicant-wlan0.conf
    
  3. Enable the wpa_supplicant service for wlan0:

    systemctl enable --now wpa_supplicant@wlan0
    
  4. Create an appropriate configuration in /etc/network/interfaces.d/wlan0. For example:

    allow-hotplug wlan0
    
    iface wlan0 inet static
    address 192.168.2.100
    netmask 255.255.255.0
    
    iface wlan0 inet6 static
    address 2607:f0d0:2001:000a:0000:0000:0000:0010
    netmask 64
    
  5. Reboot to make sure everything comes up as expected. With the above configuration, after rebooting you should see:

    root@raspberrypi:~# ip addr show wlan0
    3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
        link/ether 00:e1:b0:67:98:67 brd ff:ff:ff:ff:ff:ff
        inet 192.168.2.100/24 brd 192.168.2.255 scope global wlan0
           valid_lft forever preferred_lft forever
        inet6 2607:f0d0:2001:a::10/64 scope global
           valid_lft forever preferred_lft forever
        inet6 fe80::2e1:b0ff:fe67:9867/64 scope link
           valid_lft forever preferred_lft forever
    

Some notes on PWM on the Raspberry Pi

Tue 26 September 2017 by Lars Kellogg-Stedman Tags raspberrypi pwm

I was recently working on a project in which I wanted to drive a simple piezo buzzer attached to a GPIO pin on a Raspberry Pi. I was already using the RPi.GPIO module in my project so that seemed like a logical place to start, but I ran into …

read more

Systemd-nspawn for fun and...well, mostly for fun

Sun 07 February 2016 by Lars Kellogg-Stedman Tags systemd containers qemu raspberrypi

systemd-nspawn has been called "chroot on steroids", but if you think of it as Docker with a slightly different target you wouldn't be far wrong, either. It can be used to spawn containers on your host, and has a variety of options for configuring the containerized environment through the use …

read more

gpio-watch: Run scripts in response to GPIO signals

Sat 26 July 2014 by Lars Kellogg-Stedman Tags raspberrypi gpio

For a small project I'm working on I needed to attach a few buttons to a Raspberry Pi and have some code execute in response to the button presses.

Normally I would reach for Python for a simple project like this, but constraints of the project made it necessary to …

read more

Interrupts on the PiFace

Mon 05 August 2013 by Lars Kellogg-Stedman Tags raspberrypi python piface

I recently acquired both a Raspberry Pi and a PiFace IO board. I had a rough time finding examples of how to read the input ports via interrupts (rather than periodically polling for values), especially for the newer versions of the PiFace python libraries.

After a little research, here's some …

read more