vSphere PowerCLI Reference

New-VMHostNetworkAdapter

Synopsis

Creates a new HostVirtualNIC (Service Console or VMKernel) on the specified host.

Syntax

New-VMHostNetworkAdapter [-VMHost] <VMHost> [[-PortGroup] <String>] [-PortKey <String>] [-VirtualSwitch] <VirtualSwitchBase> [[-IP] <String>] [[-SubnetMask] <String>] [[-Mac] <String>] [-Mtu <Int32>] [-ConsoleNic] [-VMotionEnabled [<Boolean>]] [-FaultToleranceLoggingEnabled [<Boolean>]] [-IPv6ThroughDhcp] [-AutomaticIPv6] [-IPv6 <String[]>] [-ManagementTrafficEnabled [<Boolean>]] [-Server <VIServer[]>] [-WhatIf] [-Confirm] [<CommonParameters>]

Related Commands

Online version
Remove-VMHostNetworkAdapter
Set-VMHostNetworkAdapter

Detailed Description

Creates a new HostVirtualNIC (Service Console or VMKernel) on the specified host. Creates a port group with a name specified by the PortGroup parameter on the virtual switch passed through the VirtualSwitch parameter. Adds either a Console NIC if ConsoleNIC is set, or a VMKernel NIC otherwise.

Parameters

NameTypeDescriptionRequired?Pipeline InputDefault Value
VMHostVMHostSpecify the host to which you want to add the new adapter.truetrue (ByValue)
PortGroupStringSpecify the port group to which you want to add the new adapter.falsefalse
VirtualSwitchVirtualSwitchBaseIf the specified port group is non-existent, use this parameter to specify on which virtual switch you want to add the new network adapter.truefalse
IPStringSpecify an IP address for the new network adapter. All IP addresses are specified using IPv4 dot notation. If IP is not specified, DHCP mode is enabled. For VMKernel network adapters, the DHCP mode is supported only on vCenter Server 4.0, ESX 4.0, and later.falsefalse
SubnetMaskStringSpecify a subnet mask for the new network adapter.falsefalse
MacStringSpecify a media access control (MAC) address for the new virtual network adapter.falsefalse
AutomaticIPv6SwitchParameterIndicate that the IPv6 address is obtained through a router advertisement.falsefalse
ConfirmSwitchParameterIf the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation.falsefalse$true
ConsoleNicSwitchParameterIf the value is $true, indicates that you want to create a service console virtual network adapter. If the value is $false, indicates that you want to create a virtual host/VMkernel network adapter. Not supported on ESXi.falsefalse
FaultToleranceLoggingEnabledBooleanIndicate that the network adapter is enabled for Fault Tolerance (FT) logging. This parameter is supported only on ESX/vCenter Server 4.0 and later.falsefalse
IPv6String[]Specify multiple 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.falsefalse
IPv6ThroughDhcpSwitchParameterIndicate that the IPv6 address is obtained through DHCP.falsefalse
ManagementTrafficEnabledBooleanIndicate that you want to enable the network adapter for traffic management. This parameter is supported only on ESXi.falsefalse
MtuInt32Specify the MTU size.falsefalse
PortKeyStringSpecify the port of the virtual switch to which you want to connect the network adapter. Use this parameter only if the -VirtualSwitch parameter is specified.falsefalse
ServerVIServer[]The -Server parameter is needed when the host is specified by name. In this case, the host with the specified name is searched on the specified Servers and a network adapter is added to it. If a VMHost object is passed to the VMHost parameter - the -Server parameter is not used.falsefalse
VMotionEnabledBooleanIndicate that you want to use the new virtual host/VMKernel network adapter for VMotion.falsefalse
WhatIfSwitchParameterIndicate that the cmdlet is run only to display the changes that would be made and actually no objects are modified.falsefalse

Return Type

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.

Examples

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

$vs = Get-VirtualSwitch -VMHost 10.23.113.111 -Name vSwitch  New-VMHostNetworkAdapter -VMHost 10.23.113.110 -PortGroup MyConsolePortGroup -VirtualSwitch $vs -ConsoleNIC -Mtu 4000

Creates a Service Console port group at the vSwitch0 virtual switch. The IP address is obtained via DHCP.

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

$vs = Get-VirtualSwitch -VMHost (Get-VMHost 10.23.113.111) -Name "vSwitch0"  New-VMHostNetworkAdapter -VMHost (Get-VMHost 10.23.113.110) -PortGroup MyVMKernelPortGroup -VirtualSwitch $vs -IP 192.168.168.110 -SubnetMask 255.255.255.0

Creates a VMKernel port group at the vSwitch0 virtual switch and assigns a static IP address.

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

New-VMHostNetworkAdapter -VMHost $vmHost -VirtualSwitch $virtualSwitch -PortGroup "Service Console 1" -IP 192.168.0.1 -SubnetMask 255.255.255.0 -IPv6 "0200:2342::1/32"

Creates a VMKernel NIC that has an IPv4 address and an IPv6 address.

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

New-VMHostNetworkAdapter -VMHost $myHost -VirtualSwitch $virtualSwitch -PortGroup "Serveice Console 1" -IP 192.168.0.1 -SubnetMask 255.255.255.0 -AutomaticIPv6

Creates a VMKernel NIC that obtains IPv6 automatically (by router advertisement) and takes the desired IPv4 address.

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

New-VMHostNetworkAdapter -VMHost $vmHost -VirtualSwitch $virtualSwitch -PortGroup "Service Console 1" - -IPv6ThroughDhcp

Creates a VMKernel NIC that obtains the IPv4 and IPv6 addresses by DHCP.


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