export PAGER=
+AC_CYCLES=10
+NM_CYCLES=60
+CONNECTION_ID="internal"
+FQ_HOSTNAME="db2.in.useribm.hu"
+IPV4_ADDRESSES="10.228.109.166/16"
+IPV4_DNS="10.228.109.159, 10.228.92.159"
+IPV4_DNS_SEARCH="in.useribm.hu"
+IPV4_GATEWAY="10.228.109.254"
+IPV6_ADDRESSES="2001:1aa1:000a:7dae:000c:18ff:fe03:6da6/64"
+IPV6_DNS="2001:1aa1:000a:7dae:000c:18ff:fe03:6d9f, 2001:1aa1:000a:7dae:000c:18ff:fe03:5c9f"
+IPV6_DNS_SEARCH="in.useribm.hu"
+IPV6_GATEWAY="2001:1aa1:000a:7dae:000c:18ff:fe03:6dfe"
sleep 1
CYCLES_WAITED=0
while [ $NM_RC -ne 0 ]
do
- if [ $CYCLES_WAITED -ge 10 ]
+ if [ $CYCLES_WAITED -ge $NM_CYCLES ]
then
exit 1
fi
then
echo -n "Waiting for NetworkManager"
fi
- echo -n .
sleep 1
- CYCLES_WAITED=$(( $CYCLES_WAITED + 1 ))
+ CYCLES_WAITED=$(($CYCLES_WAITED + 1))
+ if [ $(($CYCLES_WAITED % 5)) -eq 0 ]
+ then
+ echo -n "+"
+ else
+ echo -n "."
+ fi
systemctl --quiet is-active NetworkManager.service
NM_RC=$?
done
[ $CYCLES_WAITED -gt 0 ] && echo
-# wait for the two network connections to come up
-CONNECTION_DEVICES_UP=$(nmcli --terse connection show \
- | grep --invert-match ':$' | wc -l)
+# wait for the (only) ethernet connection to activate/come up
+ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
CYCLES_WAITED=0
-while [ $CONNECTION_DEVICES_UP -lt 2 ]
+while [ $ACTIVE_CONNECTIONS -lt 1 ]
do
- if [ $CYCLES_WAITED -ge 10 ]
+ if [ $CYCLES_WAITED -ge $AC_CYCLES ]
then
- echo
- nmcli connection show
+ echo "No active connections" >&2
+ nmcli connection show >&2
exit 1
fi
if [ $CYCLES_WAITED -eq 0 ]
then
- echo -n "Waiting for the network connection"
+ echo -n "Waiting for the ethernet "
+ echo -n "connection to activate/come up"
fi
- echo -n .
sleep 1
- CYCLES_WAITED=$(( $CYCLES_WAITED + 1 ))
- CONNECTION_DEVICES_UP=$(nmcli --terse connection show \
- | grep --invert-match ':$' | wc -l)
+ CYCLES_WAITED=$(($CYCLES_WAITED + 1))
+ if [ $(($CYCLES_WAITED % 5)) -eq 0 ]
+ then
+ echo -n "+"
+ else
+ echo -n "."
+ fi
+ ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
done
[ $CYCLES_WAITED -gt 0 ] && echo
-CONNECTIONS=$(nmcli --terse connection show | wc -l)
-if [ $CONNECTIONS -ne 2 ]
+ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
+if [ $ACTIVE_CONNECTIONS -ne 1 ]
then
- echo "Number of connections: $CONNECTIONS instead of 2" >&2
+ echo -n "Number of active connections: " >&2
+ echo "$ACTIVE_CONNECTIONS instead of 1" >&2
+ nmcli connection show >&2
exit 1
fi
-CONNECTION_DEVICE="eth0"
-CONNECTION_ID="internal"
-CONNECTION_LINE=$(nmcli --terse connection show | grep ":${CONNECTION_DEVICE}$")
+INACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep ':$' | wc -l)
+if [ $INACTIVE_CONNECTIONS -gt 0 ]
+then
+ echo "Deleting inactive/unused connection(s)"
+ echo "----------------"
+ nmcli connection show
+ nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep ':$' \
+ | cut -f 2 -d ':' \
+ | while read CONNECTION_UUID
+ do
+ nmcli connection delete uuid "$CONNECTION_UUID"
+ done
+ echo "----------------"
+fi
+
+CONNECTION_LINE=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:')
+CONNECTION_DEVICE=$(echo $CONNECTION_LINE | cut -f 4 -d ':')
CONNECTION_UUID=$(echo $CONNECTION_LINE | cut -f 2 -d ':')
nmcli connection delete uuid "$CONNECTION_UUID"
nmcli connection add \
- connection.autoconnect yes \
- connection.id $CONNECTION_ID \
- connection.interface-name $CONNECTION_DEVICE \
+ connection.autoconnect "yes" \
+ connection.id "$CONNECTION_ID" \
+ connection.interface-name "$CONNECTION_DEVICE" \
connection.type 802-3-ethernet \
- ipv4.addresses "10.228.109.166/16" \
- ipv4.dns "10.228.109.159, 10.228.92.159" \
- ipv4.dns-search "in.useribm.hu" \
- ipv4.gateway "10.228.109.254" \
+ ipv4.addresses "$IPV4_ADDRESSES" \
+ ipv4.dns "$IPV4_DNS" \
+ ipv4.dns-search "$IPV4_DNS_SEARCH" \
+ ipv4.gateway "$IPV4_GATEWAY" \
ipv4.method "manual" \
- ipv6.addresses "2001:1aa1:000a:7dae:000c:18ff:fe03:6da6/64" \
- ipv6.dns "2001:1aa1:000a:7dae:000c:18ff:fe03:6d9f, 2001:1aa1:000a:7dae:000c:18ff:fe03:5c9f" \
- ipv6.dns-search "in.useribm.hu" \
- ipv6.gateway "2001:1aa1:000a:7dae:000c:18ff:fe03:6dfe" \
+ ipv6.addresses "$IPV6_ADDRESSES" \
+ ipv6.dns "$IPV6_DNS" \
+ ipv6.dns-search "$IPV6_DNS_SEARCH" \
+ ipv6.gateway "$IPV6_GATEWAY" \
ipv6.method "manual" \
- save yes
+ save "yes"
cat <<EOF >/etc/NetworkManager/conf.d/${CONNECTION_DEVICE}.conf
[device]
nmcli connection show
-hostnamectl hostname db2.in.useribm.hu
+hostnamectl hostname "$FQ_HOSTNAME"
hostnamectl
export PAGER=
+AC_CYCLES=10
+NM_CYCLES=60
+CONNECTION_DEVICE_PM="eth0"
+CONNECTION_DEVICE_EX="eth1"
+CONNECTION_ID_PM="perimeter"
+CONNECTION_ID_EX="external"
+FQ_HOSTNAME="efg.pm.useribm.hu"
+IPV4_ADDRESSES_PM="192.168.173.254/24"
+IPV4_DNS_PM="192.168.173.223"
+IPV4_DNS_SEARCH_PM="pm.useribm.hu"
+IPV4_ROUTES_PM="10.228.0.0/16 192.168.173.1, 192.168.42.0/24 192.168.173.1, 192.168.43.0/24 192.168.173.1"
+IPV6_ADDRESSES_PM="2001:1aa1:000a:7c0c:000c:18ff:fe03:adfe/64"
+IPV6_DNS_PM="2001:1aa1:000a:7c0c:000c:18ff:fe03:addf"
+IPV6_DNS_SEARCH_PM="pm.useribm.hu"
+IPV4_ADDRESSES_EX="213.253.216.162/28, 213.253.216.163/28, 213.253.216.164/28, 213.253.216.165/28, 213.253.216.166/28, 213.253.216.167/28, 213.253.216.168/28"
+IPV4_GATEWAY_EX="213.253.216.161"
+IPV6_ADDRESSES_EX="2001:1aa1:000a:ba2e:000c:18ff:fe03:adfe, 2001:1aa4:0001:0000:0000:0000:0000:000f/127"
+IPV6_GATEWAY_EX="2001:1aa4:0001:0000:0000:0000:0000:000e"
sleep 1
CYCLES_WAITED=0
while [ $NM_RC -ne 0 ]
do
- if [ $CYCLES_WAITED -ge 10 ]
+ if [ $CYCLES_WAITED -ge $NM_CYCLES ]
then
exit 1
fi
then
echo -n "Waiting for NetworkManager"
fi
- echo -n .
sleep 1
- CYCLES_WAITED=$(( $CYCLES_WAITED + 1 ))
+ CYCLES_WAITED=$(($CYCLES_WAITED + 1))
+ if [ $(($CYCLES_WAITED % 5)) -eq 0 ]
+ then
+ echo -n "+"
+ else
+ echo -n "."
+ fi
systemctl --quiet is-active NetworkManager.service
NM_RC=$?
done
[ $CYCLES_WAITED -gt 0 ] && echo
-# wait for the three network connections to come up
-CONNECTION_DEVICES_UP=$(nmcli --terse connection show \
- | grep --invert-match ':$' | wc -l)
+# wait for the two ethernet connections to activate/come up
+ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
CYCLES_WAITED=0
-while [ $CONNECTION_DEVICES_UP -lt 3 ]
+while [ $ACTIVE_CONNECTIONS -lt 2 ]
do
- if [ $CYCLES_WAITED -ge 10 ]
+ if [ $CYCLES_WAITED -ge $AC_CYCLES ]
then
- echo
- nmcli connection show
+ echo "Less than two active connections" >&2
+ nmcli connection show >&2
exit 1
fi
if [ $CYCLES_WAITED -eq 0 ]
then
- echo -n "Waiting for the network connections"
+ echo -n "Waiting for the ethernet "
+ echo -n "connections to activate/come up"
fi
- echo -n .
sleep 1
- CYCLES_WAITED=$(( $CYCLES_WAITED + 1 ))
- CONNECTION_DEVICES_UP=$(nmcli --terse connection show \
- | grep --invert-match ':$' | wc -l)
+ CYCLES_WAITED=$(($CYCLES_WAITED + 1))
+ if [ $(($CYCLES_WAITED % 5)) -eq 0 ]
+ then
+ echo -n "+"
+ else
+ echo -n "."
+ fi
+ ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
done
[ $CYCLES_WAITED -gt 0 ] && echo
-CONNECTIONS=$(nmcli --terse connection show | wc -l)
-if [ $CONNECTIONS -ne 3 ]
+ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
+if [ $ACTIVE_CONNECTIONS -ne 2 ]
then
- echo "Number of connections: $CONNECTIONS instead of 3" >&2
+ echo -n "Number of active connections: " >&2
+ echo "$ACTIVE_CONNECTIONS instead of 2" >&2
+ nmcli connection show >&2
exit 1
fi
-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}$")
+INACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep ':$' | wc -l)
+if [ $INACTIVE_CONNECTIONS -gt 0 ]
+then
+ echo "Deleting inactive/unused connection(s)"
+ echo "----------------"
+ nmcli connection show
+ nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep ':$' \
+ | cut -f 2 -d ':' \
+ | while read CONNECTION_UUID
+ do
+ nmcli connection delete uuid "$CONNECTION_UUID"
+ done
+ echo "----------------"
+fi
+
+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_UUID_EX=$(echo $CONNECTION_LINE_EX | cut -f 2 -d ':')
nmcli connection delete uuid "$CONNECTION_UUID_EX"
nmcli connection add \
- connection.autoconnect yes \
- connection.id $CONNECTION_ID_PM \
- connection.interface-name $CONNECTION_DEVICE_PM \
+ connection.autoconnect "yes" \
+ connection.id "$CONNECTION_ID_PM" \
+ connection.interface-name "$CONNECTION_DEVICE_PM" \
connection.type 802-3-ethernet \
- ipv4.addresses "192.168.173.254/24" \
- ipv4.dns "192.168.173.223" \
- ipv4.dns-search "pm.useribm.hu" \
+ ipv4.addresses "$IPV4_ADDRESSES_PM" \
+ ipv4.dns "$IPV4_DNS_PM" \
+ ipv4.dns-search "$IPV4_DNS_SEARCH_PM" \
ipv4.method "manual" \
- ipv4.routes "10.228.0.0/16 192.168.173.1, \
- 192.168.42.0/24 192.168.173.1, \
- 192.168.43.0/24 192.168.173.1" \
- ipv6.addresses "2001:1aa1:000a:7c0c:000c:18ff:fe03:adfe/64" \
- ipv6.dns "2001:1aa1:000a:7c0c:000c:18ff:fe03:addf" \
- ipv6.dns-search "pm.useribm.hu" \
+ ipv4.routes "$IPV4_ROUTES_PM" \
+ ipv6.addresses "$IPV6_ADDRESSES_PM" \
+ ipv6.dns "$IPV6_DNS_PM" \
+ ipv6.dns-search "$IPV6_DNS_SEARCH_PM" \
ipv6.method "manual" \
- ipv6.routes "2001:1aa1:000a:7dae::/64 2001:1aa1:000a:7c0c:000c:18ff:fe03:ad01" \
+ ipv6.routes "$IPV6_ROUTES_PM" \
save yes
cat <<EOF >/etc/NetworkManager/conf.d/${CONNECTION_DEVICE_PM}.conf
EOF
nmcli connection add \
- connection.autoconnect yes \
- connection.id $CONNECTION_ID_EX \
+ connection.autoconnect "yes" \
+ 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, \
- 213.253.216.164/28, 213.253.216.165/28, \
- 213.253.216.166/28, 213.253.216.167/28, \
- 213.253.216.168/28" \
- ipv4.gateway "213.253.216.161" \
+ ipv4.addresses "$IPV4_ADDRESSES_EX" \
+ ipv4.gateway "$IPV4_GATEWAY_EX" \
ipv4.method "manual" \
ipv4.route-metric 100 \
- ipv6.addresses "2001:1aa1:000a:ba2e:000c:18ff:fe03:adfe, 2001:1aa4:0001:0000:0000:0000:0000:000f/127" \
- ipv6.gateway "2001:1aa4:0001:0000:0000:0000:0000:000e" \
+ ipv6.addresses "$IPV6_ADDRESSES_EX" \
+ ipv6.gateway "$IPV6_GATEWAY_EX" \
ipv6.method "manual" \
ipv6.route-metric 100 \
save yes
nmcli connection show
-hostnamectl hostname efg.pm.useribm.hu
+hostnamectl hostname "$FQ_HOSTNAME"
hostnamectl
export PAGER=
+AC_CYCLES=10
+NM_CYCLES=60
+CONNECTION_ID="perimeter"
+FQ_HOSTNAME="ens.pm.useribm.hu"
+IPV4_ADDRESSES="192.168.173.147/24"
+IPV4_DNS="192.168.173.223"
+IPV4_DNS_SEARCH="pm.useribm.hu"
+IPV4_GATEWAY="192.168.173.254"
+IPV4_ROUTES="10.228.0.0/16 192.168.173.1"
+IPV6_ADDRESSES="2001:1aa1:000a:7c0c:000c:18ff:fe03:ad93/64"
+IPV6_DNS="2001:1aa1:000a:7c0c:000c:18ff:fe03:addf"
+IPV6_DNS_SEARCH="pm.useribm.hu"
+IPV6_GATEWAY="2001:1aa1:000a:7c0c:000c:18ff:fe03:adfe"
+IPV6_ROUTES="2001:1aa1:000a:7dae::/64 2001:1aa1:000a:7c0c:000c:18ff:fe03:ad01"
sleep 1
CYCLES_WAITED=0
while [ $NM_RC -ne 0 ]
do
- if [ $CYCLES_WAITED -ge 10 ]
+ if [ $CYCLES_WAITED -ge $NM_CYCLES ]
then
exit 1
fi
then
echo -n "Waiting for NetworkManager"
fi
- echo -n .
sleep 1
- CYCLES_WAITED=$(( $CYCLES_WAITED + 1 ))
+ CYCLES_WAITED=$(($CYCLES_WAITED + 1))
+ if [ $(($CYCLES_WAITED % 5)) -eq 0 ]
+ then
+ echo -n "+"
+ else
+ echo -n "."
+ fi
systemctl --quiet is-active NetworkManager.service
NM_RC=$?
done
[ $CYCLES_WAITED -gt 0 ] && echo
-# wait for the two network connections to come up
-CONNECTION_DEVICES_UP=$(nmcli --terse connection show \
- | grep --invert-match ':$' | wc -l)
+# wait for the (only) ethernet connection to activate/come up
+ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
CYCLES_WAITED=0
-while [ $CONNECTION_DEVICES_UP -lt 2 ]
+while [ $ACTIVE_CONNECTIONS -lt 1 ]
do
- if [ $CYCLES_WAITED -ge 10 ]
+ if [ $CYCLES_WAITED -ge $AC_CYCLES ]
then
- echo
- nmcli connection show
+ echo "No active connections" >&2
+ nmcli connection show >&2
exit 1
fi
if [ $CYCLES_WAITED -eq 0 ]
then
- echo -n "Waiting for the network connection"
+ echo -n "Waiting for the ethernet "
+ echo -n "connection to activate/come up"
fi
- echo -n .
sleep 1
- CYCLES_WAITED=$(( $CYCLES_WAITED + 1 ))
- CONNECTION_DEVICES_UP=$(nmcli --terse connection show \
- | grep --invert-match ':$' | wc -l)
+ CYCLES_WAITED=$(($CYCLES_WAITED + 1))
+ if [ $(($CYCLES_WAITED % 5)) -eq 0 ]
+ then
+ echo -n "+"
+ else
+ echo -n "."
+ fi
+ ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
done
[ $CYCLES_WAITED -gt 0 ] && echo
-CONNECTIONS=$(nmcli --terse connection show | wc -l)
-if [ $CONNECTIONS -ne 2 ]
+ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
+if [ $ACTIVE_CONNECTIONS -ne 1 ]
then
- echo "Number of connections: $CONNECTIONS instead of 2" >&2
+ echo -n "Number of active connections: " >&2
+ echo "$ACTIVE_CONNECTIONS instead of 1" >&2
+ nmcli connection show >&2
exit 1
fi
-CONNECTION_DEVICE="eth0"
-CONNECTION_ID="perimeter"
-CONNECTION_LINE=$(nmcli --terse connection show | grep ":${CONNECTION_DEVICE}$")
+INACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep ':$' | wc -l)
+if [ $INACTIVE_CONNECTIONS -gt 0 ]
+then
+ echo "Deleting inactive/unused connection(s)"
+ echo "----------------"
+ nmcli connection show
+ nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep ':$' \
+ | cut -f 2 -d ':' \
+ | while read CONNECTION_UUID
+ do
+ nmcli connection delete uuid "$CONNECTION_UUID"
+ done
+ echo "----------------"
+fi
+
+CONNECTION_LINE=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:')
+CONNECTION_DEVICE=$(echo $CONNECTION_LINE | cut -f 4 -d ':')
CONNECTION_UUID=$(echo $CONNECTION_LINE | cut -f 2 -d ':')
nmcli connection delete uuid "$CONNECTION_UUID"
nmcli connection add \
- connection.autoconnect yes \
- connection.id $CONNECTION_ID \
- connection.interface-name $CONNECTION_DEVICE \
+ connection.autoconnect "yes" \
+ connection.id "$CONNECTION_ID" \
+ connection.interface-name "$CONNECTION_DEVICE" \
connection.type 802-3-ethernet \
- ipv4.addresses "192.168.173.147/24" \
- ipv4.dns "192.168.173.223" \
- ipv4.dns-search "pm.useribm.hu" \
- ipv4.gateway "192.168.173.254" \
+ ipv4.addresses "$IPV4_ADDRESSES" \
+ ipv4.dns "$IPV4_DNS" \
+ ipv4.dns-search "$IPV4_DNS_SEARCH" \
+ ipv4.gateway "$IPV4_GATEWAY" \
ipv4.method "manual" \
- ipv4.routes "10.228.0.0/16 192.168.173.1" \
- ipv6.addresses "2001:1aa1:000a:7c0c:000c:18ff:fe03:ad93/64" \
- ipv6.dns "2001:1aa1:000a:7c0c:000c:18ff:fe03:addf" \
- ipv6.dns-search "pm.useribm.hu" \
- ipv6.gateway "2001:1aa1:000a:7c0c:000c:18ff:fe03:adfe" \
+ ipv4.routes "$IPV4_ROUTES" \
+ ipv6.addresses "$IPV6_ADDRESSES" \
+ ipv6.dns "$IPV6_DNS" \
+ ipv6.dns-search "$IPV6_DNS_SEARCH" \
+ ipv6.gateway "$IPV6_GATEWAY" \
ipv6.method "manual" \
- ipv6.routes "2001:1aa1:000a:7dae::/64 2001:1aa1:000a:7c0c:000c:18ff:fe03:ad01" \
- save yes
+ ipv6.routes "$IPV6_ROUTES" \
+ save "yes"
cat <<EOF >/etc/NetworkManager/conf.d/${CONNECTION_DEVICE}.conf
[device]
nmcli connection show
-hostnamectl hostname ens.pm.useribm.hu
+hostnamectl hostname "$FQ_HOSTNAME"
hostnamectl
export PAGER=
+AC_CYCLES=10
+NM_CYCLES=60
+CONNECTION_ID="internal"
+FQ_HOSTNAME="fdc.in.useribm.hu"
+IPV4_ADDRESSES="10.228.109.131/16"
+IPV4_DNS="10.228.109.159, 10.228.92.159"
+IPV4_DNS_SEARCH="in.useribm.hu"
+IPV4_GATEWAY="10.228.109.254"
+IPV6_ADDRESSES="2001:1aa1:000a:7dae:000c:18ff:fe03:6d83/64"
+IPV6_DNS="2001:1aa1:000a:7dae:000c:18ff:fe03:6d9f, 2001:1aa1:000a:7dae:000c:18ff:fe03:5c9f"
+IPV6_DNS_SEARCH="in.useribm.hu"
+IPV6_GATEWAY="2001:1aa1:000a:7dae:000c:18ff:fe03:6dfe"
sleep 1
CYCLES_WAITED=0
while [ $NM_RC -ne 0 ]
do
- if [ $CYCLES_WAITED -ge 10 ]
+ if [ $CYCLES_WAITED -ge $NM_CYCLES ]
then
exit 1
fi
then
echo -n "Waiting for NetworkManager"
fi
- echo -n .
sleep 1
- CYCLES_WAITED=$(( $CYCLES_WAITED + 1 ))
+ CYCLES_WAITED=$(($CYCLES_WAITED + 1))
+ if [ $(($CYCLES_WAITED % 5)) -eq 0 ]
+ then
+ echo -n "+"
+ else
+ echo -n "."
+ fi
systemctl --quiet is-active NetworkManager.service
NM_RC=$?
done
[ $CYCLES_WAITED -gt 0 ] && echo
-# wait for the two network connections to come up
-CONNECTION_DEVICES_UP=$(nmcli --terse connection show \
- | grep --invert-match ':$' | wc -l)
+# wait for the (only) ethernet connection to activate/come up
+ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
CYCLES_WAITED=0
-while [ $CONNECTION_DEVICES_UP -lt 2 ]
+while [ $ACTIVE_CONNECTIONS -lt 1 ]
do
- if [ $CYCLES_WAITED -ge 10 ]
+ if [ $CYCLES_WAITED -ge $AC_CYCLES ]
then
- echo
- nmcli connection show
+ echo "No active connections" >&2
+ nmcli connection show >&2
exit 1
fi
if [ $CYCLES_WAITED -eq 0 ]
then
- echo -n "Waiting for the network connection"
+ echo -n "Waiting for the ethernet "
+ echo -n "connection to activate/come up"
fi
- echo -n .
sleep 1
- CYCLES_WAITED=$(( $CYCLES_WAITED + 1 ))
- CONNECTION_DEVICES_UP=$(nmcli --terse connection show \
- | grep --invert-match ':$' | wc -l)
+ CYCLES_WAITED=$(($CYCLES_WAITED + 1))
+ if [ $(($CYCLES_WAITED % 5)) -eq 0 ]
+ then
+ echo -n "+"
+ else
+ echo -n "."
+ fi
+ ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
done
[ $CYCLES_WAITED -gt 0 ] && echo
-CONNECTIONS=$(nmcli --terse connection show | wc -l)
-if [ $CONNECTIONS -ne 2 ]
+ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
+if [ $ACTIVE_CONNECTIONS -ne 1 ]
then
- echo "Number of connections: $CONNECTIONS instead of 2" >&2
+ echo -n "Number of active connections: " >&2
+ echo "$ACTIVE_CONNECTIONS instead of 1" >&2
+ nmcli connection show >&2
exit 1
fi
-CONNECTION_DEVICE="eth0"
-CONNECTION_ID="internal"
-CONNECTION_LINE=$(nmcli --terse connection show | grep ":${CONNECTION_DEVICE}$")
+INACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep ':$' | wc -l)
+if [ $INACTIVE_CONNECTIONS -gt 0 ]
+then
+ echo "Deleting inactive/unused connection(s)"
+ echo "----------------"
+ nmcli connection show
+ nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep ':$' \
+ | cut -f 2 -d ':' \
+ | while read CONNECTION_UUID
+ do
+ nmcli connection delete uuid "$CONNECTION_UUID"
+ done
+ echo "----------------"
+fi
+
+CONNECTION_LINE=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:')
+CONNECTION_DEVICE=$(echo $CONNECTION_LINE | cut -f 4 -d ':')
CONNECTION_UUID=$(echo $CONNECTION_LINE | cut -f 2 -d ':')
nmcli connection delete uuid "$CONNECTION_UUID"
nmcli connection add \
- connection.autoconnect yes \
- connection.id $CONNECTION_ID \
- connection.interface-name $CONNECTION_DEVICE \
+ connection.autoconnect "yes" \
+ connection.id "$CONNECTION_ID" \
+ connection.interface-name "$CONNECTION_DEVICE" \
connection.type 802-3-ethernet \
- ipv4.addresses "10.228.109.131/16" \
- ipv4.dns "10.228.109.159, 10.228.92.159" \
- ipv4.dns-search "in.useribm.hu" \
- ipv4.gateway "10.228.109.254" \
+ ipv4.addresses "$IPV4_ADDRESSES" \
+ ipv4.dns "$IPV4_DNS" \
+ ipv4.dns-search "$IPV4_DNS_SEARCH" \
+ ipv4.gateway "$IPV4_GATEWAY" \
ipv4.method "manual" \
- ipv6.addresses "2001:1aa1:000a:7dae:000c:18ff:fe03:6d83/64" \
- ipv6.dns "2001:1aa1:000a:7dae:000c:18ff:fe03:5c9f, 2001:1aa1:000a:7dae:000c:18ff:fe03:6d9f" \
- ipv6.dns-search "in.useribm.hu" \
- ipv6.gateway "2001:1aa1:000a:7dae:000c:18ff:fe03:6dfe" \
+ ipv6.addresses "$IPV6_ADDRESSES" \
+ ipv6.dns "$IPV6_DNS" \
+ ipv6.dns-search "$IPV6_DNS_SEARCH" \
+ ipv6.gateway "$IPV6_GATEWAY" \
ipv6.method "manual" \
- save yes
+ save "yes"
cat <<EOF >/etc/NetworkManager/conf.d/${CONNECTION_DEVICE}.conf
[device]
nmcli connection show
-hostnamectl hostname fdc.in.useribm.hu
+hostnamectl hostname "$FQ_HOSTNAME"
hostnamectl
export PAGER=
+AC_CYCLES=10
+NM_CYCLES=60
+CONNECTION_ID="internal"
+FQ_HOSTNAME="fds.in.useribm.hu"
+IPV4_ADDRESSES="10.228.109.147/16"
+IPV4_DNS="10.228.109.159, 10.228.92.159"
+IPV4_DNS_SEARCH="in.useribm.hu"
+IPV4_GATEWAY="10.228.109.254"
+IPV6_ADDRESSES="2001:1aa1:000a:7dae:000c:18ff:fe03:6d93/64"
+IPV6_DNS="2001:1aa1:000a:7dae:000c:18ff:fe03:6d9f, 2001:1aa1:000a:7dae:000c:18ff:fe03:5c9f"
+IPV6_DNS_SEARCH="in.useribm.hu"
+IPV6_GATEWAY="2001:1aa1:000a:7dae:000c:18ff:fe03:6dfe"
sleep 1
CYCLES_WAITED=0
while [ $NM_RC -ne 0 ]
do
- if [ $CYCLES_WAITED -ge 10 ]
+ if [ $CYCLES_WAITED -ge $NM_CYCLES ]
then
exit 1
fi
then
echo -n "Waiting for NetworkManager"
fi
- echo -n .
sleep 1
- CYCLES_WAITED=$(( $CYCLES_WAITED + 1 ))
+ CYCLES_WAITED=$(($CYCLES_WAITED + 1))
+ if [ $(($CYCLES_WAITED % 5)) -eq 0 ]
+ then
+ echo -n "+"
+ else
+ echo -n "."
+ fi
systemctl --quiet is-active NetworkManager.service
NM_RC=$?
done
[ $CYCLES_WAITED -gt 0 ] && echo
-# wait for the two network connections to come up
-CONNECTION_DEVICES_UP=$(nmcli --terse connection show \
- | grep --invert-match ':$' | wc -l)
+# wait for the (only) ethernet connection to activate/come up
+ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
CYCLES_WAITED=0
-while [ $CONNECTION_DEVICES_UP -lt 2 ]
+while [ $ACTIVE_CONNECTIONS -lt 1 ]
do
- if [ $CYCLES_WAITED -ge 10 ]
+ if [ $CYCLES_WAITED -ge $AC_CYCLES ]
then
- echo
- nmcli connection show
+ echo "No active connections" >&2
+ nmcli connection show >&2
exit 1
fi
if [ $CYCLES_WAITED -eq 0 ]
then
- echo -n "Waiting for the network connection"
+ echo -n "Waiting for the ethernet "
+ echo -n "connection to activate/come up"
fi
- echo -n .
sleep 1
- CYCLES_WAITED=$(( $CYCLES_WAITED + 1 ))
- CONNECTION_DEVICES_UP=$(nmcli --terse connection show \
- | grep --invert-match ':$' | wc -l)
+ CYCLES_WAITED=$(($CYCLES_WAITED + 1))
+ if [ $(($CYCLES_WAITED % 5)) -eq 0 ]
+ then
+ echo -n "+"
+ else
+ echo -n "."
+ fi
+ ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
done
[ $CYCLES_WAITED -gt 0 ] && echo
-CONNECTIONS=$(nmcli --terse connection show | wc -l)
-if [ $CONNECTIONS -ne 2 ]
+ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
+if [ $ACTIVE_CONNECTIONS -ne 1 ]
then
- echo "Number of connections: $CONNECTIONS instead of 2" >&2
+ echo -n "Number of active connections: " >&2
+ echo "$ACTIVE_CONNECTIONS instead of 1" >&2
+ nmcli connection show >&2
exit 1
fi
-CONNECTION_DEVICE="eth0"
-CONNECTION_ID="internal"
-CONNECTION_LINE=$(nmcli --terse connection show | grep ":${CONNECTION_DEVICE}$")
+INACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep ':$' | wc -l)
+if [ $INACTIVE_CONNECTIONS -gt 0 ]
+then
+ echo "Deleting inactive/unused connection(s)"
+ echo "----------------"
+ nmcli connection show
+ nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep ':$' \
+ | cut -f 2 -d ':' \
+ | while read CONNECTION_UUID
+ do
+ nmcli connection delete uuid "$CONNECTION_UUID"
+ done
+ echo "----------------"
+fi
+
+CONNECTION_LINE=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:')
+CONNECTION_DEVICE=$(echo $CONNECTION_LINE | cut -f 4 -d ':')
CONNECTION_UUID=$(echo $CONNECTION_LINE | cut -f 2 -d ':')
nmcli connection delete uuid "$CONNECTION_UUID"
nmcli connection add \
- connection.autoconnect yes \
- connection.id $CONNECTION_ID \
- connection.interface-name $CONNECTION_DEVICE \
+ connection.autoconnect "yes" \
+ connection.id "$CONNECTION_ID" \
+ connection.interface-name "$CONNECTION_DEVICE" \
connection.type 802-3-ethernet \
- ipv4.addresses "10.228.109.147/16" \
- ipv4.dns "10.228.109.159, 10.228.92.159" \
- ipv4.dns-search "in.useribm.hu" \
- ipv4.gateway "10.228.109.254" \
+ ipv4.addresses "$IPV4_ADDRESSES" \
+ ipv4.dns "$IPV4_DNS" \
+ ipv4.dns-search "$IPV4_DNS_SEARCH" \
+ ipv4.gateway "$IPV4_GATEWAY" \
ipv4.method "manual" \
- ipv6.addresses "2001:1aa1:000a:7dae:000c:18ff:fe03:6d93/64" \
- ipv6.dns "2001:1aa1:000a:7dae:000c:18ff:fe03:5c9f, 2001:1aa1:000a:7dae:000c:18ff:fe03:6d9f" \
- ipv6.dns-search "in.useribm.hu" \
- ipv6.gateway "2001:1aa1:000a:7dae:000c:18ff:fe03:6dfe" \
+ ipv6.addresses "$IPV6_ADDRESSES" \
+ ipv6.dns "$IPV6_DNS" \
+ ipv6.dns-search "$IPV6_DNS_SEARCH" \
+ ipv6.gateway "$IPV6_GATEWAY" \
ipv6.method "manual" \
- save yes
+ save "yes"
cat <<EOF >/etc/NetworkManager/conf.d/${CONNECTION_DEVICE}.conf
[device]
nmcli connection show
-hostnamectl hostname fds.in.useribm.hu
+hostnamectl hostname "$FQ_HOSTNAME"
hostnamectl
export PAGER=
+AC_CYCLES=10
+NM_CYCLES=60
+CONNECTION_ID="perimeter"
+FQ_HOSTNAME="git.pm.useribm.hu"
+IPV4_ADDRESSES="192.168.173.42/24"
+IPV4_DNS="192.168.173.223"
+IPV4_DNS_SEARCH="pm.useribm.hu"
+IPV4_GATEWAY="192.168.173.254"
+IPV4_ROUTES="10.228.0.0/16 192.168.173.1"
+IPV6_ADDRESSES="2001:1aa1:000a:7c0c:000c:18ff:fe03:ad2a/64"
+IPV6_DNS="2001:1aa1:000a:7c0c:000c:18ff:fe03:addf"
+IPV6_DNS_SEARCH="pm.useribm.hu"
+IPV6_GATEWAY="2001:1aa1:000a:7c0c:000c:18ff:fe03:adfe"
+IPV6_ROUTES="2001:1aa1:000a:7dae::/64 2001:1aa1:000a:7c0c:000c:18ff:fe03:ad01"
sleep 1
CYCLES_WAITED=0
while [ $NM_RC -ne 0 ]
do
- if [ $CYCLES_WAITED -ge 10 ]
+ if [ $CYCLES_WAITED -ge $NM_CYCLES ]
then
exit 1
fi
then
echo -n "Waiting for NetworkManager"
fi
- echo -n .
sleep 1
- CYCLES_WAITED=$(( $CYCLES_WAITED + 1 ))
+ CYCLES_WAITED=$(($CYCLES_WAITED + 1))
+ if [ $(($CYCLES_WAITED % 5)) -eq 0 ]
+ then
+ echo -n "+"
+ else
+ echo -n "."
+ fi
systemctl --quiet is-active NetworkManager.service
NM_RC=$?
done
[ $CYCLES_WAITED -gt 0 ] && echo
-# wait for the two network connections to come up
-CONNECTION_DEVICES_UP=$(nmcli --terse connection show \
- | grep --invert-match ':$' | wc -l)
+# wait for the (only) ethernet connection to activate/come up
+ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
CYCLES_WAITED=0
-while [ $CONNECTION_DEVICES_UP -lt 2 ]
+while [ $ACTIVE_CONNECTIONS -lt 1 ]
do
- if [ $CYCLES_WAITED -ge 10 ]
+ if [ $CYCLES_WAITED -ge $AC_CYCLES ]
then
- echo
- nmcli connection show
+ echo "No active connections" >&2
+ nmcli connection show >&2
exit 1
fi
if [ $CYCLES_WAITED -eq 0 ]
then
- echo -n "Waiting for the network connection"
+ echo -n "Waiting for the ethernet "
+ echo -n "connection to activate/come up"
fi
- echo -n .
sleep 1
- CYCLES_WAITED=$(( $CYCLES_WAITED + 1 ))
- CONNECTION_DEVICES_UP=$(nmcli --terse connection show \
- | grep --invert-match ':$' | wc -l)
+ CYCLES_WAITED=$(($CYCLES_WAITED + 1))
+ if [ $(($CYCLES_WAITED % 5)) -eq 0 ]
+ then
+ echo -n "+"
+ else
+ echo -n "."
+ fi
+ ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
done
[ $CYCLES_WAITED -gt 0 ] && echo
-CONNECTIONS=$(nmcli --terse connection show | wc -l)
-if [ $CONNECTIONS -ne 2 ]
+ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
+if [ $ACTIVE_CONNECTIONS -ne 1 ]
then
- echo "Number of connections: $CONNECTIONS instead of 2" >&2
+ echo -n "Number of active connections: " >&2
+ echo "$ACTIVE_CONNECTIONS instead of 1" >&2
+ nmcli connection show >&2
exit 1
fi
-CONNECTION_DEVICE="eth0"
-CONNECTION_ID="perimeter"
-CONNECTION_LINE=$(nmcli --terse connection show | grep ":${CONNECTION_DEVICE}$")
+INACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep ':$' | wc -l)
+if [ $INACTIVE_CONNECTIONS -gt 0 ]
+then
+ echo "Deleting inactive/unused connection(s)"
+ echo "----------------"
+ nmcli connection show
+ nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep ':$' \
+ | cut -f 2 -d ':' \
+ | while read CONNECTION_UUID
+ do
+ nmcli connection delete uuid "$CONNECTION_UUID"
+ done
+ echo "----------------"
+fi
+
+CONNECTION_LINE=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:')
+CONNECTION_DEVICE=$(echo $CONNECTION_LINE | cut -f 4 -d ':')
CONNECTION_UUID=$(echo $CONNECTION_LINE | cut -f 2 -d ':')
nmcli connection delete uuid "$CONNECTION_UUID"
nmcli connection add \
- connection.autoconnect yes \
- connection.id $CONNECTION_ID \
- connection.interface-name $CONNECTION_DEVICE \
+ connection.autoconnect "yes" \
+ connection.id "$CONNECTION_ID" \
+ connection.interface-name "$CONNECTION_DEVICE" \
connection.type 802-3-ethernet \
- ipv4.addresses "192.168.173.42/24" \
- ipv4.dns "192.168.173.223" \
- ipv4.dns-search "pm.useribm.hu" \
- ipv4.gateway "192.168.173.254" \
+ ipv4.addresses "$IPV4_ADDRESSES" \
+ ipv4.dns "$IPV4_DNS" \
+ ipv4.dns-search "$IPV4_DNS_SEARCH" \
+ ipv4.gateway "$IPV4_GATEWAY" \
ipv4.method "manual" \
- ipv4.routes "10.228.0.0/16 192.168.173.1" \
- ipv6.addresses "2001:1aa1:000a:7c0c:000c:18ff:fe03:ad2a/64" \
- ipv6.dns "2001:1aa1:000a:7c0c:000c:18ff:fe03:addf" \
- ipv6.dns-search "pm.useribm.hu" \
- ipv6.gateway "2001:1aa1:000a:7c0c:000c:18ff:fe03:adfe" \
+ ipv4.routes "$IPV4_ROUTES" \
+ ipv6.addresses "$IPV6_ADDRESSES" \
+ ipv6.dns "$IPV6_DNS" \
+ ipv6.dns-search "$IPV6_DNS_SEARCH" \
+ ipv6.gateway "$IPV6_GATEWAY" \
ipv6.method "manual" \
- ipv6.routes "2001:1aa1:000a:7dae::/64 2001:1aa1:000a:7c0c:000c:18ff:fe03:ad01" \
- save yes
+ ipv6.routes "$IPV6_ROUTES" \
+ save "yes"
cat <<EOF >/etc/NetworkManager/conf.d/${CONNECTION_DEVICE}.conf
[device]
nmcli connection show
-hostnamectl hostname git.pm.useribm.hu
+hostnamectl hostname "$FQ_HOSTNAME"
hostnamectl
export PAGER=
+AC_CYCLES=10
+NM_CYCLES=60
+CONNECTION_ID="internal"
+FQ_HOSTNAME="gitea.in.useribm.hu"
+IPV4_ADDRESSES="10.228.109.220/16"
+IPV4_DNS="10.228.109.159, 10.228.92.159"
+IPV4_DNS_SEARCH="in.useribm.hu"
+IPV4_GATEWAY="10.228.109.254"
+IPV6_ADDRESSES="2001:1aa1:000a:7dae:000c:18ff:fe03:6ddc/64"
+IPV6_DNS="2001:1aa1:000a:7dae:000c:18ff:fe03:6d9f, 2001:1aa1:000a:7dae:000c:18ff:fe03:5c9f"
+IPV6_DNS_SEARCH="in.useribm.hu"
+IPV6_GATEWAY="2001:1aa1:000a:7dae:000c:18ff:fe03:6dfe"
sleep 1
CYCLES_WAITED=0
while [ $NM_RC -ne 0 ]
do
- if [ $CYCLES_WAITED -ge 10 ]
+ if [ $CYCLES_WAITED -ge $NM_CYCLES ]
then
exit 1
fi
then
echo -n "Waiting for NetworkManager"
fi
- echo -n .
sleep 1
- CYCLES_WAITED=$(( $CYCLES_WAITED + 1 ))
+ CYCLES_WAITED=$(($CYCLES_WAITED + 1))
+ if [ $(($CYCLES_WAITED % 5)) -eq 0 ]
+ then
+ echo -n "+"
+ else
+ echo -n "."
+ fi
systemctl --quiet is-active NetworkManager.service
NM_RC=$?
done
[ $CYCLES_WAITED -gt 0 ] && echo
-# wait for the two network connections to come up
-CONNECTION_DEVICES_UP=$(nmcli --terse connection show \
- | grep --invert-match ':$' | wc -l)
+# wait for the (only) ethernet connection to activate/come up
+ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
CYCLES_WAITED=0
-while [ $CONNECTION_DEVICES_UP -lt 2 ]
+while [ $ACTIVE_CONNECTIONS -lt 1 ]
do
- if [ $CYCLES_WAITED -ge 10 ]
+ if [ $CYCLES_WAITED -ge $AC_CYCLES ]
then
- echo
- nmcli connection show
+ echo "No active connections" >&2
+ nmcli connection show >&2
exit 1
fi
if [ $CYCLES_WAITED -eq 0 ]
then
- echo -n "Waiting for the network connection"
+ echo -n "Waiting for the ethernet "
+ echo -n "connection to activate/come up"
fi
- echo -n .
sleep 1
- CYCLES_WAITED=$(( $CYCLES_WAITED + 1 ))
- CONNECTION_DEVICES_UP=$(nmcli --terse connection show \
- | grep --invert-match ':$' | wc -l)
+ CYCLES_WAITED=$(($CYCLES_WAITED + 1))
+ if [ $(($CYCLES_WAITED % 5)) -eq 0 ]
+ then
+ echo -n "+"
+ else
+ echo -n "."
+ fi
+ ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
done
[ $CYCLES_WAITED -gt 0 ] && echo
-CONNECTIONS=$(nmcli --terse connection show | wc -l)
-if [ $CONNECTIONS -ne 2 ]
+ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
+if [ $ACTIVE_CONNECTIONS -ne 1 ]
then
- echo "Number of connections: $CONNECTIONS instead of 2" >&2
+ echo -n "Number of active connections: " >&2
+ echo "$ACTIVE_CONNECTIONS instead of 1" >&2
+ nmcli connection show >&2
exit 1
fi
-CONNECTION_DEVICE="eth0"
-CONNECTION_ID="internal"
-CONNECTION_LINE=$(nmcli --terse connection show | grep ":${CONNECTION_DEVICE}$")
+INACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep ':$' | wc -l)
+if [ $INACTIVE_CONNECTIONS -gt 0 ]
+then
+ echo "Deleting inactive/unused connection(s)"
+ echo "----------------"
+ nmcli connection show
+ nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep ':$' \
+ | cut -f 2 -d ':' \
+ | while read CONNECTION_UUID
+ do
+ nmcli connection delete uuid "$CONNECTION_UUID"
+ done
+ echo "----------------"
+fi
+
+CONNECTION_LINE=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:')
+CONNECTION_DEVICE=$(echo $CONNECTION_LINE | cut -f 4 -d ':')
CONNECTION_UUID=$(echo $CONNECTION_LINE | cut -f 2 -d ':')
nmcli connection delete uuid "$CONNECTION_UUID"
nmcli connection add \
- connection.autoconnect yes \
- connection.id $CONNECTION_ID \
- connection.interface-name $CONNECTION_DEVICE \
+ connection.autoconnect "yes" \
+ connection.id "$CONNECTION_ID" \
+ connection.interface-name "$CONNECTION_DEVICE" \
connection.type 802-3-ethernet \
- ipv4.addresses "10.228.109.220/16" \
- ipv4.dns "10.228.109.159, 10.228.92.159" \
- ipv4.dns-search "in.useribm.hu" \
- ipv4.gateway "10.228.109.254" \
+ ipv4.addresses "$IPV4_ADDRESSES" \
+ ipv4.dns "$IPV4_DNS" \
+ ipv4.dns-search "$IPV4_DNS_SEARCH" \
+ ipv4.gateway "$IPV4_GATEWAY" \
ipv4.method "manual" \
- ipv6.addresses "2001:1aa1:000a:7dae:000c:18ff:fe03:6ddc/64" \
- ipv6.dns "2001:1aa1:000a:7dae:000c:18ff:fe03:6d9f, 2001:1aa1:000a:7dae:000c:18ff:fe03:5c9f" \
- ipv6.dns-search "in.useribm.hu" \
- ipv6.gateway "2001:1aa1:000a:7dae:000c:18ff:fe03:6dfe" \
+ ipv6.addresses "$IPV6_ADDRESSES" \
+ ipv6.dns "$IPV6_DNS" \
+ ipv6.dns-search "$IPV6_DNS_SEARCH" \
+ ipv6.gateway "$IPV6_GATEWAY" \
ipv6.method "manual" \
- save yes
+ save "yes"
cat <<EOF >/etc/NetworkManager/conf.d/${CONNECTION_DEVICE}.conf
[device]
nmcli connection show
-hostnamectl hostname gitea.in.useribm.hu
+hostnamectl hostname "$FQ_HOSTNAME"
hostnamectl
export PAGER=
+AC_CYCLES=10
+NM_CYCLES=60
+CONNECTION_DEVICE_IN="eth0"
+CONNECTION_DEVICE_PM="eth1"
+CONNECTION_ID_IN="internal"
+CONNECTION_ID_PM="perimeter"
+FQ_HOSTNAME="ifg.in.useribm.hu"
+IPV4_ADDRESSES_IN="10.228.109.254/16, \
+ 192.168.42.254/24, \
+ 192.168.43.254/24"
+IPV4_DNS_IN="10.228.109.159, 10.228.92.159"
+IPV4_DNS_SEARCH_IN="in.useribm.hu"
+IPV4_ROUTES_IN="172.16.223.0/24 10.228.109.236, \
+ 172.24.232.0/24 10.228.109.236, \
+ 10.162.0.0/16 10.228.109.236"
+IPV6_ADDRESSES_IN="2001:1aa1:000a:7dae:000c:18ff:fe03:6dfe/64"
+IPV6_DNS_IN="2001:1aa1:000a:7dae:000c:18ff:fe03:6d9f, \
+ 2001:1aa1:000a:7dae:000c:18ff:fe03:5c9f"
+IPV6_DNS_SEARCH_IN="in.useribm.hu"
+IPV4_ADDRESSES_PM="192.168.173.1/24"
+IPV4_GATEWAY_PM="192.168.173.254"
+IPV6_ADDRESSES_PM="2001:1aa1:000a:7c0c:000c:18ff:fe03:ad01/64"
+IPV6_GATEWAY_PM="2001:1aa1:000a:7c0c:000c:18ff:fe03:adfe"
sleep 1
CYCLES_WAITED=0
while [ $NM_RC -ne 0 ]
do
- if [ $CYCLES_WAITED -ge 10 ]
+ if [ $CYCLES_WAITED -ge $NM_CYCLES ]
then
exit 1
fi
then
echo -n "Waiting for NetworkManager"
fi
- echo -n .
sleep 1
- CYCLES_WAITED=$(( $CYCLES_WAITED + 1 ))
+ CYCLES_WAITED=$(($CYCLES_WAITED + 1))
+ if [ $(($CYCLES_WAITED % 5)) -eq 0 ]
+ then
+ echo -n "+"
+ else
+ echo -n "."
+ fi
systemctl --quiet is-active NetworkManager.service
NM_RC=$?
done
[ $CYCLES_WAITED -gt 0 ] && echo
-# wait for the three network connections to come up
-CONNECTION_DEVICES_UP=$(nmcli --terse connection show \
- | grep --invert-match ':$' | wc -l)
+# wait for the two ethernet connections to activate/come up
+ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
CYCLES_WAITED=0
-while [ $CONNECTION_DEVICES_UP -lt 3 ]
+while [ $ACTIVE_CONNECTIONS -lt 2 ]
do
- if [ $CYCLES_WAITED -ge 10 ]
+ if [ $CYCLES_WAITED -ge $AC_CYCLES ]
then
- echo
- nmcli connection show
+ echo "Less than two active connections" >&2
+ nmcli connection show >&2
exit 1
fi
if [ $CYCLES_WAITED -eq 0 ]
then
- echo -n "Waiting for the network connections"
+ echo -n "Waiting for the ethernet "
+ echo -n "connections to activate/come up"
fi
- echo -n .
sleep 1
- CYCLES_WAITED=$(( $CYCLES_WAITED + 1 ))
- CONNECTION_DEVICES_UP=$(nmcli --terse connection show \
- | grep --invert-match ':$' | wc -l)
+ CYCLES_WAITED=$(($CYCLES_WAITED + 1))
+ if [ $(($CYCLES_WAITED % 5)) -eq 0 ]
+ then
+ echo -n "+"
+ else
+ echo -n "."
+ fi
+ ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
done
[ $CYCLES_WAITED -gt 0 ] && echo
-CONNECTIONS=$(nmcli --terse connection show | wc -l)
-if [ $CONNECTIONS -ne 3 ]
+ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
+if [ $ACTIVE_CONNECTIONS -ne 2 ]
then
- echo "Number of connections: $CONNECTIONS instead of 4" >&2
+ echo -n "Number of active connections: " >&2
+ echo "$ACTIVE_CONNECTIONS instead of 2" >&2
+ nmcli connection show >&2
exit 1
fi
-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}$")
+INACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep ':$' | wc -l)
+if [ $INACTIVE_CONNECTIONS -gt 0 ]
+then
+ echo "Deleting inactive/unused connection(s)"
+ echo "----------------"
+ nmcli connection show
+ nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep ':$' \
+ | cut -f 2 -d ':' \
+ | while read CONNECTION_UUID
+ do
+ nmcli connection delete uuid "$CONNECTION_UUID"
+ done
+ echo "----------------"
+fi
+
+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_UUID_PM=$(echo $CONNECTION_LINE_PM | cut -f 2 -d ':')
nmcli connection delete uuid "$CONNECTION_UUID_PM"
nmcli connection add \
- connection.autoconnect yes \
- connection.id $CONNECTION_ID_IN \
- connection.interface-name $CONNECTION_DEVICE_IN \
+ connection.autoconnect "yes" \
+ 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" \
- ipv4.dns "10.228.109.159, 10.228.92.159" \
- ipv4.dns-search "in.useribm.hu" \
+ ipv4.addresses "$IPV4_ADDRESSES_IN" \
+ ipv4.dns "$IPV4_DNS_IN" \
+ ipv4.dns-search "$IPV4_DNS_SEARCH_IN" \
ipv4.method "manual" \
- ipv4.routes "172.16.223.0/24 10.228.109.236, 172.24.232.0/24 10.228.109.236, 10.162.0.0/16 10.228.109.236" \
- ipv6.addresses "2001:1aa1:000a:7dae:000c:18ff:fe03:6dfe/64" \
- ipv6.dns "2001:1aa1:000a:7dae:000c:18ff:fe03:6d9f, 2001:1aa1:000a:7dae:000c:18ff:fe03:5c9f" \
- ipv6.dns-search "in.useribm.hu" \
+ ipv4.routes "$IPV4_ROUTES_IN" \
+ ipv6.addresses "$IPV6_ADDRESSES_IN" \
+ ipv6.dns "$IPV6_DNS_IN" \
+ ipv6.dns-search "$IPV6_DNS_SEARCH_IN" \
ipv6.method "manual" \
save yes
connection.id $CONNECTION_ID_PM \
connection.interface-name $CONNECTION_DEVICE_PM \
connection.type 802-3-ethernet \
- ipv4.addresses "192.168.173.1/24" \
- ipv4.gateway "192.168.173.254" \
+ ipv4.addresses "$IPV4_ADDRESSES_PM" \
+ ipv4.gateway "$IPV4_GATEWAY_PM" \
ipv4.method "manual" \
- ipv6.addresses "2001:1aa1:000a:7c0c:000c:18ff:fe03:ad01/64" \
- ipv6.gateway "2001:1aa1:000a:7c0c:000c:18ff:fe03:adfe" \
+ ipv6.addresses "$IPV6_ADDRESSES_PM" \
+ ipv6.gateway "$IPV6_GATEWAY_PM" \
ipv6.method "manual" \
save yes
nmcli connection show
-hostnamectl hostname ifg.in.useribm.hu
+hostnamectl hostname "$FQ_HOSTNAME"
hostnamectl
export PAGER=
+AC_CYCLES=10
+NM_CYCLES=60
+CONNECTION_ID="internal"
+FQ_HOSTNAME="kea.in.useribm.hu"
+IPV4_ADDRESSES="10.228.109.127/16"
+IPV4_DNS="10.228.109.159, 10.228.92.159"
+IPV4_DNS_SEARCH="in.useribm.hu"
+IPV4_GATEWAY="10.228.109.254"
sleep 1
CYCLES_WAITED=0
while [ $NM_RC -ne 0 ]
do
- if [ $CYCLES_WAITED -ge 10 ]
+ if [ $CYCLES_WAITED -ge $NM_CYCLES ]
then
exit 1
fi
then
echo -n "Waiting for NetworkManager"
fi
- echo -n .
sleep 1
- CYCLES_WAITED=$(( $CYCLES_WAITED + 1 ))
+ CYCLES_WAITED=$(($CYCLES_WAITED + 1))
+ if [ $(($CYCLES_WAITED % 5)) -eq 0 ]
+ then
+ echo -n "+"
+ else
+ echo -n "."
+ fi
systemctl --quiet is-active NetworkManager.service
NM_RC=$?
done
[ $CYCLES_WAITED -gt 0 ] && echo
-# wait for the two network connections to come up
-CONNECTION_DEVICES_UP=$(nmcli --terse connection show \
- | grep --invert-match ':$' | wc -l)
+# wait for the (only) ethernet connection to activate/come up
+ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
CYCLES_WAITED=0
-while [ $CONNECTION_DEVICES_UP -lt 2 ]
+while [ $ACTIVE_CONNECTIONS -lt 1 ]
do
- if [ $CYCLES_WAITED -ge 10 ]
+ if [ $CYCLES_WAITED -ge $AC_CYCLES ]
then
- echo
- nmcli connection show
+ echo "No active connections" >&2
+ nmcli connection show >&2
exit 1
fi
if [ $CYCLES_WAITED -eq 0 ]
then
- echo -n "Waiting for the network connection"
+ echo -n "Waiting for the ethernet "
+ echo -n "connection to activate/come up"
fi
- echo -n .
sleep 1
- CYCLES_WAITED=$(( $CYCLES_WAITED + 1 ))
- CONNECTION_DEVICES_UP=$(nmcli --terse connection show \
- | grep --invert-match ':$' | wc -l)
+ CYCLES_WAITED=$(($CYCLES_WAITED + 1))
+ if [ $(($CYCLES_WAITED % 5)) -eq 0 ]
+ then
+ echo -n "+"
+ else
+ echo -n "."
+ fi
+ ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
done
[ $CYCLES_WAITED -gt 0 ] && echo
-CONNECTIONS=$(nmcli --terse connection show | wc -l)
-if [ $CONNECTIONS -ne 2 ]
+ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
+if [ $ACTIVE_CONNECTIONS -ne 1 ]
then
- echo "Number of connections: $CONNECTIONS instead of 2" >&2
+ echo -n "Number of active connections: " >&2
+ echo "$ACTIVE_CONNECTIONS instead of 1" >&2
+ nmcli connection show >&2
exit 1
fi
-CONNECTION_DEVICE="eth0"
-CONNECTION_ID="internal"
-CONNECTION_LINE=$(nmcli --terse connection show | grep ":${CONNECTION_DEVICE}$")
+INACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep ':$' | wc -l)
+if [ $INACTIVE_CONNECTIONS -gt 0 ]
+then
+ echo "Deleting inactive/unused connection(s)"
+ echo "----------------"
+ nmcli connection show
+ nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep ':$' \
+ | cut -f 2 -d ':' \
+ | while read CONNECTION_UUID
+ do
+ nmcli connection delete uuid "$CONNECTION_UUID"
+ done
+ echo "----------------"
+fi
+
+CONNECTION_LINE=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:')
+CONNECTION_DEVICE=$(echo $CONNECTION_LINE | cut -f 4 -d ':')
CONNECTION_UUID=$(echo $CONNECTION_LINE | cut -f 2 -d ':')
nmcli connection delete uuid "$CONNECTION_UUID"
nmcli connection add \
- connection.autoconnect yes \
- connection.id $CONNECTION_ID \
- connection.interface-name $CONNECTION_DEVICE \
+ connection.autoconnect "yes" \
+ connection.id "$CONNECTION_ID" \
+ connection.interface-name "$CONNECTION_DEVICE" \
connection.type 802-3-ethernet \
- ipv4.addresses "10.228.109.127/16" \
- ipv4.dns "10.228.109.159, 10.228.92.159" \
- ipv4.dns-search "in.useribm.hu" \
- ipv4.gateway "10.228.109.254" \
+ ipv4.addresses "$IPV4_ADDRESSES" \
+ ipv4.dns "$IPV4_DNS" \
+ ipv4.dns-search "$IPV4_DNS_SEARCH" \
+ ipv4.gateway "$IPV4_GATEWAY" \
ipv4.method "manual" \
ipv6.method "disabled" \
- save yes
+ save "yes"
cat <<EOF >/etc/NetworkManager/conf.d/${CONNECTION_DEVICE}.conf
[device]
nmcli connection show
-hostnamectl hostname kea.in.useribm.hu
+hostnamectl hostname "$FQ_HOSTNAME"
hostnamectl
export PAGER=
+AC_CYCLES=10
+NM_CYCLES=60
+CONNECTION_ID="internal"
+FQ_HOSTNAME="kms.in.useribm.hu"
+IPV4_ADDRESSES="10.228.109.225/16"
+IPV4_DNS="10.228.109.159, 10.228.92.159"
+IPV4_DNS_SEARCH="in.useribm.hu"
+IPV4_GATEWAY="10.228.109.254"
+IPV6_ADDRESSES="2001:1aa1:000a:7dae:000c:18ff:fe03:6de1/64"
+IPV6_DNS="2001:1aa1:000a:7dae:000c:18ff:fe03:6d9f, 2001:1aa1:000a:7dae:000c:18ff:fe03:5c9f"
+IPV6_DNS_SEARCH="in.useribm.hu"
+IPV6_GATEWAY="2001:1aa1:000a:7dae:000c:18ff:fe03:6dfe"
sleep 1
CYCLES_WAITED=0
while [ $NM_RC -ne 0 ]
do
- if [ $CYCLES_WAITED -ge 10 ]
+ if [ $CYCLES_WAITED -ge $NM_CYCLES ]
then
exit 1
fi
then
echo -n "Waiting for NetworkManager"
fi
- echo -n .
sleep 1
- CYCLES_WAITED=$(( $CYCLES_WAITED + 1 ))
+ CYCLES_WAITED=$(($CYCLES_WAITED + 1))
+ if [ $(($CYCLES_WAITED % 5)) -eq 0 ]
+ then
+ echo -n "+"
+ else
+ echo -n "."
+ fi
systemctl --quiet is-active NetworkManager.service
NM_RC=$?
done
[ $CYCLES_WAITED -gt 0 ] && echo
-# wait for the two network connections to come up
-CONNECTION_DEVICES_UP=$(nmcli --terse connection show \
- | grep --invert-match ':$' | wc -l)
+# wait for the (only) ethernet connection to activate/come up
+ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
CYCLES_WAITED=0
-while [ $CONNECTION_DEVICES_UP -lt 2 ]
+while [ $ACTIVE_CONNECTIONS -lt 1 ]
do
- if [ $CYCLES_WAITED -ge 10 ]
+ if [ $CYCLES_WAITED -ge $AC_CYCLES ]
then
- echo
- nmcli connection show
+ echo "No active connections" >&2
+ nmcli connection show >&2
exit 1
fi
if [ $CYCLES_WAITED -eq 0 ]
then
- echo -n "Waiting for the network connection"
+ echo -n "Waiting for the ethernet "
+ echo -n "connection to activate/come up"
fi
- echo -n .
sleep 1
- CYCLES_WAITED=$(( $CYCLES_WAITED + 1 ))
- CONNECTION_DEVICES_UP=$(nmcli --terse connection show \
- | grep --invert-match ':$' | wc -l)
+ CYCLES_WAITED=$(($CYCLES_WAITED + 1))
+ if [ $(($CYCLES_WAITED % 5)) -eq 0 ]
+ then
+ echo -n "+"
+ else
+ echo -n "."
+ fi
+ ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
done
[ $CYCLES_WAITED -gt 0 ] && echo
-CONNECTIONS=$(nmcli --terse connection show | wc -l)
-if [ $CONNECTIONS -ne 2 ]
+ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
+if [ $ACTIVE_CONNECTIONS -ne 1 ]
then
- echo "Number of connections: $CONNECTIONS instead of 2" >&2
+ echo -n "Number of active connections: " >&2
+ echo "$ACTIVE_CONNECTIONS instead of 1" >&2
+ nmcli connection show >&2
exit 1
fi
-CONNECTION_DEVICE="eth0"
-CONNECTION_ID="internal"
-CONNECTION_LINE=$(nmcli --terse connection show | grep ":${CONNECTION_DEVICE}$")
+INACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep ':$' | wc -l)
+if [ $INACTIVE_CONNECTIONS -gt 0 ]
+then
+ echo "Deleting inactive/unused connection(s)"
+ echo "----------------"
+ nmcli connection show
+ nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep ':$' \
+ | cut -f 2 -d ':' \
+ | while read CONNECTION_UUID
+ do
+ nmcli connection delete uuid "$CONNECTION_UUID"
+ done
+ echo "----------------"
+fi
+
+CONNECTION_LINE=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:')
+CONNECTION_DEVICE=$(echo $CONNECTION_LINE | cut -f 4 -d ':')
CONNECTION_UUID=$(echo $CONNECTION_LINE | cut -f 2 -d ':')
nmcli connection delete uuid "$CONNECTION_UUID"
nmcli connection add \
- connection.autoconnect yes \
- connection.id $CONNECTION_ID \
- connection.interface-name $CONNECTION_DEVICE \
+ connection.autoconnect "yes" \
+ connection.id "$CONNECTION_ID" \
+ connection.interface-name "$CONNECTION_DEVICE" \
connection.type 802-3-ethernet \
- ipv4.addresses "10.228.109.225/16" \
- ipv4.dns "10.228.109.159, 10.228.92.159" \
- ipv4.dns-search "in.useribm.hu" \
- ipv4.gateway "10.228.109.254" \
+ ipv4.addresses "$IPV4_ADDRESSES" \
+ ipv4.dns "$IPV4_DNS" \
+ ipv4.dns-search "$IPV4_DNS_SEARCH" \
+ ipv4.gateway "$IPV4_GATEWAY" \
ipv4.method "manual" \
- ipv6.addresses "2001:1aa1:000a:7dae:000c:18ff:fe03:6de1/64" \
- ipv6.dns "2001:1aa1:000a:7dae:000c:18ff:fe03:6d9f, 2001:1aa1:000a:7dae:000c:18ff:fe03:5c9f" \
- ipv6.dns-search "in.useribm.hu" \
- ipv6.gateway "2001:1aa1:000a:7dae:000c:18ff:fe03:6dfe" \
+ ipv6.addresses "$IPV6_ADDRESSES" \
+ ipv6.dns "$IPV6_DNS" \
+ ipv6.dns-search "$IPV6_DNS_SEARCH" \
+ ipv6.gateway "$IPV6_GATEWAY" \
ipv6.method "manual" \
- save yes
+ save "yes"
cat <<EOF >/etc/NetworkManager/conf.d/${CONNECTION_DEVICE}.conf
[device]
nmcli connection show
-hostnamectl hostname kms.in.useribm.hu
+hostnamectl hostname "$FQ_HOSTNAME"
hostnamectl
export PAGER=
+AC_CYCLES=10
+NM_CYCLES=60
+CONNECTION_ID="internal"
+FQ_HOSTNAME="log.in.useribm.hu"
+IPV4_ADDRESSES="10.228.109.77/16"
+IPV4_DNS="10.228.109.159, 10.228.92.159"
+IPV4_DNS_SEARCH="in.useribm.hu"
+IPV4_GATEWAY="10.228.109.254"
+IPV6_ADDRESSES="2001:1aa1:000a:7dae:000c:18ff:fe03:6d4d/64"
+IPV6_DNS="2001:1aa1:000a:7dae:000c:18ff:fe03:6d9f, 2001:1aa1:000a:7dae:000c:18ff:fe03:5c9f"
+IPV6_DNS_SEARCH="in.useribm.hu"
+IPV6_GATEWAY="2001:1aa1:000a:7dae:000c:18ff:fe03:6dfe"
sleep 1
CYCLES_WAITED=0
while [ $NM_RC -ne 0 ]
do
- if [ $CYCLES_WAITED -ge 10 ]
+ if [ $CYCLES_WAITED -ge $NM_CYCLES ]
then
exit 1
fi
then
echo -n "Waiting for NetworkManager"
fi
- echo -n .
sleep 1
- CYCLES_WAITED=$(( $CYCLES_WAITED + 1 ))
+ CYCLES_WAITED=$(($CYCLES_WAITED + 1))
+ if [ $(($CYCLES_WAITED % 5)) -eq 0 ]
+ then
+ echo -n "+"
+ else
+ echo -n "."
+ fi
systemctl --quiet is-active NetworkManager.service
NM_RC=$?
done
[ $CYCLES_WAITED -gt 0 ] && echo
-# wait for the two network connections to come up
-CONNECTION_DEVICES_UP=$(nmcli --terse connection show \
- | grep --invert-match ':$' | wc -l)
+# wait for the (only) ethernet connection to activate/come up
+ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
CYCLES_WAITED=0
-while [ $CONNECTION_DEVICES_UP -lt 2 ]
+while [ $ACTIVE_CONNECTIONS -lt 1 ]
do
- if [ $CYCLES_WAITED -ge 10 ]
+ if [ $CYCLES_WAITED -ge $AC_CYCLES ]
then
- echo
- nmcli connection show
+ echo "No active connections" >&2
+ nmcli connection show >&2
exit 1
fi
if [ $CYCLES_WAITED -eq 0 ]
then
- echo -n "Waiting for the network connection"
+ echo -n "Waiting for the ethernet "
+ echo -n "connection to activate/come up"
fi
- echo -n .
sleep 1
- CYCLES_WAITED=$(( $CYCLES_WAITED + 1 ))
- CONNECTION_DEVICES_UP=$(nmcli --terse connection show \
- | grep --invert-match ':$' | wc -l)
+ CYCLES_WAITED=$(($CYCLES_WAITED + 1))
+ if [ $(($CYCLES_WAITED % 5)) -eq 0 ]
+ then
+ echo -n "+"
+ else
+ echo -n "."
+ fi
+ ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
done
[ $CYCLES_WAITED -gt 0 ] && echo
-CONNECTIONS=$(nmcli --terse connection show | wc -l)
-if [ $CONNECTIONS -ne 2 ]
+ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
+if [ $ACTIVE_CONNECTIONS -ne 1 ]
then
- echo "Number of connections: $CONNECTIONS instead of 2" >&2
+ echo -n "Number of active connections: " >&2
+ echo "$ACTIVE_CONNECTIONS instead of 1" >&2
+ nmcli connection show >&2
exit 1
fi
-CONNECTION_DEVICE="eth0"
-CONNECTION_ID="internal"
-CONNECTION_LINE=$(nmcli --terse connection show | grep ":${CONNECTION_DEVICE}$")
+INACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep ':$' | wc -l)
+if [ $INACTIVE_CONNECTIONS -gt 0 ]
+then
+ echo "Deleting inactive/unused connection(s)"
+ echo "----------------"
+ nmcli connection show
+ nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep ':$' \
+ | cut -f 2 -d ':' \
+ | while read CONNECTION_UUID
+ do
+ nmcli connection delete uuid "$CONNECTION_UUID"
+ done
+ echo "----------------"
+fi
+
+CONNECTION_LINE=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:')
+CONNECTION_DEVICE=$(echo $CONNECTION_LINE | cut -f 4 -d ':')
CONNECTION_UUID=$(echo $CONNECTION_LINE | cut -f 2 -d ':')
nmcli connection delete uuid "$CONNECTION_UUID"
nmcli connection add \
- connection.autoconnect yes \
- connection.id $CONNECTION_ID \
- connection.interface-name $CONNECTION_DEVICE \
+ connection.autoconnect "yes" \
+ connection.id "$CONNECTION_ID" \
+ connection.interface-name "$CONNECTION_DEVICE" \
connection.type 802-3-ethernet \
- ipv4.addresses "10.228.109.77/16" \
- ipv4.dns "10.228.109.159, 10.228.92.159" \
- ipv4.dns-search "in.useribm.hu" \
- ipv4.gateway "10.228.109.254" \
+ ipv4.addresses "$IPV4_ADDRESSES" \
+ ipv4.dns "$IPV4_DNS" \
+ ipv4.dns-search "$IPV4_DNS_SEARCH" \
+ ipv4.gateway "$IPV4_GATEWAY" \
ipv4.method "manual" \
- ipv6.addresses "2001:1aa1:000a:7dae:000c:18ff:fe03:6d4d/64" \
- ipv6.dns "2001:1aa1:000a:7dae:000c:18ff:fe03:5c9f, 2001:1aa1:000a:7dae:000c:18ff:fe03:6d9f" \
- ipv6.dns-search "in.useribm.hu" \
- ipv6.gateway "2001:1aa1:000a:7dae:000c:18ff:fe03:6dfe" \
+ ipv6.addresses "$IPV6_ADDRESSES" \
+ ipv6.dns "$IPV6_DNS" \
+ ipv6.dns-search "$IPV6_DNS_SEARCH" \
+ ipv6.gateway "$IPV6_GATEWAY" \
ipv6.method "manual" \
- save yes
+ save "yes"
cat <<EOF >/etc/NetworkManager/conf.d/${CONNECTION_DEVICE}.conf
[device]
nmcli connection show
-hostnamectl hostname log.in.useribm.hu
+hostnamectl hostname "$FQ_HOSTNAME"
hostnamectl
export PAGER=
+AC_CYCLES=10
+NM_CYCLES=60
+CONNECTION_ID="internal"
+FQ_HOSTNAME="mx.in.useribm.hu"
+IPV4_ADDRESSES="10.228.109.154/16"
+IPV4_DNS="10.228.109.159, 10.228.92.159"
+IPV4_DNS_SEARCH="in.useribm.hu"
+IPV4_GATEWAY="10.228.109.254"
+IPV6_ADDRESSES="2001:1aa1:000a:7dae:000c:18ff:fe03:6d9a/64"
+IPV6_DNS="2001:1aa1:000a:7dae:000c:18ff:fe03:6d9f, 2001:1aa1:000a:7dae:000c:18ff:fe03:5c9f"
+IPV6_DNS_SEARCH="in.useribm.hu"
+IPV6_GATEWAY="2001:1aa1:000a:7dae:000c:18ff:fe03:6dfe"
sleep 1
CYCLES_WAITED=0
while [ $NM_RC -ne 0 ]
do
- if [ $CYCLES_WAITED -ge 10 ]
+ if [ $CYCLES_WAITED -ge $NM_CYCLES ]
then
exit 1
fi
then
echo -n "Waiting for NetworkManager"
fi
- echo -n .
sleep 1
- CYCLES_WAITED=$(( $CYCLES_WAITED + 1 ))
+ CYCLES_WAITED=$(($CYCLES_WAITED + 1))
+ if [ $(($CYCLES_WAITED % 5)) -eq 0 ]
+ then
+ echo -n "+"
+ else
+ echo -n "."
+ fi
systemctl --quiet is-active NetworkManager.service
NM_RC=$?
done
[ $CYCLES_WAITED -gt 0 ] && echo
-# wait for the two network connections to come up
-CONNECTION_DEVICES_UP=$(nmcli --terse connection show \
- | grep --invert-match ':$' | wc -l)
+# wait for the (only) ethernet connection to activate/come up
+ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
CYCLES_WAITED=0
-while [ $CONNECTION_DEVICES_UP -lt 2 ]
+while [ $ACTIVE_CONNECTIONS -lt 1 ]
do
- if [ $CYCLES_WAITED -ge 10 ]
+ if [ $CYCLES_WAITED -ge $AC_CYCLES ]
then
- echo
- nmcli connection show
+ echo "No active connections" >&2
+ nmcli connection show >&2
exit 1
fi
if [ $CYCLES_WAITED -eq 0 ]
then
- echo -n "Waiting for the network connection"
+ echo -n "Waiting for the ethernet "
+ echo -n "connection to activate/come up"
fi
- echo -n .
sleep 1
- CYCLES_WAITED=$(( $CYCLES_WAITED + 1 ))
- CONNECTION_DEVICES_UP=$(nmcli --terse connection show \
- | grep --invert-match ':$' | wc -l)
+ CYCLES_WAITED=$(($CYCLES_WAITED + 1))
+ if [ $(($CYCLES_WAITED % 5)) -eq 0 ]
+ then
+ echo -n "+"
+ else
+ echo -n "."
+ fi
+ ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
done
[ $CYCLES_WAITED -gt 0 ] && echo
-CONNECTIONS=$(nmcli --terse connection show | wc -l)
-if [ $CONNECTIONS -ne 2 ]
+ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
+if [ $ACTIVE_CONNECTIONS -ne 1 ]
then
- echo "Number of connections: $CONNECTIONS instead of 2" >&2
+ echo -n "Number of active connections: " >&2
+ echo "$ACTIVE_CONNECTIONS instead of 1" >&2
+ nmcli connection show >&2
exit 1
fi
-CONNECTION_DEVICE="eth0"
-CONNECTION_ID="internal"
-CONNECTION_LINE=$(nmcli --terse connection show | grep ":${CONNECTION_DEVICE}$")
+INACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep ':$' | wc -l)
+if [ $INACTIVE_CONNECTIONS -gt 0 ]
+then
+ echo "Deleting inactive/unused connection(s)"
+ echo "----------------"
+ nmcli connection show
+ nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep ':$' \
+ | cut -f 2 -d ':' \
+ | while read CONNECTION_UUID
+ do
+ nmcli connection delete uuid "$CONNECTION_UUID"
+ done
+ echo "----------------"
+fi
+
+CONNECTION_LINE=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:')
+CONNECTION_DEVICE=$(echo $CONNECTION_LINE | cut -f 4 -d ':')
CONNECTION_UUID=$(echo $CONNECTION_LINE | cut -f 2 -d ':')
nmcli connection delete uuid "$CONNECTION_UUID"
nmcli connection add \
- connection.autoconnect yes \
- connection.id $CONNECTION_ID \
- connection.interface-name $CONNECTION_DEVICE \
+ connection.autoconnect "yes" \
+ connection.id "$CONNECTION_ID" \
+ connection.interface-name "$CONNECTION_DEVICE" \
connection.type 802-3-ethernet \
- ipv4.addresses "10.228.109.154/16" \
- ipv4.dns "10.228.109.159, 10.228.92.159" \
- ipv4.dns-search "in.useribm.hu" \
- ipv4.gateway "10.228.109.254" \
+ ipv4.addresses "$IPV4_ADDRESSES" \
+ ipv4.dns "$IPV4_DNS" \
+ ipv4.dns-search "$IPV4_DNS_SEARCH" \
+ ipv4.gateway "$IPV4_GATEWAY" \
ipv4.method "manual" \
- ipv6.addresses "2001:1aa1:000a:7dae:000c:18ff:fe03:6d9a/64" \
- ipv6.dns "2001:1aa1:000a:7dae:000c:18ff:fe03:5c9f, 2001:1aa1:000a:7dae:000c:18ff:fe03:6d9f" \
- ipv6.dns-search "in.useribm.hu" \
- ipv6.gateway "2001:1aa1:000a:7dae:000c:18ff:fe03:6dfe" \
+ ipv6.addresses "$IPV6_ADDRESSES" \
+ ipv6.dns "$IPV6_DNS" \
+ ipv6.dns-search "$IPV6_DNS_SEARCH" \
+ ipv6.gateway "$IPV6_GATEWAY" \
ipv6.method "manual" \
- save yes
+ save "yes"
cat <<EOF >/etc/NetworkManager/conf.d/${CONNECTION_DEVICE}.conf
[device]
nmcli connection show
-hostnamectl hostname mx.in.useribm.hu
+hostnamectl hostname "$FQ_HOSTNAME"
hostnamectl
export PAGER=
+AC_CYCLES=10
+NM_CYCLES=60
+CONNECTION_ID="perimeter"
+FQ_HOSTNAME="mx.pm.useribm.hu"
+IPV4_ADDRESSES="192.168.173.154/24"
+IPV4_DNS="192.168.173.223"
+IPV4_DNS_SEARCH="pm.useribm.hu"
+IPV4_GATEWAY="192.168.173.254"
+IPV4_ROUTES="10.228.0.0/16 192.168.173.1"
+IPV6_ADDRESSES="2001:1aa1:000a:7c0c:000c:18ff:fe03:ad9a/64"
+IPV6_DNS="2001:1aa1:000a:7c0c:000c:18ff:fe03:addf"
+IPV6_DNS_SEARCH="pm.useribm.hu"
+IPV6_GATEWAY="2001:1aa1:000a:7c0c:000c:18ff:fe03:adfe"
+IPV6_ROUTES="2001:1aa1:000a:7dae::/64 2001:1aa1:000a:7c0c:000c:18ff:fe03:ad01"
sleep 1
CYCLES_WAITED=0
while [ $NM_RC -ne 0 ]
do
- if [ $CYCLES_WAITED -ge 10 ]
+ if [ $CYCLES_WAITED -ge $NM_CYCLES ]
then
exit 1
fi
then
echo -n "Waiting for NetworkManager"
fi
- echo -n .
sleep 1
- CYCLES_WAITED=$(( $CYCLES_WAITED + 1 ))
+ CYCLES_WAITED=$(($CYCLES_WAITED + 1))
+ if [ $(($CYCLES_WAITED % 5)) -eq 0 ]
+ then
+ echo -n "+"
+ else
+ echo -n "."
+ fi
systemctl --quiet is-active NetworkManager.service
NM_RC=$?
done
[ $CYCLES_WAITED -gt 0 ] && echo
-# wait for the two network connections to come up
-CONNECTION_DEVICES_UP=$(nmcli --terse connection show \
- | grep --invert-match ':$' | wc -l)
+# wait for the (only) ethernet connection to activate/come up
+ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
CYCLES_WAITED=0
-while [ $CONNECTION_DEVICES_UP -lt 2 ]
+while [ $ACTIVE_CONNECTIONS -lt 1 ]
do
- if [ $CYCLES_WAITED -ge 10 ]
+ if [ $CYCLES_WAITED -ge $AC_CYCLES ]
then
- echo
- nmcli connection show
+ echo "No active connections" >&2
+ nmcli connection show >&2
exit 1
fi
if [ $CYCLES_WAITED -eq 0 ]
then
- echo -n "Waiting for the network connection"
+ echo -n "Waiting for the ethernet "
+ echo -n "connection to activate/come up"
fi
- echo -n .
sleep 1
- CYCLES_WAITED=$(( $CYCLES_WAITED + 1 ))
- CONNECTION_DEVICES_UP=$(nmcli --terse connection show \
- | grep --invert-match ':$' | wc -l)
+ CYCLES_WAITED=$(($CYCLES_WAITED + 1))
+ if [ $(($CYCLES_WAITED % 5)) -eq 0 ]
+ then
+ echo -n "+"
+ else
+ echo -n "."
+ fi
+ ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
done
[ $CYCLES_WAITED -gt 0 ] && echo
-CONNECTIONS=$(nmcli --terse connection show | wc -l)
-if [ $CONNECTIONS -ne 2 ]
+ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
+if [ $ACTIVE_CONNECTIONS -ne 1 ]
then
- echo "Number of connections: $CONNECTIONS instead of 2" >&2
+ echo -n "Number of active connections: " >&2
+ echo "$ACTIVE_CONNECTIONS instead of 1" >&2
+ nmcli connection show >&2
exit 1
fi
-CONNECTION_DEVICE="eth0"
-CONNECTION_ID="perimeter"
-CONNECTION_LINE=$(nmcli --terse connection show | grep ":${CONNECTION_DEVICE}$")
+INACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep ':$' | wc -l)
+if [ $INACTIVE_CONNECTIONS -gt 0 ]
+then
+ echo "Deleting inactive/unused connection(s)"
+ echo "----------------"
+ nmcli connection show
+ nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep ':$' \
+ | cut -f 2 -d ':' \
+ | while read CONNECTION_UUID
+ do
+ nmcli connection delete uuid "$CONNECTION_UUID"
+ done
+ echo "----------------"
+fi
+
+CONNECTION_LINE=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:')
+CONNECTION_DEVICE=$(echo $CONNECTION_LINE | cut -f 4 -d ':')
CONNECTION_UUID=$(echo $CONNECTION_LINE | cut -f 2 -d ':')
nmcli connection delete uuid "$CONNECTION_UUID"
nmcli connection add \
- connection.autoconnect yes \
- connection.id $CONNECTION_ID \
- connection.interface-name $CONNECTION_DEVICE \
+ connection.autoconnect "yes" \
+ connection.id "$CONNECTION_ID" \
+ connection.interface-name "$CONNECTION_DEVICE" \
connection.type 802-3-ethernet \
- ipv4.addresses "192.168.173.154/24" \
- ipv4.dns "192.168.173.223" \
- ipv4.dns-search "pm.useribm.hu" \
- ipv4.gateway "192.168.173.254" \
+ ipv4.addresses "$IPV4_ADDRESSES" \
+ ipv4.dns "$IPV4_DNS" \
+ ipv4.dns-search "$IPV4_DNS_SEARCH" \
+ ipv4.gateway "$IPV4_GATEWAY" \
ipv4.method "manual" \
- ipv4.routes "10.228.0.0/16 192.168.173.1" \
- ipv6.addresses "2001:1aa1:000a:7c0c:000c:18ff:fe03:ad9a/64" \
- ipv6.dns "2001:1aa1:000a:7c0c:000c:18ff:fe03:addf" \
- ipv6.dns-search "pm.useribm.hu" \
- ipv6.gateway "2001:1aa1:000a:7c0c:000c:18ff:fe03:adfe" \
+ ipv4.routes "$IPV4_ROUTES" \
+ ipv6.addresses "$IPV6_ADDRESSES" \
+ ipv6.dns "$IPV6_DNS" \
+ ipv6.dns-search "$IPV6_DNS_SEARCH" \
+ ipv6.gateway "$IPV6_GATEWAY" \
ipv6.method "manual" \
- ipv6.routes "2001:1aa1:000a:7dae::/64 2001:1aa1:000a:7c0c:000c:18ff:fe03:ad01" \
- save yes
+ ipv6.routes "$IPV6_ROUTES" \
+ save "yes"
cat <<EOF >/etc/NetworkManager/conf.d/${CONNECTION_DEVICE}.conf
[device]
nmcli connection show
-hostnamectl hostname mx.pm.useribm.hu
+hostnamectl hostname "$FQ_HOSTNAME"
hostnamectl
export PAGER=
+AC_CYCLES=10
+NM_CYCLES=60
+CONNECTION_ID="internal"
+FQ_HOSTNAME="ns1.in.useribm.hu"
+IPV4_ADDRESSES="10.228.109.159/16"
+IPV4_DNS="10.228.92.159, 10.228.109.159"
+IPV4_DNS_SEARCH="in.useribm.hu"
+IPV4_GATEWAY="10.228.109.254"
+IPV6_ADDRESSES="2001:1aa1:000a:7dae:000c:18ff:fe03:6d9f/64"
+IPV6_DNS="2001:1aa1:000a:7dae:000c:18ff:fe03:5c9f, 2001:1aa1:000a:7dae:000c:18ff:fe03:6d9f"
+IPV6_DNS_SEARCH="in.useribm.hu"
+IPV6_GATEWAY="2001:1aa1:000a:7dae:000c:18ff:fe03:6dfe"
sleep 1
CYCLES_WAITED=0
while [ $NM_RC -ne 0 ]
do
- if [ $CYCLES_WAITED -ge 10 ]
+ if [ $CYCLES_WAITED -ge $NM_CYCLES ]
then
exit 1
fi
then
echo -n "Waiting for NetworkManager"
fi
- echo -n .
sleep 1
- CYCLES_WAITED=$(( $CYCLES_WAITED + 1 ))
+ CYCLES_WAITED=$(($CYCLES_WAITED + 1))
+ if [ $(($CYCLES_WAITED % 5)) -eq 0 ]
+ then
+ echo -n "+"
+ else
+ echo -n "."
+ fi
systemctl --quiet is-active NetworkManager.service
NM_RC=$?
done
[ $CYCLES_WAITED -gt 0 ] && echo
-# wait for the two network connections to come up
-CONNECTION_DEVICES_UP=$(nmcli --terse connection show \
- | grep --invert-match ':$' | wc -l)
+# wait for the (only) ethernet connection to activate/come up
+ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
CYCLES_WAITED=0
-while [ $CONNECTION_DEVICES_UP -lt 2 ]
+while [ $ACTIVE_CONNECTIONS -lt 1 ]
do
- if [ $CYCLES_WAITED -ge 10 ]
+ if [ $CYCLES_WAITED -ge $AC_CYCLES ]
then
- echo
- nmcli connection show
+ echo "No active connections" >&2
+ nmcli connection show >&2
exit 1
fi
if [ $CYCLES_WAITED -eq 0 ]
then
- echo -n "Waiting for the network connection"
+ echo -n "Waiting for the ethernet "
+ echo -n "connection to activate/come up"
fi
- echo -n .
sleep 1
- CYCLES_WAITED=$(( $CYCLES_WAITED + 1 ))
- CONNECTION_DEVICES_UP=$(nmcli --terse connection show \
- | grep --invert-match ':$' | wc -l)
+ CYCLES_WAITED=$(($CYCLES_WAITED + 1))
+ if [ $(($CYCLES_WAITED % 5)) -eq 0 ]
+ then
+ echo -n "+"
+ else
+ echo -n "."
+ fi
+ ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
done
[ $CYCLES_WAITED -gt 0 ] && echo
-CONNECTIONS=$(nmcli --terse connection show | wc -l)
-if [ $CONNECTIONS -ne 2 ]
+ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
+if [ $ACTIVE_CONNECTIONS -ne 1 ]
then
- echo "Number of connections: $CONNECTIONS instead of 2" >&2
+ echo -n "Number of active connections: " >&2
+ echo "$ACTIVE_CONNECTIONS instead of 1" >&2
+ nmcli connection show >&2
exit 1
fi
-CONNECTION_DEVICE="eth0"
-CONNECTION_ID="internal"
-CONNECTION_LINE=$(nmcli --terse connection show | grep ":${CONNECTION_DEVICE}$")
+INACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep ':$' | wc -l)
+if [ $INACTIVE_CONNECTIONS -gt 0 ]
+then
+ echo "Deleting inactive/unused connection(s)"
+ echo "----------------"
+ nmcli connection show
+ nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep ':$' \
+ | cut -f 2 -d ':' \
+ | while read CONNECTION_UUID
+ do
+ nmcli connection delete uuid "$CONNECTION_UUID"
+ done
+ echo "----------------"
+fi
+
+CONNECTION_LINE=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:')
+CONNECTION_DEVICE=$(echo $CONNECTION_LINE | cut -f 4 -d ':')
CONNECTION_UUID=$(echo $CONNECTION_LINE | cut -f 2 -d ':')
nmcli connection delete uuid "$CONNECTION_UUID"
nmcli connection add \
- connection.autoconnect yes \
- connection.id $CONNECTION_ID \
- connection.interface-name $CONNECTION_DEVICE \
+ connection.autoconnect "yes" \
+ connection.id "$CONNECTION_ID" \
+ connection.interface-name "$CONNECTION_DEVICE" \
connection.type 802-3-ethernet \
- ipv4.addresses "10.228.109.159/16" \
- ipv4.dns "10.228.92.159, 10.228.109.159" \
- ipv4.dns-search "in.useribm.hu" \
- ipv4.gateway "10.228.109.254" \
+ ipv4.addresses "$IPV4_ADDRESSES" \
+ ipv4.dns "$IPV4_DNS" \
+ ipv4.dns-search "$IPV4_DNS_SEARCH" \
+ ipv4.gateway "$IPV4_GATEWAY" \
ipv4.method "manual" \
- ipv6.addresses "2001:1aa1:000a:7dae:000c:18ff:fe03:6d9f/64" \
- ipv6.dns "2001:1aa1:000a:7dae:000c:18ff:fe03:5c9f, 2001:1aa1:000a:7dae:000c:18ff:fe03:6d9f" \
- ipv6.dns-search "in.useribm.hu" \
- ipv6.gateway "2001:1aa1:000a:7dae:000c:18ff:fe03:6dfe" \
+ ipv6.addresses "$IPV6_ADDRESSES" \
+ ipv6.dns "$IPV6_DNS" \
+ ipv6.dns-search "$IPV6_DNS_SEARCH" \
+ ipv6.gateway "$IPV6_GATEWAY" \
ipv6.method "manual" \
- save yes
+ save "yes"
cat <<EOF >/etc/NetworkManager/conf.d/${CONNECTION_DEVICE}.conf
[device]
nmcli connection show
-hostnamectl hostname ns1.in.useribm.hu
+hostnamectl hostname "$FQ_HOSTNAME"
hostnamectl
export PAGER=
+AC_CYCLES=10
+NM_CYCLES=60
+CONNECTION_ID="internal"
+FQ_HOSTNAME="ns2.in.useribm.hu"
+IPV4_ADDRESSES="10.228.92.159/16"
+IPV4_DNS="10.228.109.159, 10.228.92.159"
+IPV4_DNS_SEARCH="in.useribm.hu"
+IPV4_GATEWAY="10.228.109.254"
+IPV6_ADDRESSES="2001:1aa1:000a:7dae:000c:18ff:fe03:5c9f/64"
+IPV6_DNS="2001:1aa1:000a:7dae:000c:18ff:fe03:6d9f, 2001:1aa1:000a:7dae:000c:18ff:fe03:5c9f"
+IPV6_DNS_SEARCH="in.useribm.hu"
+IPV6_GATEWAY="2001:1aa1:000a:7dae:000c:18ff:fe03:6dfe"
sleep 1
CYCLES_WAITED=0
while [ $NM_RC -ne 0 ]
do
- if [ $CYCLES_WAITED -ge 10 ]
+ if [ $CYCLES_WAITED -ge $NM_CYCLES ]
then
exit 1
fi
then
echo -n "Waiting for NetworkManager"
fi
- echo -n .
sleep 1
- CYCLES_WAITED=$(( $CYCLES_WAITED + 1 ))
+ CYCLES_WAITED=$(($CYCLES_WAITED + 1))
+ if [ $(($CYCLES_WAITED % 5)) -eq 0 ]
+ then
+ echo -n "+"
+ else
+ echo -n "."
+ fi
systemctl --quiet is-active NetworkManager.service
NM_RC=$?
done
[ $CYCLES_WAITED -gt 0 ] && echo
-# wait for the two network connections to come up
-CONNECTION_DEVICES_UP=$(nmcli --terse connection show \
- | grep --invert-match ':$' | wc -l)
+# wait for the (only) ethernet connection to activate/come up
+ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
CYCLES_WAITED=0
-while [ $CONNECTION_DEVICES_UP -lt 2 ]
+while [ $ACTIVE_CONNECTIONS -lt 1 ]
do
- if [ $CYCLES_WAITED -ge 10 ]
+ if [ $CYCLES_WAITED -ge $AC_CYCLES ]
then
- echo
- nmcli connection show
+ echo "No active connections" >&2
+ nmcli connection show >&2
exit 1
fi
if [ $CYCLES_WAITED -eq 0 ]
then
- echo -n "Waiting for the network connection"
+ echo -n "Waiting for the ethernet "
+ echo -n "connection to activate/come up"
fi
- echo -n .
sleep 1
- CYCLES_WAITED=$(( $CYCLES_WAITED + 1 ))
- CONNECTION_DEVICES_UP=$(nmcli --terse connection show \
- | grep --invert-match ':$' | wc -l)
+ CYCLES_WAITED=$(($CYCLES_WAITED + 1))
+ if [ $(($CYCLES_WAITED % 5)) -eq 0 ]
+ then
+ echo -n "+"
+ else
+ echo -n "."
+ fi
+ ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
done
[ $CYCLES_WAITED -gt 0 ] && echo
-CONNECTIONS=$(nmcli --terse connection show | wc -l)
-if [ $CONNECTIONS -ne 2 ]
+ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
+if [ $ACTIVE_CONNECTIONS -ne 1 ]
then
- echo "Number of connections: $CONNECTIONS instead of 2" >&2
+ echo -n "Number of active connections: " >&2
+ echo "$ACTIVE_CONNECTIONS instead of 1" >&2
+ nmcli connection show >&2
exit 1
fi
-CONNECTION_DEVICE="eth0"
-CONNECTION_ID="internal"
-CONNECTION_LINE=$(nmcli --terse connection show | grep ":${CONNECTION_DEVICE}$")
+INACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep ':$' | wc -l)
+if [ $INACTIVE_CONNECTIONS -gt 0 ]
+then
+ echo "Deleting inactive/unused connection(s)"
+ echo "----------------"
+ nmcli connection show
+ nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep ':$' \
+ | cut -f 2 -d ':' \
+ | while read CONNECTION_UUID
+ do
+ nmcli connection delete uuid "$CONNECTION_UUID"
+ done
+ echo "----------------"
+fi
+
+CONNECTION_LINE=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:')
+CONNECTION_DEVICE=$(echo $CONNECTION_LINE | cut -f 4 -d ':')
CONNECTION_UUID=$(echo $CONNECTION_LINE | cut -f 2 -d ':')
nmcli connection delete uuid "$CONNECTION_UUID"
nmcli connection add \
- connection.autoconnect yes \
- connection.id $CONNECTION_ID \
- connection.interface-name $CONNECTION_DEVICE \
+ connection.autoconnect "yes" \
+ connection.id "$CONNECTION_ID" \
+ connection.interface-name "$CONNECTION_DEVICE" \
connection.type 802-3-ethernet \
- ipv4.addresses "10.228.92.159/16" \
- ipv4.dns "10.228.109.159, 10.228.92.159" \
- ipv4.dns-search "in.useribm.hu" \
- ipv4.gateway "10.228.109.254" \
+ ipv4.addresses "$IPV4_ADDRESSES" \
+ ipv4.dns "$IPV4_DNS" \
+ ipv4.dns-search "$IPV4_DNS_SEARCH" \
+ ipv4.gateway "$IPV4_GATEWAY" \
ipv4.method "manual" \
- ipv6.addresses "2001:1aa1:000a:7dae:000c:18ff:fe03:5c9f/64" \
- ipv6.dns "2001:1aa1:000a:7dae:000c:18ff:fe03:6d9f, 2001:1aa1:000a:7dae:000c:18ff:fe03:5c9f" \
- ipv6.dns-search "in.useribm.hu" \
- ipv6.gateway "2001:1aa1:000a:7dae:000c:18ff:fe03:6dfe" \
+ ipv6.addresses "$IPV6_ADDRESSES" \
+ ipv6.dns "$IPV6_DNS" \
+ ipv6.dns-search "$IPV6_DNS_SEARCH" \
+ ipv6.gateway "$IPV6_GATEWAY" \
ipv6.method "manual" \
- save yes
+ save "yes"
cat <<EOF >/etc/NetworkManager/conf.d/${CONNECTION_DEVICE}.conf
[device]
nmcli connection show
-hostnamectl hostname ns2.in.useribm.hu
+hostnamectl hostname "$FQ_HOSTNAME"
hostnamectl
export PAGER=
+AC_CYCLES=10
+NM_CYCLES=60
+CONNECTION_ID="internal"
+FQ_HOSTNAME="pgs.in.useribm.hu"
+IPV4_ADDRESSES="10.228.109.153/16"
+IPV4_DNS="10.228.109.159, 10.228.92.159"
+IPV4_DNS_SEARCH="in.useribm.hu"
+IPV4_GATEWAY="10.228.109.254"
+IPV6_ADDRESSES="2001:1aa1:000a:7dae:000c:18ff:fe03:6d99/64"
+IPV6_DNS="2001:1aa1:000a:7dae:000c:18ff:fe03:6d9f, 2001:1aa1:000a:7dae:000c:18ff:fe03:5c9f"
+IPV6_DNS_SEARCH="in.useribm.hu"
+IPV6_GATEWAY="2001:1aa1:000a:7dae:000c:18ff:fe03:6dfe"
sleep 1
CYCLES_WAITED=0
while [ $NM_RC -ne 0 ]
do
- if [ $CYCLES_WAITED -ge 10 ]
+ if [ $CYCLES_WAITED -ge $NM_CYCLES ]
then
exit 1
fi
then
echo -n "Waiting for NetworkManager"
fi
- echo -n .
sleep 1
- CYCLES_WAITED=$(( $CYCLES_WAITED + 1 ))
+ CYCLES_WAITED=$(($CYCLES_WAITED + 1))
+ if [ $(($CYCLES_WAITED % 5)) -eq 0 ]
+ then
+ echo -n "+"
+ else
+ echo -n "."
+ fi
systemctl --quiet is-active NetworkManager.service
NM_RC=$?
done
[ $CYCLES_WAITED -gt 0 ] && echo
-# wait for the two network connections to come up
-# the two connections being the loopback and eth0
-CONNECTION_DEVICES_UP=$(nmcli --terse connection show --active | wc -l)
+# wait for the (only) ethernet connection to activate/come up
+ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
CYCLES_WAITED=0
-while [ $CONNECTION_DEVICES_UP -lt 2 ]
+while [ $ACTIVE_CONNECTIONS -lt 1 ]
do
- if [ $CYCLES_WAITED -ge 10 ]
+ if [ $CYCLES_WAITED -ge $AC_CYCLES ]
then
- echo
- nmcli connection show
+ echo "No active connections" >&2
+ nmcli connection show >&2
exit 1
fi
if [ $CYCLES_WAITED -eq 0 ]
then
- echo -n "Waiting for the network connection"
+ echo -n "Waiting for the ethernet "
+ echo -n "connection to activate/come up"
fi
- echo -n .
sleep 1
- CYCLES_WAITED=$(( $CYCLES_WAITED + 1 ))
- CONNECTION_DEVICES_UP=$(nmcli --terse connection show --active \
- | wc -l)
+ CYCLES_WAITED=$(($CYCLES_WAITED + 1))
+ if [ $(($CYCLES_WAITED % 5)) -eq 0 ]
+ then
+ echo -n "+"
+ else
+ echo -n "."
+ fi
+ ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
done
[ $CYCLES_WAITED -gt 0 ] && echo
-CONNECTIONS=$(nmcli --terse connection show \
- | grep ':802-3-ethernet:' | wc -l)
-if [ $CONNECTIONS -ne 1 ]
+ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
+if [ $ACTIVE_CONNECTIONS -ne 1 ]
then
- echo "There are $CONNECTIONS ethernet connections (instead of 1):"
+ echo -n "Number of active connections: " >&2
+ echo "$ACTIVE_CONNECTIONS instead of 1" >&2
+ nmcli connection show >&2
+ exit 1
+fi
+
+INACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep ':$' | wc -l)
+if [ $INACTIVE_CONNECTIONS -gt 0 ]
+then
+ echo "Deleting inactive/unused connection(s)"
+ echo "----------------"
nmcli connection show
+ nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep ':$' \
+ | cut -f 2 -d ':' \
+ | while read CONNECTION_UUID
+ do
+ nmcli connection delete uuid "$CONNECTION_UUID"
+ done
+ echo "----------------"
fi
-CONNECTION_DEVICE="eth0"
-CONNECTION_ID="internal"
+CONNECTION_LINE=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:')
+CONNECTION_DEVICE=$(echo $CONNECTION_LINE | cut -f 4 -d ':')
+CONNECTION_UUID=$(echo $CONNECTION_LINE | cut -f 2 -d ':')
-nmcli --terse connection show \
- | grep ':802-3-ethernet:' \
- | while read CONNECTION_LINE
-do
- CONNECTION_UUID=$(echo $CONNECTION_LINE | cut -f 2 -d ':')
- nmcli connection delete uuid "$CONNECTION_UUID"
-done
+nmcli connection delete uuid "$CONNECTION_UUID"
nmcli connection add \
- connection.autoconnect yes \
- connection.id $CONNECTION_ID \
- connection.interface-name $CONNECTION_DEVICE \
+ connection.autoconnect "yes" \
+ connection.id "$CONNECTION_ID" \
+ connection.interface-name "$CONNECTION_DEVICE" \
connection.type 802-3-ethernet \
- ipv4.addresses "10.228.109.153/16" \
- ipv4.dns "10.228.109.159, 10.228.92.159" \
- ipv4.dns-search "in.useribm.hu" \
- ipv4.gateway "10.228.109.254" \
+ ipv4.addresses "$IPV4_ADDRESSES" \
+ ipv4.dns "$IPV4_DNS" \
+ ipv4.dns-search "$IPV4_DNS_SEARCH" \
+ ipv4.gateway "$IPV4_GATEWAY" \
ipv4.method "manual" \
- ipv6.addresses "2001:1aa1:000a:7dae:000c:18ff:fe03:6d99/64" \
- ipv6.dns "2001:1aa1:000a:7dae:000c:18ff:fe03:5c9f, 2001:1aa1:000a:7dae:000c:18ff:fe03:6d9f" \
- ipv6.dns-search "in.useribm.hu" \
- ipv6.gateway "2001:1aa1:000a:7dae:000c:18ff:fe03:6dfe" \
+ ipv6.addresses "$IPV6_ADDRESSES" \
+ ipv6.dns "$IPV6_DNS" \
+ ipv6.dns-search "$IPV6_DNS_SEARCH" \
+ ipv6.gateway "$IPV6_GATEWAY" \
ipv6.method "manual" \
- save yes
+ save "yes"
cat <<EOF >/etc/NetworkManager/conf.d/${CONNECTION_DEVICE}.conf
[device]
nmcli connection show
-hostnamectl hostname pgs.in.useribm.hu
+hostnamectl hostname "$FQ_HOSTNAME"
hostnamectl
export PAGER=
+AC_CYCLES=10
+NM_CYCLES=60
+CONNECTION_ID="internal"
+FQ_HOSTNAME="pki.in.useribm.hu"
+IPV4_ADDRESSES="10.228.109.183/16"
+IPV4_DNS="10.228.109.159, 10.228.92.159"
+IPV4_DNS_SEARCH="in.useribm.hu"
+IPV4_GATEWAY="10.228.109.254"
+IPV6_ADDRESSES="2001:1aa1:000a:7dae:000c:18ff:fe03:6db7/64"
+IPV6_DNS="2001:1aa1:000a:7dae:000c:18ff:fe03:6d9f, 2001:1aa1:000a:7dae:000c:18ff:fe03:5c9f"
+IPV6_DNS_SEARCH="in.useribm.hu"
+IPV6_GATEWAY="2001:1aa1:000a:7dae:000c:18ff:fe03:6dfe"
sleep 1
CYCLES_WAITED=0
while [ $NM_RC -ne 0 ]
do
- if [ $CYCLES_WAITED -ge 10 ]
+ if [ $CYCLES_WAITED -ge $NM_CYCLES ]
then
exit 1
fi
then
echo -n "Waiting for NetworkManager"
fi
- echo -n .
sleep 1
- CYCLES_WAITED=$(( $CYCLES_WAITED + 1 ))
+ CYCLES_WAITED=$(($CYCLES_WAITED + 1))
+ if [ $(($CYCLES_WAITED % 5)) -eq 0 ]
+ then
+ echo -n "+"
+ else
+ echo -n "."
+ fi
systemctl --quiet is-active NetworkManager.service
NM_RC=$?
done
[ $CYCLES_WAITED -gt 0 ] && echo
-# wait for the two network connections to come up
-CONNECTION_DEVICES_UP=$(nmcli --terse connection show \
- | grep --invert-match ':$' | wc -l)
+# wait for the (only) ethernet connection to activate/come up
+ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
CYCLES_WAITED=0
-while [ $CONNECTION_DEVICES_UP -lt 2 ]
+while [ $ACTIVE_CONNECTIONS -lt 1 ]
do
- if [ $CYCLES_WAITED -ge 10 ]
+ if [ $CYCLES_WAITED -ge $AC_CYCLES ]
then
- echo
- nmcli connection show
+ echo "No active connections" >&2
+ nmcli connection show >&2
exit 1
fi
if [ $CYCLES_WAITED -eq 0 ]
then
- echo -n "Waiting for the network connection"
+ echo -n "Waiting for the ethernet "
+ echo -n "connection to activate/come up"
fi
- echo -n .
sleep 1
- CYCLES_WAITED=$(( $CYCLES_WAITED + 1 ))
- CONNECTION_DEVICES_UP=$(nmcli --terse connection show \
- | grep --invert-match ':$' | wc -l)
+ CYCLES_WAITED=$(($CYCLES_WAITED + 1))
+ if [ $(($CYCLES_WAITED % 5)) -eq 0 ]
+ then
+ echo -n "+"
+ else
+ echo -n "."
+ fi
+ ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
done
[ $CYCLES_WAITED -gt 0 ] && echo
-CONNECTIONS=$(nmcli --terse connection show | wc -l)
-if [ $CONNECTIONS -ne 2 ]
+ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
+if [ $ACTIVE_CONNECTIONS -ne 1 ]
then
- echo "Number of connections: $CONNECTIONS instead of 2" >&2
+ echo -n "Number of active connections: " >&2
+ echo "$ACTIVE_CONNECTIONS instead of 1" >&2
+ nmcli connection show >&2
exit 1
fi
-CONNECTION_DEVICE="eth0"
-CONNECTION_ID="internal"
-CONNECTION_LINE=$(nmcli --terse connection show | grep ":${CONNECTION_DEVICE}$")
+INACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep ':$' | wc -l)
+if [ $INACTIVE_CONNECTIONS -gt 0 ]
+then
+ echo "Deleting inactive/unused connection(s)"
+ echo "----------------"
+ nmcli connection show
+ nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep ':$' \
+ | cut -f 2 -d ':' \
+ | while read CONNECTION_UUID
+ do
+ nmcli connection delete uuid "$CONNECTION_UUID"
+ done
+ echo "----------------"
+fi
+
+CONNECTION_LINE=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:')
+CONNECTION_DEVICE=$(echo $CONNECTION_LINE | cut -f 4 -d ':')
CONNECTION_UUID=$(echo $CONNECTION_LINE | cut -f 2 -d ':')
nmcli connection delete uuid "$CONNECTION_UUID"
nmcli connection add \
- connection.autoconnect yes \
- connection.id $CONNECTION_ID \
- connection.interface-name $CONNECTION_DEVICE \
+ connection.autoconnect "yes" \
+ connection.id "$CONNECTION_ID" \
+ connection.interface-name "$CONNECTION_DEVICE" \
connection.type 802-3-ethernet \
- ipv4.addresses "10.228.109.183/16" \
- ipv4.dns "10.228.109.159, 10.228.92.159" \
- ipv4.dns-search "in.useribm.hu" \
- ipv4.gateway "10.228.109.254" \
+ ipv4.addresses "$IPV4_ADDRESSES" \
+ ipv4.dns "$IPV4_DNS" \
+ ipv4.dns-search "$IPV4_DNS_SEARCH" \
+ ipv4.gateway "$IPV4_GATEWAY" \
ipv4.method "manual" \
- ipv6.addresses "2001:1aa1:000a:7dae:000c:18ff:fe03:6db7/64" \
- ipv6.dns "2001:1aa1:000a:7dae:000c:18ff:fe03:5c9f, 2001:1aa1:000a:7dae:000c:18ff:fe03:6d9f" \
- ipv6.dns-search "in.useribm.hu" \
- ipv6.gateway "2001:1aa1:000a:7dae:000c:18ff:fe03:6dfe" \
+ ipv6.addresses "$IPV6_ADDRESSES" \
+ ipv6.dns "$IPV6_DNS" \
+ ipv6.dns-search "$IPV6_DNS_SEARCH" \
+ ipv6.gateway "$IPV6_GATEWAY" \
ipv6.method "manual" \
- save yes
+ save "yes"
cat <<EOF >/etc/NetworkManager/conf.d/${CONNECTION_DEVICE}.conf
[device]
nmcli connection show
-hostnamectl hostname pki.in.useribm.hu
+hostnamectl hostname "$FQ_HOSTNAME"
hostnamectl
export PAGER=
+AC_CYCLES=10
+NM_CYCLES=60
+CONNECTION_ID="perimeter"
+FQ_HOSTNAME="pns.pm.useribm.hu"
+IPV4_ADDRESSES="192.168.173.223/24"
+IPV4_DNS="127.0.0.1"
+IPV4_DNS_SEARCH="pm.useribm.hu"
+IPV4_GATEWAY="192.168.173.254"
+IPV4_ROUTES="10.228.0.0/16 192.168.173.1"
+IPV6_ADDRESSES="2001:1aa1:000a:7c0c:000c:18ff:fe03:addf/64"
+IPV6_DNS="::1"
+IPV6_DNS_SEARCH="pm.useribm.hu"
+IPV6_GATEWAY="2001:1aa1:000a:7c0c:000c:18ff:fe03:adfe"
+IPV6_ROUTES="2001:1aa1:000a:7dae::/64 2001:1aa1:000a:7c0c:000c:18ff:fe03:ad01"
sleep 1
CYCLES_WAITED=0
while [ $NM_RC -ne 0 ]
do
- if [ $CYCLES_WAITED -ge 10 ]
+ if [ $CYCLES_WAITED -ge $NM_CYCLES ]
then
exit 1
fi
then
echo -n "Waiting for NetworkManager"
fi
- echo -n .
sleep 1
- CYCLES_WAITED=$(( $CYCLES_WAITED + 1 ))
+ CYCLES_WAITED=$(($CYCLES_WAITED + 1))
+ if [ $(($CYCLES_WAITED % 5)) -eq 0 ]
+ then
+ echo -n "+"
+ else
+ echo -n "."
+ fi
systemctl --quiet is-active NetworkManager.service
NM_RC=$?
done
[ $CYCLES_WAITED -gt 0 ] && echo
-# wait for the two network connections to come up
-CONNECTION_DEVICES_UP=$(nmcli --terse connection show \
- | grep --invert-match ':$' | wc -l)
+# wait for the (only) ethernet connection to activate/come up
+ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
CYCLES_WAITED=0
-while [ $CONNECTION_DEVICES_UP -lt 2 ]
+while [ $ACTIVE_CONNECTIONS -lt 1 ]
do
- if [ $CYCLES_WAITED -ge 10 ]
+ if [ $CYCLES_WAITED -ge $AC_CYCLES ]
then
- echo
- nmcli connection show
+ echo "No active connections" >&2
+ nmcli connection show >&2
exit 1
fi
if [ $CYCLES_WAITED -eq 0 ]
then
- echo -n "Waiting for the network connection"
+ echo -n "Waiting for the ethernet "
+ echo -n "connection to activate/come up"
fi
- echo -n .
sleep 1
- CYCLES_WAITED=$(( $CYCLES_WAITED + 1 ))
- CONNECTION_DEVICES_UP=$(nmcli --terse connection show \
- | grep --invert-match ':$' | wc -l)
+ CYCLES_WAITED=$(($CYCLES_WAITED + 1))
+ if [ $(($CYCLES_WAITED % 5)) -eq 0 ]
+ then
+ echo -n "+"
+ else
+ echo -n "."
+ fi
+ ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
done
[ $CYCLES_WAITED -gt 0 ] && echo
-CONNECTIONS=$(nmcli --terse connection show | wc -l)
-if [ $CONNECTIONS -ne 2 ]
+ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
+if [ $ACTIVE_CONNECTIONS -ne 1 ]
then
- echo "Number of connections: $CONNECTIONS instead of 2" >&2
+ echo -n "Number of active connections: " >&2
+ echo "$ACTIVE_CONNECTIONS instead of 1" >&2
+ nmcli connection show >&2
exit 1
fi
-CONNECTION_DEVICE="eth0"
-CONNECTION_ID="perimeter"
-CONNECTION_LINE=$(nmcli --terse connection show | grep ":${CONNECTION_DEVICE}$")
+INACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep ':$' | wc -l)
+if [ $INACTIVE_CONNECTIONS -gt 0 ]
+then
+ echo "Deleting inactive/unused connection(s)"
+ echo "----------------"
+ nmcli connection show
+ nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep ':$' \
+ | cut -f 2 -d ':' \
+ | while read CONNECTION_UUID
+ do
+ nmcli connection delete uuid "$CONNECTION_UUID"
+ done
+ echo "----------------"
+fi
+
+CONNECTION_LINE=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:')
+CONNECTION_DEVICE=$(echo $CONNECTION_LINE | cut -f 4 -d ':')
CONNECTION_UUID=$(echo $CONNECTION_LINE | cut -f 2 -d ':')
nmcli connection delete uuid "$CONNECTION_UUID"
nmcli connection add \
- connection.autoconnect yes \
- connection.id $CONNECTION_ID \
- connection.interface-name $CONNECTION_DEVICE \
+ connection.autoconnect "yes" \
+ connection.id "$CONNECTION_ID" \
+ connection.interface-name "$CONNECTION_DEVICE" \
connection.type 802-3-ethernet \
- ipv4.addresses "192.168.173.223/24" \
- ipv4.dns "127.0.0.1" \
- ipv4.dns-search "pm.useribm.hu" \
- ipv4.gateway "192.168.173.254" \
+ ipv4.addresses "$IPV4_ADDRESSES" \
+ ipv4.dns "$IPV4_DNS" \
+ ipv4.dns-search "$IPV4_DNS_SEARCH" \
+ ipv4.gateway "$IPV4_GATEWAY" \
ipv4.method "manual" \
- ipv4.routes "10.228.0.0/16 192.168.173.1" \
- ipv6.addresses "2001:1aa1:000a:7c0c:000c:18ff:fe03:addf/64" \
- ipv6.dns "2001:1aa1:000a:7c0c:000c:18ff:fe03:addf" \
- ipv6.dns-search "pm.useribm.hu" \
- ipv6.gateway "2001:1aa1:000a:7c0c:000c:18ff:fe03:adfe" \
+ ipv4.routes "$IPV4_ROUTES" \
+ ipv6.addresses "$IPV6_ADDRESSES" \
+ ipv6.dns "$IPV6_DNS" \
+ ipv6.dns-search "$IPV6_DNS_SEARCH" \
+ ipv6.gateway "$IPV6_GATEWAY" \
ipv6.method "manual" \
- ipv6.routes "2001:1aa1:000a:7dae::/64 2001:1aa1:000a:7c0c:000c:18ff:fe03:ad01" \
- save yes
+ ipv6.routes "$IPV6_ROUTES" \
+ save "yes"
cat <<EOF >/etc/NetworkManager/conf.d/${CONNECTION_DEVICE}.conf
[device]
nmcli connection show
-hostnamectl hostname pns.pm.useribm.hu
+hostnamectl hostname "$FQ_HOSTNAME"
hostnamectl
export PAGER=
+AC_CYCLES=10
+NM_CYCLES=60
+CONNECTION_ID="internal"
+FQ_HOSTNAME="slycpx.in.useribm.hu"
+IPV4_ADDRESSES="10.228.109.44/16"
+IPV4_DNS="10.228.109.159, 10.228.92.159"
+IPV4_DNS_SEARCH="in.useribm.hu"
+IPV4_GATEWAY="10.228.109.254"
+IPV6_ADDRESSES="2001:1aa1:000a:7dae:000c:18ff:fe03:6d2c/64"
+IPV6_DNS="2001:1aa1:000a:7dae:000c:18ff:fe03:6d9f, 2001:1aa1:000a:7dae:000c:18ff:fe03:5c9f"
+IPV6_DNS_SEARCH="in.useribm.hu"
+IPV6_GATEWAY="2001:1aa1:000a:7dae:000c:18ff:fe03:6dfe"
sleep 1
CYCLES_WAITED=0
while [ $NM_RC -ne 0 ]
do
- if [ $CYCLES_WAITED -ge 10 ]
+ if [ $CYCLES_WAITED -ge $NM_CYCLES ]
then
exit 1
fi
then
echo -n "Waiting for NetworkManager"
fi
- echo -n .
sleep 1
- CYCLES_WAITED=$(( $CYCLES_WAITED + 1 ))
+ CYCLES_WAITED=$(($CYCLES_WAITED + 1))
+ if [ $(($CYCLES_WAITED % 5)) -eq 0 ]
+ then
+ echo -n "+"
+ else
+ echo -n "."
+ fi
systemctl --quiet is-active NetworkManager.service
NM_RC=$?
done
[ $CYCLES_WAITED -gt 0 ] && echo
-# wait for the two network connections to come up
-CONNECTION_DEVICES_UP=$(nmcli --terse connection show \
- | grep --invert-match ':$' | wc -l)
+# wait for the (only) ethernet connection to activate/come up
+ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
CYCLES_WAITED=0
-while [ $CONNECTION_DEVICES_UP -lt 2 ]
+while [ $ACTIVE_CONNECTIONS -lt 1 ]
do
- if [ $CYCLES_WAITED -ge 10 ]
+ if [ $CYCLES_WAITED -ge $AC_CYCLES ]
then
- echo
- nmcli connection show
+ echo "No active connections" >&2
+ nmcli connection show >&2
exit 1
fi
if [ $CYCLES_WAITED -eq 0 ]
then
- echo -n "Waiting for the network connection"
+ echo -n "Waiting for the ethernet "
+ echo -n "connection to activate/come up"
fi
- echo -n .
sleep 1
- CYCLES_WAITED=$(( $CYCLES_WAITED + 1 ))
- CONNECTION_DEVICES_UP=$(nmcli --terse connection show \
- | grep --invert-match ':$' | wc -l)
+ CYCLES_WAITED=$(($CYCLES_WAITED + 1))
+ if [ $(($CYCLES_WAITED % 5)) -eq 0 ]
+ then
+ echo -n "+"
+ else
+ echo -n "."
+ fi
+ ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
done
[ $CYCLES_WAITED -gt 0 ] && echo
-CONNECTIONS=$(nmcli --terse connection show | wc -l)
-if [ $CONNECTIONS -ne 2 ]
+ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
+if [ $ACTIVE_CONNECTIONS -ne 1 ]
then
- echo "Number of connections: $CONNECTIONS instead of 2" >&2
+ echo -n "Number of active connections: " >&2
+ echo "$ACTIVE_CONNECTIONS instead of 1" >&2
+ nmcli connection show >&2
exit 1
fi
-CONNECTION_DEVICE="eth0"
-CONNECTION_ID="internal"
-CONNECTION_LINE=$(nmcli --terse connection show | grep ":${CONNECTION_DEVICE}$")
+INACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep ':$' | wc -l)
+if [ $INACTIVE_CONNECTIONS -gt 0 ]
+then
+ echo "Deleting inactive/unused connection(s)"
+ echo "----------------"
+ nmcli connection show
+ nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep ':$' \
+ | cut -f 2 -d ':' \
+ | while read CONNECTION_UUID
+ do
+ nmcli connection delete uuid "$CONNECTION_UUID"
+ done
+ echo "----------------"
+fi
+
+CONNECTION_LINE=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:')
+CONNECTION_DEVICE=$(echo $CONNECTION_LINE | cut -f 4 -d ':')
CONNECTION_UUID=$(echo $CONNECTION_LINE | cut -f 2 -d ':')
nmcli connection delete uuid "$CONNECTION_UUID"
nmcli connection add \
- connection.autoconnect yes \
- connection.id $CONNECTION_ID \
- connection.interface-name $CONNECTION_DEVICE \
+ connection.autoconnect "yes" \
+ connection.id "$CONNECTION_ID" \
+ connection.interface-name "$CONNECTION_DEVICE" \
connection.type 802-3-ethernet \
- ipv4.addresses "10.228.109.44/16" \
- ipv4.dns "10.228.109.159, 10.228.92.159" \
- ipv4.dns-search "in.useribm.hu" \
- ipv4.gateway "10.228.109.254" \
+ ipv4.addresses "$IPV4_ADDRESSES" \
+ ipv4.dns "$IPV4_DNS" \
+ ipv4.dns-search "$IPV4_DNS_SEARCH" \
+ ipv4.gateway "$IPV4_GATEWAY" \
ipv4.method "manual" \
- ipv6.addresses "2001:1aa1:000a:7dae:000c:18ff:fe03:6d2c/64" \
- ipv6.dns "2001:1aa1:000a:7dae:000c:18ff:fe03:6d9f, 2001:1aa1:000a:7dae:000c:18ff:fe03:5c9f" \
- ipv6.dns-search "in.useribm.hu" \
- ipv6.gateway "2001:1aa1:000a:7dae:000c:18ff:fe03:6dfe" \
+ ipv6.addresses "$IPV6_ADDRESSES" \
+ ipv6.dns "$IPV6_DNS" \
+ ipv6.dns-search "$IPV6_DNS_SEARCH" \
+ ipv6.gateway "$IPV6_GATEWAY" \
ipv6.method "manual" \
- save yes
+ save "yes"
cat <<EOF >/etc/NetworkManager/conf.d/${CONNECTION_DEVICE}.conf
[device]
nmcli connection show
-hostnamectl hostname slycpx.in.useribm.hu
+hostnamectl hostname "$FQ_HOSTNAME"
hostnamectl
export PAGER=
+AC_CYCLES=10
+NM_CYCLES=60
+CONNECTION_ID="internal"
+FQ_HOSTNAME="slycrm.in.useribm.hu"
+IPV4_ADDRESSES="10.228.109.53/16"
+IPV4_DNS="10.228.109.159, 10.228.92.159"
+IPV4_DNS_SEARCH="in.useribm.hu"
+IPV4_GATEWAY="10.228.109.254"
+IPV6_ADDRESSES="2001:1aa1:000a:7dae:000c:18ff:fe03:6d35/64"
+IPV6_DNS="2001:1aa1:000a:7dae:000c:18ff:fe03:6d9f, 2001:1aa1:000a:7dae:000c:18ff:fe03:5c9f"
+IPV6_DNS_SEARCH="in.useribm.hu"
+IPV6_GATEWAY="2001:1aa1:000a:7dae:000c:18ff:fe03:6dfe"
sleep 1
CYCLES_WAITED=0
while [ $NM_RC -ne 0 ]
do
- if [ $CYCLES_WAITED -ge 10 ]
+ if [ $CYCLES_WAITED -ge $NM_CYCLES ]
then
exit 1
fi
then
echo -n "Waiting for NetworkManager"
fi
- echo -n .
sleep 1
- CYCLES_WAITED=$(( $CYCLES_WAITED + 1 ))
+ CYCLES_WAITED=$(($CYCLES_WAITED + 1))
+ if [ $(($CYCLES_WAITED % 5)) -eq 0 ]
+ then
+ echo -n "+"
+ else
+ echo -n "."
+ fi
systemctl --quiet is-active NetworkManager.service
NM_RC=$?
done
[ $CYCLES_WAITED -gt 0 ] && echo
-# wait for the two network connections to come up
-CONNECTION_DEVICES_UP=$(nmcli --terse connection show \
- | grep --invert-match ':$' | wc -l)
+# wait for the (only) ethernet connection to activate/come up
+ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
CYCLES_WAITED=0
-while [ $CONNECTION_DEVICES_UP -lt 2 ]
+while [ $ACTIVE_CONNECTIONS -lt 1 ]
do
- if [ $CYCLES_WAITED -ge 10 ]
+ if [ $CYCLES_WAITED -ge $AC_CYCLES ]
then
- echo
- nmcli connection show
+ echo "No active connections" >&2
+ nmcli connection show >&2
exit 1
fi
if [ $CYCLES_WAITED -eq 0 ]
then
- echo -n "Waiting for the network connection"
+ echo -n "Waiting for the ethernet "
+ echo -n "connection to activate/come up"
fi
- echo -n .
sleep 1
- CYCLES_WAITED=$(( $CYCLES_WAITED + 1 ))
- CONNECTION_DEVICES_UP=$(nmcli --terse connection show \
- | grep --invert-match ':$' | wc -l)
+ CYCLES_WAITED=$(($CYCLES_WAITED + 1))
+ if [ $(($CYCLES_WAITED % 5)) -eq 0 ]
+ then
+ echo -n "+"
+ else
+ echo -n "."
+ fi
+ ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
done
[ $CYCLES_WAITED -gt 0 ] && echo
-CONNECTIONS=$(nmcli --terse connection show | wc -l)
-if [ $CONNECTIONS -ne 2 ]
+ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
+if [ $ACTIVE_CONNECTIONS -ne 1 ]
then
- echo "Number of connections: $CONNECTIONS instead of 2" >&2
+ echo -n "Number of active connections: " >&2
+ echo "$ACTIVE_CONNECTIONS instead of 1" >&2
+ nmcli connection show >&2
exit 1
fi
-CONNECTION_DEVICE="eth0"
-CONNECTION_ID="internal"
-CONNECTION_LINE=$(nmcli --terse connection show | grep ":${CONNECTION_DEVICE}$")
+INACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep ':$' | wc -l)
+if [ $INACTIVE_CONNECTIONS -gt 0 ]
+then
+ echo "Deleting inactive/unused connection(s)"
+ echo "----------------"
+ nmcli connection show
+ nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep ':$' \
+ | cut -f 2 -d ':' \
+ | while read CONNECTION_UUID
+ do
+ nmcli connection delete uuid "$CONNECTION_UUID"
+ done
+ echo "----------------"
+fi
+
+CONNECTION_LINE=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:')
+CONNECTION_DEVICE=$(echo $CONNECTION_LINE | cut -f 4 -d ':')
CONNECTION_UUID=$(echo $CONNECTION_LINE | cut -f 2 -d ':')
nmcli connection delete uuid "$CONNECTION_UUID"
nmcli connection add \
- connection.autoconnect yes \
- connection.id $CONNECTION_ID \
- connection.interface-name $CONNECTION_DEVICE \
+ connection.autoconnect "yes" \
+ connection.id "$CONNECTION_ID" \
+ connection.interface-name "$CONNECTION_DEVICE" \
connection.type 802-3-ethernet \
- ipv4.addresses "10.228.109.53/16" \
- ipv4.dns "10.228.109.159, 10.228.92.159" \
- ipv4.dns-search "in.useribm.hu" \
- ipv4.gateway "10.228.109.254" \
+ ipv4.addresses "$IPV4_ADDRESSES" \
+ ipv4.dns "$IPV4_DNS" \
+ ipv4.dns-search "$IPV4_DNS_SEARCH" \
+ ipv4.gateway "$IPV4_GATEWAY" \
ipv4.method "manual" \
- ipv6.addresses "2001:1aa1:000a:7dae:000c:18ff:fe03:6d35/64" \
- ipv6.dns "2001:1aa1:000a:7dae:000c:18ff:fe03:6d9f, 2001:1aa1:000a:7dae:000c:18ff:fe03:5c9f" \
- ipv6.dns-search "in.useribm.hu" \
- ipv6.gateway "2001:1aa1:000a:7dae:000c:18ff:fe03:6dfe" \
+ ipv6.addresses "$IPV6_ADDRESSES" \
+ ipv6.dns "$IPV6_DNS" \
+ ipv6.dns-search "$IPV6_DNS_SEARCH" \
+ ipv6.gateway "$IPV6_GATEWAY" \
ipv6.method "manual" \
- save yes
+ save "yes"
cat <<EOF >/etc/NetworkManager/conf.d/${CONNECTION_DEVICE}.conf
[device]
nmcli connection show
-hostnamectl hostname slycrm.in.useribm.hu
+hostnamectl hostname "$FQ_HOSTNAME"
hostnamectl
export PAGER=
+AC_CYCLES=10
+NM_CYCLES=60
+CONNECTION_ID="internal"
+FQ_HOSTNAME="sns.in.useribm.hu"
+IPV4_ADDRESSES="10.228.109.11/16"
+IPV4_DNS="10.228.109.159, 10.228.92.159"
+IPV4_DNS_SEARCH="in.useribm.hu"
+IPV4_GATEWAY="10.228.109.254"
+IPV6_ADDRESSES="2001:1aa1:000a:7dae:000c:18ff:fe03:6d0b/64"
+IPV6_DNS="2001:1aa1:000a:7dae:000c:18ff:fe03:6d9f, 2001:1aa1:000a:7dae:000c:18ff:fe03:5c9f"
+IPV6_DNS_SEARCH="in.useribm.hu"
+IPV6_GATEWAY="2001:1aa1:000a:7dae:000c:18ff:fe03:6dfe"
sleep 1
CYCLES_WAITED=0
while [ $NM_RC -ne 0 ]
do
- if [ $CYCLES_WAITED -ge 10 ]
+ if [ $CYCLES_WAITED -ge $NM_CYCLES ]
then
exit 1
fi
then
echo -n "Waiting for NetworkManager"
fi
- echo -n .
sleep 1
- CYCLES_WAITED=$(( $CYCLES_WAITED + 1 ))
+ CYCLES_WAITED=$(($CYCLES_WAITED + 1))
+ if [ $(($CYCLES_WAITED % 5)) -eq 0 ]
+ then
+ echo -n "+"
+ else
+ echo -n "."
+ fi
systemctl --quiet is-active NetworkManager.service
NM_RC=$?
done
[ $CYCLES_WAITED -gt 0 ] && echo
-# wait for the two network connections to come up
-CONNECTION_DEVICES_UP=$(nmcli --terse connection show \
- | grep --invert-match ':$' | wc -l)
+# wait for the (only) ethernet connection to activate/come up
+ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
CYCLES_WAITED=0
-while [ $CONNECTION_DEVICES_UP -lt 2 ]
+while [ $ACTIVE_CONNECTIONS -lt 1 ]
do
- if [ $CYCLES_WAITED -ge 10 ]
+ if [ $CYCLES_WAITED -ge $AC_CYCLES ]
then
- echo
- nmcli connection show
+ echo "No active connections" >&2
+ nmcli connection show >&2
exit 1
fi
if [ $CYCLES_WAITED -eq 0 ]
then
- echo -n "Waiting for the network connection"
+ echo -n "Waiting for the ethernet "
+ echo -n "connection to activate/come up"
fi
- echo -n .
sleep 1
- CYCLES_WAITED=$(( $CYCLES_WAITED + 1 ))
- CONNECTION_DEVICES_UP=$(nmcli --terse connection show \
- | grep --invert-match ':$' | wc -l)
+ CYCLES_WAITED=$(($CYCLES_WAITED + 1))
+ if [ $(($CYCLES_WAITED % 5)) -eq 0 ]
+ then
+ echo -n "+"
+ else
+ echo -n "."
+ fi
+ ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
done
[ $CYCLES_WAITED -gt 0 ] && echo
-CONNECTIONS=$(nmcli --terse connection show | wc -l)
-if [ $CONNECTIONS -ne 2 ]
+ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
+if [ $ACTIVE_CONNECTIONS -ne 1 ]
then
- echo "Number of connections: $CONNECTIONS instead of 2" >&2
+ echo -n "Number of active connections: " >&2
+ echo "$ACTIVE_CONNECTIONS instead of 1" >&2
+ nmcli connection show >&2
exit 1
fi
-CONNECTION_DEVICE="eth0"
-CONNECTION_ID="internal"
-CONNECTION_LINE=$(nmcli --terse connection show | grep ":${CONNECTION_DEVICE}$")
+INACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep ':$' | wc -l)
+if [ $INACTIVE_CONNECTIONS -gt 0 ]
+then
+ echo "Deleting inactive/unused connection(s)"
+ echo "----------------"
+ nmcli connection show
+ nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep ':$' \
+ | cut -f 2 -d ':' \
+ | while read CONNECTION_UUID
+ do
+ nmcli connection delete uuid "$CONNECTION_UUID"
+ done
+ echo "----------------"
+fi
+
+CONNECTION_LINE=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:')
+CONNECTION_DEVICE=$(echo $CONNECTION_LINE | cut -f 4 -d ':')
CONNECTION_UUID=$(echo $CONNECTION_LINE | cut -f 2 -d ':')
nmcli connection delete uuid "$CONNECTION_UUID"
nmcli connection add \
- connection.autoconnect yes \
- connection.id $CONNECTION_ID \
- connection.interface-name $CONNECTION_DEVICE \
+ connection.autoconnect "yes" \
+ connection.id "$CONNECTION_ID" \
+ connection.interface-name "$CONNECTION_DEVICE" \
connection.type 802-3-ethernet \
- ipv4.addresses "10.228.109.11/16" \
- ipv4.dns "10.228.109.159, 10.228.92.159" \
- ipv4.dns-search "in.useribm.hu" \
- ipv4.gateway "10.228.109.254" \
+ ipv4.addresses "$IPV4_ADDRESSES" \
+ ipv4.dns "$IPV4_DNS" \
+ ipv4.dns-search "$IPV4_DNS_SEARCH" \
+ ipv4.gateway "$IPV4_GATEWAY" \
ipv4.method "manual" \
- ipv6.addresses "2001:1aa1:000a:7dae:000c:18ff:fe03:6d0b/64" \
- ipv6.dns "2001:1aa1:000a:7dae:000c:18ff:fe03:6d9f, 2001:1aa1:000a:7dae:000c:18ff:fe03:5c9f" \
- ipv6.dns-search "in.useribm.hu" \
- ipv6.gateway "2001:1aa1:000a:7dae:000c:18ff:fe03:6dfe" \
+ ipv6.addresses "$IPV6_ADDRESSES" \
+ ipv6.dns "$IPV6_DNS" \
+ ipv6.dns-search "$IPV6_DNS_SEARCH" \
+ ipv6.gateway "$IPV6_GATEWAY" \
ipv6.method "manual" \
- save yes
+ save "yes"
cat <<EOF >/etc/NetworkManager/conf.d/${CONNECTION_DEVICE}.conf
[device]
nmcli connection show
-hostnamectl hostname sns.in.useribm.hu
+hostnamectl hostname "$FQ_HOSTNAME"
hostnamectl
export PAGER=
+AC_CYCLES=10
+NM_CYCLES=60
+CONNECTION_ID="internal"
+FQ_HOSTNAME="vpn.in.useribm.hu"
+IPV4_ADDRESSES="10.228.109.236/16"
+IPV4_DNS="10.228.109.159, 10.228.92.159"
+IPV4_DNS_SEARCH="in.useribm.hu"
+IPV4_GATEWAY="10.228.109.254"
sleep 1
CYCLES_WAITED=0
while [ $NM_RC -ne 0 ]
do
- if [ $CYCLES_WAITED -ge 10 ]
+ if [ $CYCLES_WAITED -ge $NM_CYCLES ]
then
exit 1
fi
then
echo -n "Waiting for NetworkManager"
fi
- echo -n .
sleep 1
- CYCLES_WAITED=$(( $CYCLES_WAITED + 1 ))
+ CYCLES_WAITED=$(($CYCLES_WAITED + 1))
+ if [ $(($CYCLES_WAITED % 5)) -eq 0 ]
+ then
+ echo -n "+"
+ else
+ echo -n "."
+ fi
systemctl --quiet is-active NetworkManager.service
NM_RC=$?
done
[ $CYCLES_WAITED -gt 0 ] && echo
-# wait for the two network connections to come up
-CONNECTION_DEVICES_UP=$(nmcli --terse connection show \
- | grep --invert-match ':$' | wc -l)
+# wait for the (only) ethernet connection to activate/come up
+ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
CYCLES_WAITED=0
-while [ $CONNECTION_DEVICES_UP -lt 2 ]
+while [ $ACTIVE_CONNECTIONS -lt 1 ]
do
- if [ $CYCLES_WAITED -ge 10 ]
+ if [ $CYCLES_WAITED -ge $AC_CYCLES ]
then
- echo
- nmcli connection show
+ echo "No active connections" >&2
+ nmcli connection show >&2
exit 1
fi
if [ $CYCLES_WAITED -eq 0 ]
then
- echo -n "Waiting for the network connection"
+ echo -n "Waiting for the ethernet "
+ echo -n "connection to activate/come up"
fi
- echo -n .
sleep 1
- CYCLES_WAITED=$(( $CYCLES_WAITED + 1 ))
- CONNECTION_DEVICES_UP=$(nmcli --terse connection show \
- | grep --invert-match ':$' | wc -l)
+ CYCLES_WAITED=$(($CYCLES_WAITED + 1))
+ if [ $(($CYCLES_WAITED % 5)) -eq 0 ]
+ then
+ echo -n "+"
+ else
+ echo -n "."
+ fi
+ ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
done
[ $CYCLES_WAITED -gt 0 ] && echo
-CONNECTIONS=$(nmcli --terse connection show | wc -l)
-if [ $CONNECTIONS -ne 2 ]
+ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
+if [ $ACTIVE_CONNECTIONS -ne 1 ]
then
- echo "Number of connections: $CONNECTIONS instead of 2" >&2
+ echo -n "Number of active connections: " >&2
+ echo "$ACTIVE_CONNECTIONS instead of 1" >&2
+ nmcli connection show >&2
exit 1
fi
-CONNECTION_DEVICE="eth0"
-CONNECTION_ID="internal"
-CONNECTION_LINE=$(nmcli --terse connection show | grep ":${CONNECTION_DEVICE}$")
+INACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep ':$' | wc -l)
+if [ $INACTIVE_CONNECTIONS -gt 0 ]
+then
+ echo "Deleting inactive/unused connection(s)"
+ echo "----------------"
+ nmcli connection show
+ nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep ':$' \
+ | cut -f 2 -d ':' \
+ | while read CONNECTION_UUID
+ do
+ nmcli connection delete uuid "$CONNECTION_UUID"
+ done
+ echo "----------------"
+fi
+
+CONNECTION_LINE=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:')
+CONNECTION_DEVICE=$(echo $CONNECTION_LINE | cut -f 4 -d ':')
CONNECTION_UUID=$(echo $CONNECTION_LINE | cut -f 2 -d ':')
nmcli connection delete uuid "$CONNECTION_UUID"
nmcli connection add \
- connection.autoconnect yes \
- connection.id $CONNECTION_ID \
- connection.interface-name $CONNECTION_DEVICE \
+ connection.autoconnect "yes" \
+ connection.id "$CONNECTION_ID" \
+ connection.interface-name "$CONNECTION_DEVICE" \
connection.type 802-3-ethernet \
- ipv4.addresses "10.228.109.236/16" \
- ipv4.dns "10.228.109.159, 10.228.92.159" \
- ipv4.dns-search "in.useribm.hu" \
- ipv4.gateway "10.228.109.254" \
+ ipv4.addresses "$IPV4_ADDRESSES" \
+ ipv4.dns "$IPV4_DNS" \
+ ipv4.dns-search "$IPV4_DNS_SEARCH" \
+ ipv4.gateway "$IPV4_GATEWAY" \
ipv4.method "manual" \
ipv6.method "disabled" \
- save yes
+ save "yes"
cat <<EOF >/etc/NetworkManager/conf.d/${CONNECTION_DEVICE}.conf
[device]
nmcli connection show
-hostnamectl hostname vpn.in.useribm.hu
+hostnamectl hostname "$FQ_HOSTNAME"
hostnamectl
export PAGER=
+AC_CYCLES=10
+NM_CYCLES=60
+CONNECTION_ID="internal"
+FQ_HOSTNAME="wiki.in.useribm.hu"
+IPV4_ADDRESSES="10.228.109.211/16"
+IPV4_DNS="10.228.109.159, 10.228.92.159"
+IPV4_DNS_SEARCH="in.useribm.hu"
+IPV4_GATEWAY="10.228.109.254"
+IPV6_ADDRESSES="2001:1aa1:000a:7dae:000c:18ff:fe03:6dd3/64"
+IPV6_DNS="2001:1aa1:000a:7dae:000c:18ff:fe03:6d9f, 2001:1aa1:000a:7dae:000c:18ff:fe03:5c9f"
+IPV6_DNS_SEARCH="in.useribm.hu"
+IPV6_GATEWAY="2001:1aa1:000a:7dae:000c:18ff:fe03:6dfe"
sleep 1
CYCLES_WAITED=0
while [ $NM_RC -ne 0 ]
do
- if [ $CYCLES_WAITED -ge 10 ]
+ if [ $CYCLES_WAITED -ge $NM_CYCLES ]
then
exit 1
fi
then
echo -n "Waiting for NetworkManager"
fi
- echo -n .
sleep 1
- CYCLES_WAITED=$(( $CYCLES_WAITED + 1 ))
+ CYCLES_WAITED=$(($CYCLES_WAITED + 1))
+ if [ $(($CYCLES_WAITED % 5)) -eq 0 ]
+ then
+ echo -n "+"
+ else
+ echo -n "."
+ fi
systemctl --quiet is-active NetworkManager.service
NM_RC=$?
done
[ $CYCLES_WAITED -gt 0 ] && echo
-# wait for the two network connections to come up
-CONNECTION_DEVICES_UP=$(nmcli --terse connection show \
- | grep --invert-match ':$' | wc -l)
+# wait for the (only) ethernet connection to activate/come up
+ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
CYCLES_WAITED=0
-while [ $CONNECTION_DEVICES_UP -lt 2 ]
+while [ $ACTIVE_CONNECTIONS -lt 1 ]
do
- if [ $CYCLES_WAITED -ge 10 ]
+ if [ $CYCLES_WAITED -ge $AC_CYCLES ]
then
- echo
- nmcli connection show
+ echo "No active connections" >&2
+ nmcli connection show >&2
exit 1
fi
if [ $CYCLES_WAITED -eq 0 ]
then
- echo -n "Waiting for the network connection"
+ echo -n "Waiting for the ethernet "
+ echo -n "connection to activate/come up"
fi
- echo -n .
sleep 1
- CYCLES_WAITED=$(( $CYCLES_WAITED + 1 ))
- CONNECTION_DEVICES_UP=$(nmcli --terse connection show \
- | grep --invert-match ':$' | wc -l)
+ CYCLES_WAITED=$(($CYCLES_WAITED + 1))
+ if [ $(($CYCLES_WAITED % 5)) -eq 0 ]
+ then
+ echo -n "+"
+ else
+ echo -n "."
+ fi
+ ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
done
[ $CYCLES_WAITED -gt 0 ] && echo
-CONNECTIONS=$(nmcli --terse connection show | wc -l)
-if [ $CONNECTIONS -ne 2 ]
+ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
+if [ $ACTIVE_CONNECTIONS -ne 1 ]
then
- echo "Number of connections: $CONNECTIONS instead of 2" >&2
+ echo -n "Number of active connections: " >&2
+ echo "$ACTIVE_CONNECTIONS instead of 1" >&2
+ nmcli connection show >&2
exit 1
fi
-CONNECTION_DEVICE="eth0"
-CONNECTION_ID="internal"
-CONNECTION_LINE=$(nmcli --terse connection show | grep ":${CONNECTION_DEVICE}$")
+INACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep ':$' | wc -l)
+if [ $INACTIVE_CONNECTIONS -gt 0 ]
+then
+ echo "Deleting inactive/unused connection(s)"
+ echo "----------------"
+ nmcli connection show
+ nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep ':$' \
+ | cut -f 2 -d ':' \
+ | while read CONNECTION_UUID
+ do
+ nmcli connection delete uuid "$CONNECTION_UUID"
+ done
+ echo "----------------"
+fi
+
+CONNECTION_LINE=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:')
+CONNECTION_DEVICE=$(echo $CONNECTION_LINE | cut -f 4 -d ':')
CONNECTION_UUID=$(echo $CONNECTION_LINE | cut -f 2 -d ':')
nmcli connection delete uuid "$CONNECTION_UUID"
nmcli connection add \
- connection.autoconnect yes \
- connection.id $CONNECTION_ID \
- connection.interface-name $CONNECTION_DEVICE \
+ connection.autoconnect "yes" \
+ connection.id "$CONNECTION_ID" \
+ connection.interface-name "$CONNECTION_DEVICE" \
connection.type 802-3-ethernet \
- ipv4.addresses "10.228.109.211/16" \
- ipv4.dns "10.228.109.159, 10.228.92.159" \
- ipv4.dns-search "in.useribm.hu" \
- ipv4.gateway "10.228.109.254" \
+ ipv4.addresses "$IPV4_ADDRESSES" \
+ ipv4.dns "$IPV4_DNS" \
+ ipv4.dns-search "$IPV4_DNS_SEARCH" \
+ ipv4.gateway "$IPV4_GATEWAY" \
ipv4.method "manual" \
- ipv6.addresses "2001:1aa1:000a:7dae:000c:18ff:fe03:6dd3/64" \
- ipv6.dns "2001:1aa1:000a:7dae:000c:18ff:fe03:6d9f, 2001:1aa1:000a:7dae:000c:18ff:fe03:5c9f" \
- ipv6.dns-search "in.useribm.hu" \
- ipv6.gateway "2001:1aa1:000a:7dae:000c:18ff:fe03:6dfe" \
+ ipv6.addresses "$IPV6_ADDRESSES" \
+ ipv6.dns "$IPV6_DNS" \
+ ipv6.dns-search "$IPV6_DNS_SEARCH" \
+ ipv6.gateway "$IPV6_GATEWAY" \
ipv6.method "manual" \
- save yes
+ save "yes"
cat <<EOF >/etc/NetworkManager/conf.d/${CONNECTION_DEVICE}.conf
[device]
nmcli connection show
-hostnamectl hostname wiki.in.useribm.hu
+hostnamectl hostname "$FQ_HOSTNAME"
hostnamectl
export PAGER=
+AC_CYCLES=10
+NM_CYCLES=60
+CONNECTION_ID="perimeter"
+FQ_HOSTNAME="ws.pm.useribm.hu"
+IPV4_ADDRESSES="192.168.173.249/24"
+IPV4_DNS="192.168.173.223"
+IPV4_DNS_SEARCH="pm.useribm.hu"
+IPV4_GATEWAY="192.168.173.254"
+IPV4_ROUTES="10.228.0.0/16 192.168.173.1, 192.168.42.0/24 192.168.173.1"
+IPV6_ADDRESSES="2001:1aa1:000a:7c0c:000c:18ff:fe03:adf9/64"
+IPV6_DNS="2001:1aa1:000a:7c0c:000c:18ff:fe03:addf"
+IPV6_DNS_SEARCH="pm.useribm.hu"
+IPV6_GATEWAY="2001:1aa1:000a:7c0c:000c:18ff:fe03:adfe"
+IPV6_ROUTES="2001:1aa1:000a:7dae::/64 2001:1aa1:000a:7c0c:000c:18ff:fe03:ad01"
sleep 1
CYCLES_WAITED=0
while [ $NM_RC -ne 0 ]
do
- if [ $CYCLES_WAITED -ge 10 ]
+ if [ $CYCLES_WAITED -ge $NM_CYCLES ]
then
exit 1
fi
then
echo -n "Waiting for NetworkManager"
fi
- echo -n .
sleep 1
- CYCLES_WAITED=$(( $CYCLES_WAITED + 1 ))
+ CYCLES_WAITED=$(($CYCLES_WAITED + 1))
+ if [ $(($CYCLES_WAITED % 5)) -eq 0 ]
+ then
+ echo -n "+"
+ else
+ echo -n "."
+ fi
systemctl --quiet is-active NetworkManager.service
NM_RC=$?
done
[ $CYCLES_WAITED -gt 0 ] && echo
-# wait for the two network connections to come up
-CONNECTION_DEVICES_UP=$(nmcli --terse connection show \
- | grep --invert-match ':$' | wc -l)
+# wait for the (only) ethernet connection to activate/come up
+ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
CYCLES_WAITED=0
-while [ $CONNECTION_DEVICES_UP -lt 2 ]
+while [ $ACTIVE_CONNECTIONS -lt 1 ]
do
- if [ $CYCLES_WAITED -ge 10 ]
+ if [ $CYCLES_WAITED -ge $AC_CYCLES ]
then
- echo
- nmcli connection show
+ echo "No active connections" >&2
+ nmcli connection show >&2
exit 1
fi
if [ $CYCLES_WAITED -eq 0 ]
then
- echo -n "Waiting for the network connection"
+ echo -n "Waiting for the ethernet "
+ echo -n "connection to activate/come up"
fi
- echo -n .
sleep 1
- CYCLES_WAITED=$(( $CYCLES_WAITED + 1 ))
- CONNECTION_DEVICES_UP=$(nmcli --terse connection show \
- | grep --invert-match ':$' | wc -l)
+ CYCLES_WAITED=$(($CYCLES_WAITED + 1))
+ if [ $(($CYCLES_WAITED % 5)) -eq 0 ]
+ then
+ echo -n "+"
+ else
+ echo -n "."
+ fi
+ ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
done
[ $CYCLES_WAITED -gt 0 ] && echo
-CONNECTIONS=$(nmcli --terse connection show | wc -l)
-if [ $CONNECTIONS -ne 2 ]
+ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
+if [ $ACTIVE_CONNECTIONS -ne 1 ]
then
- echo "Number of connections: $CONNECTIONS instead of 2" >&2
+ echo -n "Number of active connections: " >&2
+ echo "$ACTIVE_CONNECTIONS instead of 1" >&2
+ nmcli connection show >&2
exit 1
fi
-CONNECTION_DEVICE="eth0"
-CONNECTION_ID="perimeter"
-CONNECTION_LINE=$(nmcli --terse connection show | grep ":${CONNECTION_DEVICE}$")
+INACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep ':$' | wc -l)
+if [ $INACTIVE_CONNECTIONS -gt 0 ]
+then
+ echo "Deleting inactive/unused connection(s)"
+ echo "----------------"
+ nmcli connection show
+ nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep ':$' \
+ | cut -f 2 -d ':' \
+ | while read CONNECTION_UUID
+ do
+ nmcli connection delete uuid "$CONNECTION_UUID"
+ done
+ echo "----------------"
+fi
+
+CONNECTION_LINE=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:')
+CONNECTION_DEVICE=$(echo $CONNECTION_LINE | cut -f 4 -d ':')
CONNECTION_UUID=$(echo $CONNECTION_LINE | cut -f 2 -d ':')
nmcli connection delete uuid "$CONNECTION_UUID"
nmcli connection add \
- connection.autoconnect yes \
- connection.id $CONNECTION_ID \
- connection.interface-name $CONNECTION_DEVICE \
+ connection.autoconnect "yes" \
+ connection.id "$CONNECTION_ID" \
+ connection.interface-name "$CONNECTION_DEVICE" \
connection.type 802-3-ethernet \
- ipv4.addresses "192.168.173.249/24" \
- ipv4.dns "192.168.173.223" \
- ipv4.dns-search "pm.useribm.hu" \
- ipv4.gateway "192.168.173.254" \
+ ipv4.addresses "$IPV4_ADDRESSES" \
+ ipv4.dns "$IPV4_DNS" \
+ ipv4.dns-search "$IPV4_DNS_SEARCH" \
+ ipv4.gateway "$IPV4_GATEWAY" \
ipv4.method "manual" \
- ipv4.routes "10.228.0.0/16 192.168.173.1, 192.168.42.0/24 192.168.173.1" \
- ipv6.addresses "2001:1aa1:000a:7c0c:000c:18ff:fe03:adf9/64" \
- ipv6.dns "2001:1aa1:000a:7c0c:000c:18ff:fe03:addf" \
- ipv6.dns-search "pm.useribm.hu" \
- ipv6.gateway "2001:1aa1:000a:7c0c:000c:18ff:fe03:adfe" \
+ ipv4.routes "$IPV4_ROUTES" \
+ ipv6.addresses "$IPV6_ADDRESSES" \
+ ipv6.dns "$IPV6_DNS" \
+ ipv6.dns-search "$IPV6_DNS_SEARCH" \
+ ipv6.gateway "$IPV6_GATEWAY" \
ipv6.method "manual" \
- ipv6.routes "2001:1aa1:000a:7dae::/64 2001:1aa1:000a:7c0c:000c:18ff:fe03:ad01" \
- save yes
+ ipv6.routes "$IPV6_ROUTES" \
+ save "yes"
cat <<EOF >/etc/NetworkManager/conf.d/${CONNECTION_DEVICE}.conf
[device]
nmcli connection show
-hostnamectl hostname ws.pm.useribm.hu
+hostnamectl hostname "$FQ_HOSTNAME"
hostnamectl
export PAGER=
+AC_CYCLES=10
+NM_CYCLES=60
+CONNECTION_ID="perimeter"
+FQ_HOSTNAME="xfr.pm.useribm.hu"
+IPV4_ADDRESSES="192.168.173.174/24"
+IPV4_DNS="192.168.173.223"
+IPV4_DNS_SEARCH="pm.useribm.hu"
+IPV4_GATEWAY="192.168.173.254"
+IPV4_ROUTES="10.228.0.0/16 192.168.173.1"
+IPV6_ADDRESSES="2001:1aa1:000a:7c0c:000c:18ff:fe03:adae/64"
+IPV6_DNS="2001:1aa1:000a:7c0c:000c:18ff:fe03:addf"
+IPV6_DNS_SEARCH="pm.useribm.hu"
+IPV6_GATEWAY="2001:1aa1:000a:7c0c:000c:18ff:fe03:adfe"
sleep 1
CYCLES_WAITED=0
while [ $NM_RC -ne 0 ]
do
- if [ $CYCLES_WAITED -ge 10 ]
+ if [ $CYCLES_WAITED -ge $NM_CYCLES ]
then
exit 1
fi
then
echo -n "Waiting for NetworkManager"
fi
- echo -n .
sleep 1
- CYCLES_WAITED=$(( $CYCLES_WAITED + 1 ))
+ CYCLES_WAITED=$(($CYCLES_WAITED + 1))
+ if [ $(($CYCLES_WAITED % 5)) -eq 0 ]
+ then
+ echo -n "+"
+ else
+ echo -n "."
+ fi
systemctl --quiet is-active NetworkManager.service
NM_RC=$?
done
[ $CYCLES_WAITED -gt 0 ] && echo
-# wait for the two network connections to come up
-CONNECTION_DEVICES_UP=$(nmcli --terse connection show \
- | grep --invert-match ':$' | wc -l)
+# wait for the (only) ethernet connection to activate/come up
+ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
CYCLES_WAITED=0
-while [ $CONNECTION_DEVICES_UP -lt 2 ]
+while [ $ACTIVE_CONNECTIONS -lt 1 ]
do
- if [ $CYCLES_WAITED -ge 10 ]
+ if [ $CYCLES_WAITED -ge $AC_CYCLES ]
then
- echo
- nmcli connection show
+ echo "No active connections" >&2
+ nmcli connection show >&2
exit 1
fi
if [ $CYCLES_WAITED -eq 0 ]
then
- echo -n "Waiting for the network connection"
+ echo -n "Waiting for the ethernet "
+ echo -n "connection to activate/come up"
fi
- echo -n .
sleep 1
- CYCLES_WAITED=$(( $CYCLES_WAITED + 1 ))
- CONNECTION_DEVICES_UP=$(nmcli --terse connection show \
- | grep --invert-match ':$' | wc -l)
+ CYCLES_WAITED=$(($CYCLES_WAITED + 1))
+ if [ $(($CYCLES_WAITED % 5)) -eq 0 ]
+ then
+ echo -n "+"
+ else
+ echo -n "."
+ fi
+ ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
done
[ $CYCLES_WAITED -gt 0 ] && echo
-CONNECTIONS=$(nmcli --terse connection show | wc -l)
-if [ $CONNECTIONS -ne 2 ]
+ACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep --invert-match ':$' | wc -l)
+if [ $ACTIVE_CONNECTIONS -ne 1 ]
then
- echo "Number of connections: $CONNECTIONS instead of 2" >&2
+ echo -n "Number of active connections: " >&2
+ echo "$ACTIVE_CONNECTIONS instead of 1" >&2
+ nmcli connection show >&2
exit 1
fi
-CONNECTION_DEVICE="eth0"
-CONNECTION_ID="perimeter"
-CONNECTION_LINE=$(nmcli --terse connection show | grep ":${CONNECTION_DEVICE}$")
+INACTIVE_CONNECTIONS=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep ':$' | wc -l)
+if [ $INACTIVE_CONNECTIONS -gt 0 ]
+then
+ echo "Deleting inactive/unused connection(s)"
+ echo "----------------"
+ nmcli connection show
+ nmcli --terse connection show \
+ | grep ':802-3-ethernet:' \
+ | grep ':$' \
+ | cut -f 2 -d ':' \
+ | while read CONNECTION_UUID
+ do
+ nmcli connection delete uuid "$CONNECTION_UUID"
+ done
+ echo "----------------"
+fi
+
+CONNECTION_LINE=$(nmcli --terse connection show \
+ | grep ':802-3-ethernet:')
+CONNECTION_DEVICE=$(echo $CONNECTION_LINE | cut -f 4 -d ':')
CONNECTION_UUID=$(echo $CONNECTION_LINE | cut -f 2 -d ':')
nmcli connection delete uuid "$CONNECTION_UUID"
nmcli connection add \
- connection.autoconnect yes \
- connection.id $CONNECTION_ID \
- connection.interface-name $CONNECTION_DEVICE \
+ connection.autoconnect "yes" \
+ connection.id "$CONNECTION_ID" \
+ connection.interface-name "$CONNECTION_DEVICE" \
connection.type 802-3-ethernet \
- ipv4.addresses "192.168.173.174/24" \
- ipv4.dns "192.168.173.223" \
- ipv4.dns-search "pm.useribm.hu" \
- ipv4.gateway "192.168.173.254" \
+ ipv4.addresses "$IPV4_ADDRESSES" \
+ ipv4.dns "$IPV4_DNS" \
+ ipv4.dns-search "$IPV4_DNS_SEARCH" \
+ ipv4.gateway "$IPV4_GATEWAY" \
ipv4.method "manual" \
- ipv6.addresses "2001:1aa1:000a:7c0c:000c:18ff:fe03:adae/64" \
- ipv6.dns "2001:1aa1:000a:7c0c:000c:18ff:fe03:addf" \
- ipv6.dns-search "pm.useribm.hu" \
- ipv6.gateway "2001:1aa1:000a:7c0c:000c:18ff:fe03:adfe" \
+ ipv6.addresses "$IPV6_ADDRESSES" \
+ ipv6.dns "$IPV6_DNS" \
+ ipv6.dns-search "$IPV6_DNS_SEARCH" \
+ ipv6.gateway "$IPV6_GATEWAY" \
ipv6.method "manual" \
- ipv6.routes "2001:1aa1:000a:7dae::/64 2001:1aa1:000a:7c0c:000c:18ff:fe03:ad01" \
- save yes
+ save "yes"
cat <<EOF >/etc/NetworkManager/conf.d/${CONNECTION_DEVICE}.conf
[device]
nmcli connection show
-hostnamectl hostname xfr.pm.useribm.hu
+hostnamectl hostname "$FQ_HOSTNAME"
hostnamectl