[Unit] Description=IIAB ap0 clone wifi device Wants=network-pre.target # https://unix.stackexchange.com/questions/257888/systemd-wait-for-network-interface-to-be-up-before-running-service/417839#417839 # 2022-08-22: #3352 Raspberry Pi Zero W requires 2 lines below... BindsTo=sys-subsystem-net-devices-{{ discovered_wireless_iface }}.device After=sys-subsystem-net-devices-{{ discovered_wireless_iface }}.device After=network-pre.target Before=dhcpcd.service Before=wpa_supplicant.service Before=wpa_supplicant@{{ discovered_wireless_iface }}.service Before=NetworkManager.service Before=netplan-wpa@{{ discovered_wireless_iface }}.service Before=hostapd.service [Service] Type=oneshot RemainAfterExit=yes ExecStartPre=-/sbin/iw phy phy0 interface add ap0 type __ap ExecStartPre=-/sbin/ip link set ap0 address {{ ap0_mac_addr }} ExecStart=-/sbin/ip link set ap0 up ExecStop=-/sbin/iw dev ap0 del [Install] WantedBy=multi-user.target