$ uname -a
Linux pi 4.9.59+ #1047 Sun Oct 29 11:47:10 GMT 2017 armv6l GNU/Linux
System fully updated via apt
.
I'm aware there are many, many questions and blogs on this topic, but after several days of looking and asking friends I can't find an answer.
My Raspberry Pi Zero W has two wireless interfaces: wlan0 and wlan1.
I want wlan0 to be an AP and wlan1 to connect to an AP.
So I need wlan0 to have a static IP and wlan1 to get one from DHCP over wireless.
If I set a static IP for wlan0 in dhcpcd.conf
, dhcpcd still calls wpa_supplicant
and so even with a static IP it joins the AP - which causes conflicts when trying to run hostapd
.
If I set a static IP for wlan0 via interfaces
, dhcpcd
fails because it detected the interface being configured in interfaces
- eventhough I'd added denyinterface wlan0
to the dhcpcd.conf
.
I know that wpa_supplicant
has a command-line parameter for interface
, but I haven't been able to find a way of limiting which interfaces get passed from the dhcpcd hook.
The question is: what configuration should I use in dhcpcd.conf
(or elsewhere?) so I can get a static IP address on wlan0 and not have it connect to an AP AND get an IP address via DHCP on wlan1 and have it connect to an AP? phew
UPDATE 1:
I've tried using systemctl start [email protected]
to have a per-interface config, but there is no [email protected]
file, only dhcpcd.service
.
UPDATE 2:
I've added a system unit file (if that's the right word?) for [email protected]
:
[Unit]
Description=dhcpcd on %I
Wants=network.target
Before=network.target
[Service]
Type=forking
PIDFile=/var/run/dhcpcd-%I.pid
ExecStart=/sbin/dhcpcd --config /etc/dhcpcd-%I.conf -A -q -w %I
ExecStop=/sbin/dhcpcd -k %I
[Install]
Alias=multi-user.target.wants/[email protected]
(Modified from: https://github.com/devkral/systemd-arch-units/blob/master/service/[email protected])
This means I can successfully apply an interface-specific config into which I put a static IP address configuration and nohook wpa_supplicant
.
This correctly doesn't call wpa_supplicant
, but doesn't seem to set the IP address either. No errors on run and I can see it's loading the correct conf file, but ip addr
shows no IP address on the interface.