VMware Cloud Community
DroppedAtBirth
Contributor
Contributor
Jump to solution

Clone Linux DNS Issue

I have a powershell script I use to clone Windows and Linux VM's. It all appears to work great except the DNS isn't being set on linux. Does the DNS setting need to be set differently then on Windows? Below is the network configuration part of the script. Any help or suggestions would be greatly appricated.

#CREATE OBJECT CUSTOMIZATIONADAPTERMAPPING

$vmcSpec.Customization.NicSettingMap = @(New-Object VMware.Vim.CustomizationAdapterMapping)

#CREATE OBJECT CUSTOMIZATIONIPSETTINGS

$vmcSpec.Customization.NicSettingMap[0].Adapter = New-Object VMware.Vim.CustomizationIPSettings

#CREATE OBJECT CUSTOMIZATIONFIXEDIP

$vmcSpec.Customization.NicSettingMap[0].Adapter.Ip = New-Object VMware.Vim.CustomizationFixedIp

#NETWORK SPECIFICATIONS

$vmcSpec.Customization.NicSettingMap[0].Adapter.Ip.IpAddress = $ip

$vmcSpec.Customization.NicSettingMap[0].Adapter.SubnetMask = $subnetmask

$vmcSpec.Customization.NicSettingMap[0].Adapter.Gateway = $gateway

$vmcSpec.Customization.NicSettingMap[0].Adapter.DnsServerList = $dns

#CREATE OBJECT CUSTOMIZATIONGLOBALIPSETTINGS

$vmcSpec.Customization.GlobalIPSettings = New-Object VMware.Vim.CustomizationGlobalIPSettings

$vmcSpec.Customization.GlobalIPSettings.DnsServerList = $dns

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

If you look at the description of the dnsServerList property in the CustomizationIPSettings object, it says "...the Linux guest customization process ignores this setting and looks for its DNS servers in the globalIPSettings object.".

Try commenting out this line

...
# $vmcSpec.Customization.NicSettingMap[0].Adapter.DnsServerList = $dns
...


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
2 Replies
LucD
Leadership
Leadership
Jump to solution

If you look at the description of the dnsServerList property in the CustomizationIPSettings object, it says "...the Linux guest customization process ignores this setting and looks for its DNS servers in the globalIPSettings object.".

Try commenting out this line

...
# $vmcSpec.Customization.NicSettingMap[0].Adapter.DnsServerList = $dns
...


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
DroppedAtBirth
Contributor
Contributor
Jump to solution

yep figured this out just after my post. Thanks for the info.

0 Kudos