Skip to content

Instantly share code, notes, and snippets.

@gdamjan
Last active September 26, 2018 15:21
Show Gist options
  • Save gdamjan/0112b58ad056cf6d8553 to your computer and use it in GitHub Desktop.
Save gdamjan/0112b58ad056cf6d8553 to your computer and use it in GitHub Desktop.
Home network setup with a bridged wifi (for my libvirt VMs) using systemd-networkd and wpa_supplicant
# /etc/systemd/network/50-wifi.network
[Match]
MACAddress=f8:d1:11:18:81:c3
Type=wlan
[Network]
Bridge=bridge0
# /etc/udev/rules.d/95-wifi-4addr-mode.rules
ACTION=="add", ATTRS{idVendor}=="0cf3", ATTRS{idProduct}=="9271", RUN+="/usr/bin/iw dev $name set 4addr on"
# /etc/systemd/network/bridge0.netdev
[NetDev]
Name=bridge0
Kind=bridge
# /etc/systemd/network/bridge0.network
[Match]
Name=bridge0
[Network]
DHCP=both
# /etc/systemd/network/enp4s0.network
[Match]
Name=enp4s0
[Network]
Bridge=bridge0
[Unit]
Description=WPA supplicant daemon (home)
After=sys-subsystem-net-devices-bridge0.device network.target
Requires=sys-subsystem-net-devices-bridge0.device
[Service]
Type=simple
User=nobody
SupplementaryGroups=rfkill
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_RAW
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_RAW
RuntimeDirectory=wpa_supplicant
ExecStart=/usr/bin/wpa_supplicant -c/etc/wpa_supplicant/home.conf -bbridge0 -iwlxf8d1111881c3 -q
[Install]
WantedBy=sys-subsystem-net-devices-wlxf8d1111881c3.device
@gdamjan
Copy link
Author

gdamjan commented Jul 20, 2015

systemctl disable NetworkManager
systemctl enable wpa_supplicant-home.service
systemctl enable systemd-networkd
systemctl enable systemd-resolved
rm /etc/resolv.conf
ln -sf /run/systemd/resolve/resolv.conf /etc/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment