VMware Cloud Community
Odurasler2
Enthusiast
Enthusiast
Jump to solution

How To Change vmk0 IP

I'm trying to run the "Set-VMHostNetworkAdapter -IP 'new-ip-address' -VirtualAdapter vmk0" without any success. Can someone provide guidance as to what is required just to change the IP?

My ultimate goal is to change the IP's to a list of servers after being configured for AutoDeploy with DHCP, change DHCP to Static, and then add a second adapter. But unfortunately, I can't even do a simple change of IP on just a single system.

thanks in advanced!

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Did you try like this?

Get-VMHost -Name MyEsx |

Get-VMHostNetworkAdapter -Name vmk1 |

Set-VMHostNetworkAdapter -IP '192.168.1.111'

Any errors?
And which vSphere and PowerCLI version are you using?


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

View solution in original post

Reply
0 Kudos
2 Replies
LucD
Leadership
Leadership
Jump to solution

Did you try like this?

Get-VMHost -Name MyEsx |

Get-VMHostNetworkAdapter -Name vmk1 |

Set-VMHostNetworkAdapter -IP '192.168.1.111'

Any errors?
And which vSphere and PowerCLI version are you using?


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

Reply
0 Kudos
TakoRoni
Enthusiast
Enthusiast
Jump to solution

wont it be a problem to run

Get-VMHost -Name MyEsx |

Get-VMHostNetworkAdapter -Name vmk1 |

Set-VMHostNetworkAdapter -IP '192.168.1.111'

inside the script - it will affect immediately  and not wait for the commit

$netMgr.UpdateNetworkConfig($config,[VMware.Vim.HostConfigChangeMode]::modify

can i do the same as the DG ?

$vmk = $netmgr.NetworkConfig.Vnic | where{$_.Device -eq $vmkName}

$vmk.ChangeOperation = [VMware.Vim.HostConfigChangeOperation]::edit

$vmk.Spec.IpRouteSpec = New-Object VMware.Vim.HostVirtualNicIpRouteSpec

$vmk.spec.IpRouteSpec.IpRouteConfig = New-Object VMware.Vim.HostIpRouteConfig

$vmk.Spec.IpRouteSpec.IpRouteConfig.DefaultGateway = $newDG

$config.Vnic += $vmk

i didnt find who to do it

roni

Reply
0 Kudos