Created
July 22, 2014 21:10
-
-
Save kokizzu/2e6e6838dfe360a73b5d to your computer and use it in GitHub Desktop.
Systemd network service file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Network connectivity (%i) | |
Wants=network.target | |
Before=network.target | |
BindsTo=sys-subsystem-net-devices-%i.device | |
After=sys-subsystem-net-devices-%i.device | |
[Service] | |
Type=oneshot | |
RemainAfterExit=yes | |
EnvironmentFile=/etc/conf.d/network@%i | |
ExecStart=/usr/bin/ip link set dev %i up | |
ExecStart=/usr/bin/ip addr add ${address}/${netmask} broadcast ${broadcast} dev %i | |
ExecStart=/usr/bin/sh -c 'test -z ${gateway} || /usr/bin/ip route add default via ${gateway}' | |
ExecStop=/usr/bin/ip addr flush dev %i | |
ExecStop=/usr/bin/ip route flush dev %i | |
ExecStop=/usr/bin/ip link set dev %i down | |
[Install] | |
WantedBy=multi-user.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment