Systemd/network

From Useful Things
Jump to: navigation, search

Static IP setup

File: /etc/systemd/network/wired.network

[Match]
Name=eth0

[Network]
DNS=8.8.8.8
Address=192.168.101.2/24
Address=123.123.123.123/32

[Route]
Gateway=192.168.101.1

Additional post-up network hooks

File: /etc/systemd/system/my-service.service

[Unit]
Description=Service description
Wants=network.target
After=network.target

[Service]
ExecStart=/usr/local/sbin/executable-to-run

[Install]
WantedBy=multi-user.target