From fe13167d8de29a1c1bccb4a02f51b220191178e0 Mon Sep 17 00:00:00 2001 From: Daniel Pawlik Date: Wed, 3 Jul 2024 10:26:37 +0200 Subject: [PATCH] Fix issues related to the nameservers The host nameserver in the /etc/resolv.conf needs to be first, to avoid potential future issues. --- pkg/bundle/setup/clustersetup.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/bundle/setup/clustersetup.sh b/pkg/bundle/setup/clustersetup.sh index 0df803f0..ff16d679 100644 --- a/pkg/bundle/setup/clustersetup.sh +++ b/pkg/bundle/setup/clustersetup.sh @@ -102,7 +102,7 @@ setup_dsnmasq(){ hostName=$(hostname) pr_info "writing Dnsmasq conf on $DNSMASQ_CONF" cat << EOF > /etc/dnsmasq.d/crc-dnsmasq.conf -listen-address=$IIP +listen-address=0.0.0.0 expand-hosts log-queries local=/crc.testing/ @@ -116,11 +116,13 @@ EOF stop_if_failed $? "failed to write Dnsmasq configuration in $DNSMASQ_CONF" pr_info "adding Dnsmasq as primary DNS" sleep 2 - nmcli connection modify Wired\ connection\ 1 ipv4.dns "$IIP,169.254.169.254" + CURRENT_NAMESERVERS=$(grep "nameserver" /etc/resolv.conf | awk '{print $2}' | xargs | sed 's/ /,/g') + nmcli connection modify "Wired connection 1" ipv4.dns "$IIP,$CURRENT_NAMESERVERS" + nmcli connection up "Wired connection 1" stop_if_failed $? "failed to modify NetworkManager settings" pr_info "restarting NetworkManager" sleep 2 - systemctl restart NetworkManager + systemctl restart NetworkManager stop_if_failed $? "failed to restart NetworkManager" pr_info "enabling & starting Dnsmasq service" systemctl enable dnsmasq.service