Browse Source

disable systemd-resolved for server

main
pvincent 9 months ago
parent
commit
abf8cac050
  1. 8
      lib/install.sh
  2. 4
      scripts/miaou

8
lib/install.sh

@ -354,6 +354,14 @@ function miaou_resolver() {
echo "miaou-resolver in NetworkManager dispatcher already initialized!" echo "miaou-resolver in NetworkManager dispatcher already initialized!"
fi fi
else else
if sudo systemctl is-enabled systemd-resolved.service --quiet; then
echo -n "disabling systemd-resolved..."
sudo systemctl stop systemd-resolved.service --quiet
sudo systemctl disable systemd-resolved.service --quiet
sudo rm /etc/resolv.conf
PREFIX="" echoinfo DONE
fi
if ! grep -q "nameserver $bridge" /etc/resolv.conf; then if ! grep -q "nameserver $bridge" /etc/resolv.conf; then
echo -n "customize resolv.conf from scratch with bridge=<$bridge>, gatewary=<$gateway> ..." echo -n "customize resolv.conf from scratch with bridge=<$bridge>, gatewary=<$gateway> ..."
sudo tee /etc/resolv.conf &>/dev/null <<EOF sudo tee /etc/resolv.conf &>/dev/null <<EOF

4
scripts/miaou

@ -372,8 +372,8 @@ function check_resolv_conf() {
bridge_gw=$(lxc network get lxdbr0 ipv4.address | cut -d'/' -f1) bridge_gw=$(lxc network get lxdbr0 ipv4.address | cut -d'/' -f1)
PREFIX="resolver:check" echo "container bridge is <$bridge_gw>" PREFIX="resolver:check" echo "container bridge is <$bridge_gw>"
resolver=$(grep nameserver /etc/resolv.conf | tail -n1 | cut -d ' ' -f2)
PREFIX="resolver:check" echo "container resolver is <$resolver>"
resolver=$(grep nameserver /etc/resolv.conf | head -n1 | cut -d ' ' -f2)
PREFIX="resolver:check" echo "first resolver is <$resolver>"
[[ "$bridge_gw" != "$resolver" ]] && return 21 [[ "$bridge_gw" != "$resolver" ]] && return 21
return 0 return 0

Loading…
Cancel
Save