diff --git a/agent/plugins/domainjoin/domainjoin_unix_script.go b/agent/plugins/domainjoin/domainjoin_unix_script.go index 69bf64c51..2877711ef 100755 --- a/agent/plugins/domainjoin/domainjoin_unix_script.go +++ b/agent/plugins/domainjoin/domainjoin_unix_script.go @@ -602,11 +602,12 @@ do_dns_config() { if [ $LINUX_DISTRO = "UBUNTU" ]; then if [ -d /etc/netplan ]; then # Ubuntu 18.04 + if_name=$(ip route list | grep default | grep -E 'dev (\w+)' -o | awk '{print $2}') cat << EOF | tee /etc/netplan/99-custom-dns.yaml network: version: 2 ethernets: - eth0: + $if_name: nameservers: addresses: [$INPUT_DNS_IP_ADDRESS1, $INPUT_DNS_IP_ADDRESS2] dhcp4-overrides: