Set-VMHostNetworkAdapter

This cmdlet 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.

Syntax

-PortGroup  <DistributedPortGroup>
-VirtualNic  <HostVirtualNic[]>
[CommonParameters]

Parameters

Required Parameter Name Type Position Features Description
required
PortGroup
DistributedPortGroup named Specifies a distributed port group to which you want to connect the host network adapter. You can use this parameter only to migrate a virtual network adapter from a standard port group to a distributed port group.
required
VirtualNic
HostVirtualNic[] named
  • pipeline
  • Provide a list of the host network adapters you want to configure.

    -PhysicalNic  <PhysicalNic[]>
    [-AutoNegotiate]
    [-BitRatePerSecMb  <Int32>]
    [-Duplex  <String>]
    [CommonParameters]

    Parameters

    Required Parameter Name Type Position Features Description
    required
    PhysicalNic
    PhysicalNic[] named
  • pipeline
  • Specifies the PhysicalNIC objects you want to update.
    optional
    AutoNegotiate
    SwitchParameter named Indicates that the host network adapter speed/duplex settings are configured automatically. Use this parameter only if the Duplex and BitRatePerSecMb parameters are not set.
    optional
    BitRatePerSecMb
    Int32 named Specifies 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.
    optional
    Duplex
    String named Indicates whether the link is capable of full-duplex. The valid values are Full and Half. You can set this parameter only when updating a PhysicalNIC. Use this parameter only if the AutoNegotiate parameter is not set.

    -VirtualNic  <HostVirtualNic[]>
    [-AutomaticIPv6  <Boolean>]
    [-Dhcp]
    [-FaultToleranceLoggingEnabled  <Boolean>]
    [-IP  <String>]
    [-IPv6  <String[]>]
    [-IPv6Enabled  <Boolean>]
    [-IPv6ThroughDhcp  <Boolean>]
    [-Mac  <String>]
    [-ManagementTrafficEnabled  <Boolean>]
    [-Mtu  <Int32>]
    [-ProvisioningEnabled  <Boolean>]
    [-SubnetMask  <String>]
    [-VMotionEnabled  <Boolean>]
    [-VSphereBackupNfcEnabled  <Boolean>]
    [-VSphereReplicationEnabled  <Boolean>]
    [-VSphereReplicationNfcEnabled  <Boolean>]
    [-VsanTrafficEnabled  <Boolean>]
    [CommonParameters]

    Parameters

    Required Parameter Name Type Position Features Description
    required
    VirtualNic
    HostVirtualNic[] named
  • pipeline
  • Provide a list of the host network adapters you want to configure.
    optional
    AutomaticIPv6
    Boolean named Indicates that the IPv6 address is obtained through a router advertisement.
    optional
    Dhcp
    SwitchParameter named Indicates 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.1 and later.
    optional
    FaultToleranceLoggingEnabled
    Boolean named Indicates that the network adapter is enabled for Fault Tolerance (FT) logging. This parameter is supported only on ESX/vCenter Server 4.1 and later.
    optional
    IP
    String named Specifies 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.
    optional
    IPv6
    String[] named Specifies static addresses using the following format: / or . If you skip , the default value of 64 is used. Specifying a value for IPv6 parameter overrides the current configuration. To clear all configured static IP addresses, pass an empty array to the IPv6 parameter.
    optional
    IPv6Enabled
    Boolean named Indicates that IPv6 configuration is enabled. Setting this parameter to $false deactivates 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.
    optional
    IPv6ThroughDhcp
    Boolean named Indicates that the IPv6 address is obtained through DHCP.
    optional
    Mac
    String named Specifies the media access control (MAC) address of the virtual network adapter. Only valid when configuring a virtual NIC.
    optional
    ManagementTrafficEnabled
    Boolean named Indicates that you want to enable the network adapter for management traffic. This parameter is supported only on ESX/ESXi/vCenter Server 4.1 and later.
    optional
    Mtu
    Int32 named Specifies the MTU size.
    optional
    ProvisioningEnabled
    Boolean named Specifies whether vSphere Provisioning is enabled on this network adapter.
    optional
    SubnetMask
    String named Specifies 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.
    optional
    VMotionEnabled
    Boolean named Indicates that you want to use the virtual host/VMKernel network adapter for VMotion.
    optional
    VSphereBackupNfcEnabled
    Boolean named Specifies whether backup through NFC is enabled on this network adapter. This parameter is supported in vSphere 7.0 and later.
    optional
    VSphereReplicationEnabled
    Boolean named Specifies whether vSphere Replication traffic is enabled on this network adapter.
    optional
    VSphereReplicationNfcEnabled
    Boolean named Specifies whether vSphere Replication Network File Copy (NFC) traffic is enabled on this network adapter.
    optional
    VsanTrafficEnabled
    Boolean named Specifies whether Virtual SAN traffic is enabled on this network adapter.

    Output

    VMware.VimAutomation.ViCore.Types.V1.Host.Networking.Nic.HostNic

    Examples


    Example 1

    $vswitch = New-VirtualSwitch -VMHost 10.23.112.234 -Name VSwitch
    $nic = New-VMHostNetworkAdapter -VMHost 10.23.112.234 -PortGroup PortGroup -VirtualSwitch $vswitch -IP 10.23.123.234 -SubnetMask 255.255.254.0
    Set-VMHostNetworkAdapter -VirtualNIC $nic -IP 10.23.112.245 -SubnetMask 255.255.255.0 -Mtu 4000

    Updates the network adapter IP address, Subnet mask, and MTU size.

    Example 2

    Get-VMHost Host | Get-VMHostNetworkAdapter -VMKernel | Set-VMHostNetworkAdapter -VMotionEnabled $true

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

    Example 3

    Get-VMHostNetworkAdapter | where { $_.PortGroupName -eq "Service Console 1" } | Set-VMHostNetworkAdapter -IPv6Enabled $false

    Deactivates the IPv6 support on a network adapter.

    Example 4

    Get-VMHostNetworkAdapter | where { $_.PortGroupName -eq "Service Console 1" } | Set-VMHostNetworkAdapter -IPv6ThroughDhcp $true

    Configures a network adapter to obtain IPv6 through DHCP.

    Example 5

    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

    Get-VMHostNetworkAdapter | where { $_.PortGroupName -eq "Service Console 1" } | Set-VMHostNetworkAdapter -IPv6 $ipv6Address

    Changes the IPv6 address of a network adapter.

    Related Commands

    Feedback

    Was this page helpful?