Created
January 18, 2013 20:42
-
-
Save mcgrew/4568354 to your computer and use it in GitHub Desktop.
Systemd network startup script and config
This file contains hidden or 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
| interface=eth0 | |
| address=192.168.10.99 | |
| netmask=24 | |
| broadcast=192.168.10.255 | |
| gateway=192.168.10.1 | |
This file contains hidden or 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=Private Network Connectivity | |
| Wants=network. target | |
| Before=network. target | |
| [Service] | |
| Type=oneshot | |
| RemainAfterExit=yes | |
| EnvironmentFile=/etc/conf.d/network | |
| ExecStart=/sbin/ip link set dev ${interface} up | |
| ExecStart=/sbin/ip addr add ${address}/${netmask} broadcast ${broadcast} dev ${interface} | |
| ExecStart=/sbin/ip route add default via ${gateway} | |
| ExecStop=/sbin/ip addr flush dev ${interface} | |
| ExecStop=/sbin/ip link set dev ${interface} down | |
| [Install] | |
| WantedBy=multi-user.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment