Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ephemient/0e91cf169d419c43e0d5f633d72d870e to your computer and use it in GitHub Desktop.
Save ephemient/0e91cf169d419c43e0d5f633d72d870e to your computer and use it in GitHub Desktop.
systemd-networkd + wpa_supplicant integration
[Match]
Type=wlan
[Network]
DHCP=yes
[DHCP]
RouteMetric=2048
[Service]
ExecStartPre=-/bin/ln -s wpa_supplicant-nl80211.conf /etc/wpa_supplicant/wpa_supplicant-nl80211-%I.conf
[Unit]
Description=WPA supplicant daemon (interface- and nl80211 driver-specific version) configuration file watcher
After=wpa_supplicant-nl80211@%i.service
BindsTo=wpa_supplicant-nl80211@%i.service
[Path]
PathModified=/etc/wpa_supplicant/wpa_supplicant-nl80211-%I.conf
Unit=wpa_supplicant-reload@%i.service
[Unit]
Description=WPA supplicant daemon (interface- and wired driver-specific version) configuration file watcher
After=wpa_supplicant-wired@%i.service
BindsTo=wpa_supplicant-wired@%i.service
[Path]
PathModified=/etc/wpa_supplicant/wpa_supplicant-wired-%I.conf
Unit=wpa_supplicant-reload@%i.service
[Unit]
Description=WPA supplicant daemon (interface- and nl80211 driver-specific version) configuration file reloader
After=wpa_supplicant-nl80211@%i.service
Requires=wpa_supplicant-nl80211@%i.service
[Service]
ExecStart=/usr/bin/wpa_cli -i %I reconfigure
[Service]
ExecStartPre=-/bin/ln -s wpa_supplicant-wired.conf /etc/wpa_supplicant/wpa_supplicant-wired-%I.conf
SUBSYSTEM=="net", ENV{ID_NET_NAME}=="lo", GOTO="90_local_net_end"
SUBSYSTEM=="net", ENV{ID_NET_NAME}!="", ENV{DEVTYPE}=="wlan", ACTION=="add", \
ENV{SYSTEMD_WANTS}+="wpa_supplicant-nl80211@$env{ID_NET_NAME}.service"
SUBSYSTEM=="net", ENV{ID_NET_NAME}!="", ENV{DEVTYPE}=="", ACTION=="add", \
ENV{SYSTEMD_WANTS}+="wpa_supplicant-wired@$env{ID_NET_NAME}.service"
LABEL="90_local_net_end"
ctrl_interface=DIR=/run/wpa_supplicant GROUP=network
country=US
network={
ssid="open"
}
# this stanza can be generated with wpa_passphrase
network={
ssid="private"
#psk="password"
psk=6db074d6bcac8381ef139fc180dfe1a6646a28c80240efaf3198056c21280624
}
# see documentation for more details
network={
ssid="enterprise"
proto=RSN
key_mgmt=WPA-EAP
pairwise=CCMP
auth_alg=OPEN
eap=PEAP
identity="username"
password="password"
domain_match="corporate.com"
phase2="auth=MSCHAPV2"
}
ctrl_interface=DIR=/run/wpa_supplicant GROUP=network
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment