From df08eabeed84bebc453041abd3041f73deca63c1 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 28 Nov 2023 12:26:14 +0100 Subject: [run-virt] Make sure we don't pass localhost as DNS server to VMs --- core/modules/run-virt/data/opt/openslx/scripts/runvirt-start_dhcpd | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/modules/run-virt/data/opt/openslx/scripts/runvirt-start_dhcpd b/core/modules/run-virt/data/opt/openslx/scripts/runvirt-start_dhcpd index bed6ac88..e920855a 100755 --- a/core/modules/run-virt/data/opt/openslx/scripts/runvirt-start_dhcpd +++ b/core/modules/run-virt/data/opt/openslx/scripts/runvirt-start_dhcpd @@ -26,7 +26,10 @@ getresolvconf() { [ -z "${SLX_NET_SEARCH}" ] && SLX_NET_SEARCH="$( getresolvconf search )" # Do not use helper here and check (loosely) for IPv4 declare -a dns -dns=( $( awk '$1 == "nameserver" && $2 ~ "\\..*\\..*\\." {print $2}' /etc/resolv.conf ) ) +# sed any reference to localhost by our nat1 IP, in case we run something like +# dnsmasq locally later on +dns=( $( awk '$1 == "nameserver" && $2 ~ "\\..*\\..*\\." {print $2}' /etc/resolv.conf \ + | sed 's/^127.*$/192.168.101.1/' ) ) [ -z "${dns}" ] && dns=( $SLX_DNS ) # Fallbacks [ -z "${dns}" ] && dns=( "8.8.8.8" "8.8.4.4" ) -- cgit v1.2.3-55-g7522