From 530f7b1dd8219d60bf86f77ad4a2cf2d7acb6638 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zolt=C3=A1n=20Felleg?= Date: Fri, 18 Oct 2024 20:33:48 +0200 Subject: [PATCH] Updated ifg.in (disabled NetworkManager boot time connection creating). --- .../firstboot/scripts/01_setupnetworking.sh | 31 ++++++++++++++----- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/sources/ifg.in/c3d/firstboot/scripts/01_setupnetworking.sh b/sources/ifg.in/c3d/firstboot/scripts/01_setupnetworking.sh index 805cc92..9058396 100755 --- a/sources/ifg.in/c3d/firstboot/scripts/01_setupnetworking.sh +++ b/sources/ifg.in/c3d/firstboot/scripts/01_setupnetworking.sh @@ -34,6 +34,7 @@ while [ $CONNECTION_DEVICES_UP -lt 3 ] do if [ $CYCLES_WAITED -ge 10 ] then + echo nmcli connection show exit 1 fi @@ -56,19 +57,21 @@ then exit 1 fi -CONNECTION_LINE_IN=$(nmcli --terse connection show | grep ':eth0$') -CONNECTION_LINE_PM=$(nmcli --terse connection show | grep ':eth1$') +CONNECTION_DEVICE_IN="eth0" +CONNECTION_DEVICE_PM="eth1" +CONNECTION_ID_IN="internal" +CONNECTION_ID_PM="perimeter" +CONNECTION_LINE_IN=$(nmcli --terse connection show | grep ":${CONNECTION_DEVICE_IN}$") +CONNECTION_LINE_PM=$(nmcli --terse connection show | grep ":${CONNECTION_DEVICE_PM}$") CONNECTION_UUID_IN=$(echo $CONNECTION_LINE_IN | cut -f 2 -d ':') -CONNECTION_DEVICE_IN=$(echo $CONNECTION_LINE_IN | cut -f 4 -d ':') CONNECTION_UUID_PM=$(echo $CONNECTION_LINE_PM | cut -f 2 -d ':') -CONNECTION_DEVICE_PM=$(echo $CONNECTION_LINE_PM | cut -f 4 -d ':') nmcli connection delete uuid "$CONNECTION_UUID_IN" nmcli connection delete uuid "$CONNECTION_UUID_PM" nmcli connection add \ connection.autoconnect yes \ - connection.id internal \ + connection.id $CONNECTION_ID_IN \ connection.interface-name $CONNECTION_DEVICE_IN \ connection.type 802-3-ethernet \ ipv4.addresses "10.228.109.254/16, 192.168.42.254/24, 192.168.43.254/24" \ @@ -82,9 +85,16 @@ nmcli connection add \ ipv6.method "manual" \ save yes +cat </etc/NetworkManager/conf.d/${CONNECTION_DEVICE_IN}.conf +[device] +match-device=interface-name:$CONNECTION_DEVICE_IN +allowed-connections=id:$CONNECTION_ID_IN +keep-configuration=no +EOF + nmcli connection add \ connection.autoconnect yes \ - connection.id perimeter \ + connection.id $CONNECTION_ID_PM \ connection.interface-name $CONNECTION_DEVICE_PM \ connection.type 802-3-ethernet \ ipv4.addresses "192.168.173.1/24" \ @@ -95,9 +105,14 @@ nmcli connection add \ ipv6.method "manual" \ save yes +cat </etc/NetworkManager/conf.d/${CONNECTION_DEVICE_PM}.conf +[device] +match-device=interface-name:$CONNECTION_DEVICE_PM +allowed-connections=id:$CONNECTION_ID_PM +keep-configuration=no +EOF + nmcli connection show hostnamectl hostname ifg.in.useribm.hu hostnamectl - -#sysctl --load=/etc/sysctl.d/01_ipforward.conf -- 2.54.0