vPauleAKQ
Enthusiast
Enthusiast

DISABLE IPv4 on vmk using PowerCLI

Jump to solution

Hi there,

I am currently deploying new VMK interfaces to multiple ESXi hosts to use them for backup/restore.

These VMKs only need to have an IPv6 address, no IPv4.

If I create them using new-vmhostnetworkadapter, the IPv4 address is set to 0.0.0.0, but I want it to be completely disabled.

In the web client, there is an option to "No IPv4 settings", which is what I want to do with PowerCLI, but no luck so far.

Does anyone know, how to set this option for a single VMK interface?

ESXi version is 6.5.

Thanks!

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership

Ok, got it.
You (obviously) only see that option when you have IPv6 enabled.

Try like this

$esxName = 'MyEsx'

$vmkName = 'vmk1'


$esxcli = Get-EsxCli -VMHost $esxName -V2

$sIPv4 =  @{

  interfacename = $vmkName

  type = 'none'

}

$esxcli.network.ip.interface.ipv4.set.Invoke($sIPv4)


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

View solution in original post

0 Kudos
7 Replies
LucD
Leadership
Leadership

Where do you see that option "No IPv4 settings"?

I only see the option 'DHCP' or 'Static' for IPv4


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

0 Kudos
vPauleAKQ
Enthusiast
Enthusiast

Unbenannt.PNG

When you edit the settings of a vmk interface in the HTML5 Web Client, there is an option to set "No IPv4 settings".

Same option is available in the old flash Web Client.

Unbenannt1.PNG

0 Kudos
LucD
Leadership
Leadership

Ok, got it.
You (obviously) only see that option when you have IPv6 enabled.

Try like this

$esxName = 'MyEsx'

$vmkName = 'vmk1'


$esxcli = Get-EsxCli -VMHost $esxName -V2

$sIPv4 =  @{

  interfacename = $vmkName

  type = 'none'

}

$esxcli.network.ip.interface.ipv4.set.Invoke($sIPv4)


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

0 Kudos
vPauleAKQ
Enthusiast
Enthusiast

I knew you would solve this!

Thanks a lot LucD, I owe you Smiley Happy

0 Kudos
rdunbar
Contributor
Contributor

esxcli network ip interface ipv4 set -i vmk0 -t none

with this you get bad result:

in the /etc/hosts

you will see 0.0.0.0 "hostname"

 

Q; how to remove the 0.0.0.0 completely from the interface ???

0 Kudos
rdunbar
Contributor
Contributor

[root@esxi-01:~] esxcli network ip interface ipv4 get
Name IPv4 Address IPv4 Netmask IPv4 Broadcast Address Type Gateway DHCP DNS
---- ------------ ------------ -------------- ------------ ------- --------
vmk0 0.0.0.0 0.0.0.0 0.0.0.0 NONE 0.0.0.0 false

Screenshot 2022-06-21 130825.jpg

0 Kudos
LucD
Leadership
Leadership

The only method I know of is to remove the vmk and recreate it.

Something like I did in Re: Powrcli to change vmkernel interface name - VMware Technology Network VMTN


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

0 Kudos