Skip to content

Instantly share code, notes, and snippets.

@cbrake
Created September 24, 2012 15:09
Show Gist options
  • Save cbrake/3776448 to your computer and use it in GitHub Desktop.
Save cbrake/3776448 to your computer and use it in GitHub Desktop.
USB NIC hotplugging under systemd
systemd: [email protected]
# currently, the BindTo is not working
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/sbin/ifup %i
ExecStop=/sbin/ifdown %i
StandardOutput=syslog+console
BindTo=%i.device
udev: network.rules
SUBSYSTEM=="net", KERNEL!="lo", ENV{SYSTEMD_WANTS}="network@$name.service" ENV{SYSTEMD_ALIAS}="/$name"
SUBSYSTEM=="net", KERNEL!="lo", ACTION=="remove" RUN+="/bin/systemctl stop network@$name.service"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment