Skip to content

Commit 3211d9e

Browse files
committed
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 3211d9e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

pkg/bundle/setup/clustersetup.sh

Lines changed: 6 additions & 3 deletions
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/
@@ -111,16 +111,19 @@ address=/apps-crc.testing/$IIP
111111
address=/api.crc.testing/$IIP
112112
address=/api-int.crc.testing/$IIP
113113
address=/$hostName.crc.testing/192.168.126.11
114+
address=/$EIP.nip.io/$IIP
114115
EOF
115116

116117
stop_if_failed $? "failed to write Dnsmasq configuration in $DNSMASQ_CONF"
117118
pr_info "adding Dnsmasq as primary DNS"
118119
sleep 2
119-
nmcli connection modify Wired\ connection\ 1 ipv4.dns "$IIP,169.254.169.254"
120+
CURRENT_NAMESERVERS=$(grep "nameserver" /etc/resolv.conf | awk '{print $2}' | xargs | sed 's/ /,/g')
121+
nmcli connection modify "Wired connection 1" ipv4.dns "$IIP,$CURRENT_NAMESERVERS"
122+
nmcli connection up "Wired connection 1"
120123
stop_if_failed $? "failed to modify NetworkManager settings"
121124
pr_info "restarting NetworkManager"
122125
sleep 2
123-
systemctl restart NetworkManager
126+
systemctl restart NetworkManager
124127
stop_if_failed $? "failed to restart NetworkManager"
125128
pr_info "enabling & starting Dnsmasq service"
126129
systemctl enable dnsmasq.service

0 commit comments

Comments
 (0)