Skip to content

Instantly share code, notes, and snippets.

@quinncnl
Last active December 18, 2015 18:59
Show Gist options
  • Save quinncnl/5829730 to your computer and use it in GitHub Desktop.
Save quinncnl/5829730 to your computer and use it in GitHub Desktop.
interface=eth0
address=192.168.0.8
netmask=24
broadcast=192.168.0.255
gateway=192.168.0.1
[Unit]
Description=Ethernet Static IP 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=mutli-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment