From d2889a45d9545da700e4f81604ebe31d8e900bc0 Mon Sep 17 00:00:00 2001 From: userinnowhere Date: Sat, 2 Dec 2023 23:09:13 +0330 Subject: [PATCH 1/2] Ensure resolvectl works even without netplan --- common/install.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/common/install.sh b/common/install.sh index 0c3b63255..33cca3974 100755 --- a/common/install.sh +++ b/common/install.sh @@ -25,6 +25,13 @@ fi sudo systemctl unmask --now systemd-resolved.service systemctl enable --now systemd-resolved >/dev/null 2>&1 python3 change_dns.py 8.8.8.8 1.1.1.1 +resolvectl dns `ip -br a | grep -E "enp|ens|eno|eth" | awk '{print $1}'` 8.8.8.8 1.1.1.1 +touch /var/spool/cron/crontabs/root + +if [ $(grep -c "resolvectl" /var/spool/cron/crontabs/root) -eq 0 ] +then + echo "0 * * * * resolvectl dns `ip -br a | grep -E "enp|ens|eno|eth" | awk '{print $1}'` 8.8.8.8 1.1.1.1 >/dev/null 2>&1" >> /var/spool/cron/crontabs/root +fi ln -sf $(pwd)/sysctl.conf /etc/sysctl.d/ss-opt.conf From 4aa059f4fb1010f2c8a61e5ae78a4829ac17f9ca Mon Sep 17 00:00:00 2001 From: userinnowhere Date: Sat, 2 Dec 2023 23:49:55 +0330 Subject: [PATCH 2/2] Apply resolvectl command also after reboot --- common/install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/common/install.sh b/common/install.sh index 33cca3974..9c6a66dbd 100755 --- a/common/install.sh +++ b/common/install.sh @@ -31,6 +31,7 @@ touch /var/spool/cron/crontabs/root if [ $(grep -c "resolvectl" /var/spool/cron/crontabs/root) -eq 0 ] then echo "0 * * * * resolvectl dns `ip -br a | grep -E "enp|ens|eno|eth" | awk '{print $1}'` 8.8.8.8 1.1.1.1 >/dev/null 2>&1" >> /var/spool/cron/crontabs/root + echo "@reboot resolvectl dns `ip -br a | grep -E "enp|ens|eno|eth" | awk '{print $1}'` 8.8.8.8 1.1.1.1 >/dev/null 2>&1" >> /var/spool/cron/crontabs/root fi ln -sf $(pwd)/sysctl.conf /etc/sysctl.d/ss-opt.conf