From anonymous, 5 Years ago, written in Plain Text.
Embed
  1. ##### /etc/systemd/system/network.service
  2.  
  3. [Unit]
  4. Description=Network Connectivity
  5. Wants=network.target
  6. Before=network.target
  7.  
  8. [Service]
  9. Type=oneshot
  10. RemainAfterExit=yes
  11. EnvironmentFile=/etc/conf.d/network
  12. ExecStart=/sbin/ip link set dev ${interface} up
  13. ExecStart=/sbin/ip addr add ${address}/${netmask} broadcast ${broadcast} dev ${interface}
  14. ExecStart=/sbin/ip route add default via ${gateway}
  15. ExecStart=/sbin/ip -6 addr add ${address6}/${netmask6} dev ${interface}
  16. ExecStart=/sbin/ip -6 route del default
  17. ExecStart=/sbin/ip -6 route del ${gateway6}
  18. ExecStart=/sbin/ip -6 route add ${gateway6} dev eth0
  19. ExecStart=/sbin/ip -6 route add default via ${gateway6}
  20. ExecStop=/sbin/ip addr flush dev ${interface}
  21. ExecStop=/sbin/ip -6 addr flush dev ${interface}
  22. ExecStop=/sbin/ip link set dev ${interface} down
  23.  
  24. [Install]
  25. WantedBy=multi-user.target
  26.  
  27. ###### /etc/conf.d/network
  28. interface=eth0
  29.  
  30. address=94.23.233.17
  31. netmask=24
  32. broadcast=94.23.233.255
  33. gateway=94.23.233.254
  34.  
  35. address6=2001:41d0:2:6c11::1
  36. netmask6=64
  37. gateway6=2001:41d0:2:6cff:ff:ff:ff:ff