From 5cad03393b85844bd61fb37c77483ab16f9d540c Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Sun, 26 Mar 2023 21:40:20 +0200 Subject: [PATCH] fix: add networkmanager config for eth0 to set route metric --- rocky-9/data/files/nm-eth0.conf | 4 ++++ rocky-9/data/init.ks.pkrtpl.hcl | 5 +++++ rocky-9/server.pkr.hcl | 1 + 3 files changed, 10 insertions(+) create mode 100644 rocky-9/data/files/nm-eth0.conf diff --git a/rocky-9/data/files/nm-eth0.conf b/rocky-9/data/files/nm-eth0.conf new file mode 100644 index 0000000..a873fb5 --- /dev/null +++ b/rocky-9/data/files/nm-eth0.conf @@ -0,0 +1,4 @@ +[connection-eth0] +match-device=interface-name:eth0 +ipv4.route-metric=0 +ipv6.route-metric=0 diff --git a/rocky-9/data/init.ks.pkrtpl.hcl b/rocky-9/data/init.ks.pkrtpl.hcl index af3dac2..df1d592 100644 --- a/rocky-9/data/init.ks.pkrtpl.hcl +++ b/rocky-9/data/init.ks.pkrtpl.hcl @@ -166,6 +166,11 @@ ${files_hcloud_ssh_keys_service} EOF systemctl enable hcloud-ssh-keys.service + +cat >/etc/NetworkManager/conf.d/eth0.conf <<\EOF +${files_hcloud_nm_eth0} +EOF +chmod 644 /etc/NetworkManager/conf.d/eth0.conf %end ### Reboot after the installation is complete. diff --git a/rocky-9/server.pkr.hcl b/rocky-9/server.pkr.hcl index a0c33a7..a345327 100644 --- a/rocky-9/server.pkr.hcl +++ b/rocky-9/server.pkr.hcl @@ -20,6 +20,7 @@ locals { files_hetznercloud_default_init = file("${abspath(path.root)}/data/files/90-hetznercloud.cfg") files_hetznercloud_ds_init = file("${abspath(path.root)}/data/files/92-hetznercloud-ds.cfg") files_hetznercloud_init = file("${abspath(path.root)}/data/files/93-hetznercloud.cfg") + files_hcloud_nm_eth0 = file("${abspath(path.root)}/data/files/nm-eth0.conf") }) build_id = "${uuidv4()}" build_labels = {