# Copyright 2024 Hetzner Online GmbH
#
# Licensed under the MIT License. See the LICENSE accompanying this file
# for the specific language governing permissions and limitations under
# the License.

# This service start a DHCP client on private network interfaces

[Unit]
Description=Enable Hetzner Cloud private network interfaces %i
After=network-online.target
#This makes sure all subprocesses will be killed if the PNI is removed
BindsTo=sys-subsystem-net-devices-%i.device

#We don't want to run if already being managed by netplan/systemd-networkd
ConditionPathExists=!/run/systemd/network/10-netplan-%i.network

[Service]
Type=forking
ExecStart=/usr/sbin/dhcpcd -q -w --ipv4only --noarp --script=/bin/true %I
ExecStop=/usr/sbin/dhcpcd -x %I
