Updated efg.pm (disabled NetworkManager boot time connection creating).
authorZoltán Felleg <zoltan.felleg@userrendszerhaz.hu>
Fri, 18 Oct 2024 18:40:21 +0000 (20:40 +0200)
committerZoltán Felleg <zoltan.felleg@userrendszerhaz.hu>
Fri, 18 Oct 2024 18:40:21 +0000 (20:40 +0200)
sources/efg.pm/c3d/firstboot/scripts/01_setupnetworking.sh
sources/efg.pm/c3d/postinstall/install-data/usr/local/bin/setuprouting.sh [deleted file]

index 689c2fab0a1f1d1366b6256766b4984b5561680c..34a803c4cde5493d8a28c8cc718cac9693851153 100755 (executable)
@@ -35,6 +35,7 @@ while [ $CONNECTION_DEVICES_UP -lt 3 ]
 do
     if [ $CYCLES_WAITED -ge 10 ]
     then
+        echo
         nmcli connection show
         exit 1
     fi
@@ -57,19 +58,21 @@ then
     exit 1
 fi
 
-CONNECTION_LINE_PM=$(nmcli --terse connection show | grep ':eth0$')
-CONNECTION_LINE_EX=$(nmcli --terse connection show | grep ':eth1$')
+CONNECTION_DEVICE_PM="eth0"
+CONNECTION_DEVICE_EX="eth1"
+CONNECTION_ID_PM="perimeter"
+CONNECTION_ID_EX="external"
+CONNECTION_LINE_PM=$(nmcli --terse connection show | grep ":${CONNECTION_DEVICE_PM}$")
+CONNECTION_LINE_EX=$(nmcli --terse connection show | grep ":${CONNECTION_DEVICE_EX}$")
 CONNECTION_UUID_PM=$(echo $CONNECTION_LINE_PM | cut -f 2 -d ':')
-CONNECTION_DEVICE_PM=$(echo $CONNECTION_LINE_PM | cut -f 4 -d ':')
 CONNECTION_UUID_EX=$(echo $CONNECTION_LINE_EX | cut -f 2 -d ':')
-CONNECTION_DEVICE_EX=$(echo $CONNECTION_LINE_EX | cut -f 4 -d ':')
 
 nmcli connection delete uuid "$CONNECTION_UUID_PM"
 nmcli connection delete uuid "$CONNECTION_UUID_EX"
 
 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.254/24" \
@@ -86,9 +89,16 @@ nmcli connection add \
     ipv6.routes "2001:1aa1:000a:7dae::/64 2001:1aa1:000a:7c0c:000c:18ff:fe03:ad01" \
     save yes
 
+cat <<EOF >/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 add \
     connection.autoconnect yes \
-    connection.id external \
+    connection.id $CONNECTION_ID_EX \
     connection.interface-name $CONNECTION_DEVICE_EX \
     connection.type 802-3-ethernet \
     ipv4.addresses "213.253.216.162/28, 213.253.216.163/28, \
@@ -104,10 +114,14 @@ nmcli connection add \
     ipv6.route-metric 100 \
     save yes
 
+cat <<EOF >/etc/NetworkManager/conf.d/${CONNECTION_DEVICE_EX}.conf
+[device]
+match-device=interface-name:$CONNECTION_DEVICE_EX
+allowed-connections=id:$CONNECTION_ID_EX
+keep-configuration=no
+EOF
+
 nmcli connection show
 
 hostnamectl hostname efg.pm.useribm.hu
 hostnamectl
-
-#echo "@reboot root /usr/local/bin/setuprouting.sh" >>/etc/crontab
-#/usr/local/bin/setuprouting.sh
diff --git a/sources/efg.pm/c3d/postinstall/install-data/usr/local/bin/setuprouting.sh b/sources/efg.pm/c3d/postinstall/install-data/usr/local/bin/setuprouting.sh
deleted file mode 100755 (executable)
index 593169b..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/sh
-
-
-exit 0
-# the mail server, the nameservers and the vpn server and everything
-# from the perimeter network are routed via ACE
-ip rule add priority 64  from 10.228.92.159/32 lookup 30
-ip rule add priority 65  from 10.228.109.154/32 lookup 30
-ip rule add priority 66  from 10.228.109.159/32 lookup 30
-ip rule add priority 67  from 10.228.109.236/32 lookup 30
-ip rule add priority 128 from 192.168.173.0/24 lookup 30
-
-# everything else is routed via Telekom (which is the default)
-#ip rule add priority 256 from 10.228.0.0/16 lookup 150