Set-VMHostNetworkAdapter

Synopsis

Configures the specified host network adapter.

Syntax

Set-VMHostNetworkAdapter -PhysicalNic <PhysicalNic[]> [-Duplex <String>] [-BitRatePerSecMb <Int32>] [-AutoNegotiate] [-WhatIf] [-Confirm] [<CommonParameters>]
Set-VMHostNetworkAdapter -VirtualNic <HostVirtualNic[]> [-Dhcp] [-IP <String>] [-SubnetMask <String>] [-Mac <String>] [-VMotionEnabled [<Boolean>]] [-FaultToleranceLoggingEnabled [<Boolean>]] [-IPv6ThroughDhcp [<Boolean>]] [-AutomaticIPv6 [<Boolean>]] [-IPv6 <String[]>] [-IPv6Enabled [<Boolean>]] [-WhatIf] [-Confirm] [<CommonParameters>]

Related Commands

New-VMHostNetworkAdapter
Remove-VMHostNetworkAdapter

Detailed Description

Configures the specified host network adapter. For a physical NIC, you can change the duplex and the bit rate settings (10, 100, 1000, 10000). For a regular virtual NIC, you can change the IP address and the subnet mask. For a console virtual NIC, you can modify the IP and the subnet mask, or choose DHCP mode.

Parameters

NameDescriptionRequired?Pipeline InputDefault Value
PhysicalNicProvide a list of the PhysicalNIC objects you want to update.truetrue (ByValue)
DuplexIndicate whether the link is capable of full-duplex. The valid values are "full" and "half". Only valid when updating a PhysicalNIC. Use this parameter only if the -AutoNegotiate parameter is not set.falsefalse
BitRatePerSecMbSpecify the bit rate of the link. Only valid when configuring a physical NIC. Use this parameter only if the -AutoNegotiate parameter is not set. Note that updating the speed (BitRatePerSec) of a physical NIC might take some time due to the hardware configuration being performed, and the returned object might still contain the current configuration instead of the updated one.falsefalse
AutoNegotiateIndicate that the host network adapter speed/duplex settings are configured automatically. Use this parameter only if the -Duplex and -BitRatePerSecMb parameters are not set.falsefalse
WhatIfShows the effects of the command without running it.falsefalse
ConfirmIndicate that the cmdlet is run only to display the changes that would be made and actually no objects are modified.falsefalse
VirtualNicProvide a list of the host network adapters you want to configure.truetrue (ByValue)
DhcpIndicate whether the host network adapter uses a Dhcp server. This parameter works only on ESXi hosts. For VMKernel adapters, Dhcp is supported only on ESX 4.0 and later.falsefalse
IPSpecify an IP address for the network adapter using an IPv4 dot notation. If the NIC has no subnet mask previously defined, you must also set the SubnetMask parameter. If the IP parameter is not specified, DHCP mode is enabled. Only valid when configuring a virtual NIC.falsefalse
SubnetMaskSpecify a subnet mask for the NIC. If the NIC has a subnet mask previously defined, specifying the SubnetMask parameter when configuring the IP address is not mandatory unless you want to modify the mask. Only valid when configuring a virtual NIC.falsefalse
MacSpecifies the media access control (MAC) address of the virtual network adapter. Only valid when configuring a virtual NIC. On vCenter Server 2.5/ ESX 3.5, changing the MAC address of a VMKernel network adapter modifies the DeviceName property of the adapter. This might cause problems if you try to retrieve the network adapter after modifying its MAC address.falsefalse
VMotionEnabledIndicate that you want to use the virtual host/VMKernel network adapter for VMotion.falsefalse
FaultToleranceLoggingEnabledIndicate that the network adapter is enabled for Fault Tolerance (FT) logging.falsefalse
IPv6ThroughDhcpIndicate that the IPv6 address is obtained through DHCP.falsefalse
AutomaticIPv6Indicate that the IPv6 address is obtained through a router advertisement.falsefalse
IPv6Specify static addresses using the following format: <IPv6>/<subnet_prefix_length> or <IPv6>. If you skip <subnet_prefix_length>, the default value of 64 is used. Specifying value for IPv6 parameter overrides the current configuration. To clear all configured static IP addresses, pass an empty array to the IPv6 parameter.falsefalse
IPv6EnabledIndicate that IPv6 configuration is enabled. Setting this parameter to "false" disables all IPv6-related parameters. If the value is $true", you need to provide values for at least one of the IPv6ThroughDhcp, AutomaticIPv6, and IPv6 parameters.falsefalse

Input Type

Return Type

VMware.VimAutomation.Types.Host.NIC.PhysicalNic or VMware.VimAutomation.Types.Host.NIC.HostVirtualNic

Notes

To configure IPv6 settings, you must be working on ESX 4.0 or later and IPv
    6 must be enabled on the ESX system. 
    On  ESX 3.x/vCenter 2.x, Set-VMHostNetworkAdapter might take longer to upda
    te the values of the FullDuplex and BitRatePerSec network adapter propertie
    s due to the hardware configuration being performed, and the returned objec
    t might still contain the current configuration instead of the updated one.

Examples

--------------  Example 1 --------------

C:\PS>$myHost = Get-VMHost -Name 10.23.112.234 

$mySwitch =  New-VirtualSwitch -VMHost $myHost -Name VS02_123

$nic =  New-VMHostNetworkAdapter -VMHost $myHost -PortGroup S34 -VirtualSwitch $
mySwitch -IP 10.23.123.234 -SubnetMask 255.255.254.0

Set-VMHostNetworkAdapter -VirtualNIC $nic -IP 10.23.112.245 -SubnetMask 255.255.
255.0


Updates the network adapter IP address and Subnet mask.




--------------  Example 2 --------------

C:\PS>$vmHostNetwork = Get-VMHostNetwork -VMHost *.120

$vmHostNetwork.VirtualNic | foreach{
if ( $_ -is [VMware.VimAutomation.Types.Host.NIC.HostVMKernelVirtualNic] ){
Set-VMHostNetworkAdapter -VirtualNic $_ -VMotionEnabled $true -IP $_.IP -SubnetM
ask $_.SubnetMask
}
}


Enable VMotion on all VMKernel network adapters on the specified virtual machine
 host.




--------------  Example 3 --------------

C:\PS>Get-VMHostNetworkAdapter | where { $_.PortGroupName -eq "Service Console 1
" } | Set-VMHostNetworkAdapter -IPv6Enabled $false


Disables the IPv6 support on a network adapter.




--------------  Example 4 --------------

C:\PS>Get-VMHostNetworkAdapter | where { $_.PortGroupName -eq "Service Console 1
" } | Set-VMHostNetworkAdapter -IPv6ThroughDhcp $true


Configures a network adapter to obtain IPv6 through DHCP.




--------------  Example 5 --------------

C:\PS>Get-VMHostNetworkAdapter | where { $_.PortGroupName -eq "Service Console 1
" } | Set-VMHostNetworkAdapter -AutomaticIPv6 $true


Configures a network adapter to obtain IPv6 by a router advertisement.




--------------  Example 6 --------------

C:\PS>Get-VMHostNetworkAdapter | where { $_.PortGroupName -eq "Service Console 1
" } | Set-VMHostNetworkAdapter -IPv6 $ipv6Address


Changes the IPv6 address of a network adapter.

Copyright © 1998 - 2009 VMware, Inc. All rights reserved.