do
if [ $CYCLES_WAITED -ge 10 ]
then
+ echo
nmcli connection show
exit 1
fi
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" \
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, \
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
+++ /dev/null
-#!/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