Skip to content

Commit fe13167

Browse files
committedJul 3, 2024
Fix issues related to the nameservers
The host nameserver in the /etc/resolv.conf needs to be first, to avoid potential future issues.
1 parent eac7dcf commit fe13167

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed
 

‎pkg/bundle/setup/clustersetup.sh

+5-3
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ setup_dsnmasq(){
102102
hostName=$(hostname)
103103
pr_info "writing Dnsmasq conf on $DNSMASQ_CONF"
104104
cat << EOF > /etc/dnsmasq.d/crc-dnsmasq.conf
105-
listen-address=$IIP
105+
listen-address=0.0.0.0
106106
expand-hosts
107107
log-queries
108108
local=/crc.testing/
@@ -116,11 +116,13 @@ EOF
116116
stop_if_failed $? "failed to write Dnsmasq configuration in $DNSMASQ_CONF"
117117
pr_info "adding Dnsmasq as primary DNS"
118118
sleep 2
119-
nmcli connection modify Wired\ connection\ 1 ipv4.dns "$IIP,169.254.169.254"
119+
CURRENT_NAMESERVERS=$(grep "nameserver" /etc/resolv.conf | awk '{print $2}' | xargs | sed 's/ /,/g')
120+
nmcli connection modify "Wired connection 1" ipv4.dns "$IIP,$CURRENT_NAMESERVERS"
121+
nmcli connection up "Wired connection 1"
120122
stop_if_failed $? "failed to modify NetworkManager settings"
121123
pr_info "restarting NetworkManager"
122124
sleep 2
123-
systemctl restart NetworkManager
125+
systemctl restart NetworkManager
124126
stop_if_failed $? "failed to restart NetworkManager"
125127
pr_info "enabling & starting Dnsmasq service"
126128
systemctl enable dnsmasq.service

0 commit comments

Comments
 (0)