|
|
@ -3,7 +3,11 @@ |
|
|
|
MIAOU_BASEDIR=$(readlink -f "$(dirname "$0")/..") |
|
|
|
# shellcheck source=/dev/null |
|
|
|
. "$MIAOU_BASEDIR/lib/functions.sh" |
|
|
|
readonly MIAOU_BASEDIR |
|
|
|
|
|
|
|
FDN_DOMAINNAME=fdn.fr |
|
|
|
FDN_RESOLVER=80.67.169.12 |
|
|
|
|
|
|
|
readonly MIAOU_BASEDIR FDN_DOMAINNAME FDN_RESOLVER |
|
|
|
|
|
|
|
miaou_init |
|
|
|
|
|
|
@ -367,6 +371,16 @@ function miaou_resolver() { |
|
|
|
bridge=$(ip addr show lxdbr0 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1) |
|
|
|
gateway=$(ip route | grep default | cut -d' ' -f3) |
|
|
|
|
|
|
|
echo -n "test gateway <$gateway> as DNS resolver..." |
|
|
|
if dig +short "@$gateway" "$FDN_DOMAINNAME" >/dev/null; then |
|
|
|
resolver="$gateway" |
|
|
|
PREFIX="" echoinfo DONE |
|
|
|
else |
|
|
|
PREFIX="" echowarn FAILED |
|
|
|
echo "resolver replaced by FDN_RESOLVER=<$FDN_RESOLVER>" |
|
|
|
resolver="$FDN_RESOLVER" |
|
|
|
fi |
|
|
|
|
|
|
|
if command -v nmcli &>/dev/null; then |
|
|
|
if [[ ! -f /etc/NetworkManager/dispatcher.d/50-miaou-resolver ]]; then |
|
|
|
echo -n "use NetworkManager dispatcher to deal with LXD bridge automatically..." |
|
|
@ -388,11 +402,11 @@ function miaou_resolver() { |
|
|
|
fi |
|
|
|
|
|
|
|
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>, resolver=<$resolver> ..." |
|
|
|
sudo tee /etc/resolv.conf &>/dev/null <<EOF |
|
|
|
# generated by miaou |
|
|
|
nameserver $bridge # LXD bridge |
|
|
|
nameserver $gateway # gateway |
|
|
|
nameserver $resolver # resolver |
|
|
|
EOF |
|
|
|
PREFIX="" echoinfo DONE |
|
|
|
else |
|
|
|