Partager via


IVMNetworkAdapter interface

The IVMNetworkAdapter interface is the interface to a virtual network interface card (NIC). It is used to set up how a virtual machine is networked. Network interface cards can be added and removed by using IVMVirtualMachine::AddNetworkAdapter and IVMVirtualMachine::RemoveNetworkAdapter. You can also retrieve an IVMNetworkAdapter object from the IVMNetworkAdapterCollection collection returned from the IVMVirtualMachine::NetworkAdapters property.

When to use

The following procedures explain how to use the IVMNetworkAdapter interface.

To attach a virtual NIC to a host NIC

  • Virtual (guest) NICs are not attached directly to a host NIC. Instead, the virtual NIC is attached to a virtual network that is attached to a host NIC. For more information about configuring virtual networks, see IVMVirtualNetwork. To attach the virtual NIC to a virtual network, use the AttachToVirtualNetwork method.

To disconnect a virtual NIC from the virtual network

  • The DetachFromVirtualNetwork method will detach the virtual NIC from the virtual network. After this function is called, the VirtualNetwork property will return a virtual network ID that is not valid.

To remove a virtual NIC from a virtual machine if you have the virtual NIC object

  1. Get the virtual machine associated with the virtual NIC by using the VirtualMachine property.
  2. Use the current object as a parameter to the IVMVirtualMachine::RemoveNetworkAdapter method.

    Note

    The default Ethernet address for a network interface is "00-00-00-00-00-00", which is considered an invalid Ethernet address by most operating systems. If IsEthernetAddressDynamic is set to FALSE, use EthernetAddress to specify a valid Ethernet address.

Members

The IVMNetworkAdapter interface inherits from the IDispatch interface. IVMNetworkAdapter also has these types of members:

Methods

The IVMNetworkAdapter interface has these methods.

Method Description
AttachToVirtualNetwork Attaches the virtual NIC to the specified virtual network by using the virtual network's ID.
DetachFromVirtualNetwork Detaches the virtual NIC from its virtual network.

Properties

The IVMNetworkAdapter interface has these properties.

Property Access type Description
_ID
Read-only
The internal ID of this network adapter.
EthernetAddress
Read/write
The Ethernet (MAC/Physical/Network) address of the virtual NIC.
IsEthernetAddressDynamic
Read/write
Indicates whether the Ethernet address is dynamically generated.
VirtualMachine
Read-only
The virtual machine associated with this virtual NIC.
VirtualNetwork
Read-only
The virtual network to which the virtual NIC is attached.

Remarks

The default Ethernet address for a network interface is "00-00-00-00-00-00", which is considered an invalid Ethernet address by most operating systems. If IsEthernetAddressDynamic is set to FALSE, EthernetAddress must be initialized with a valid Ethernet network address.

Requirements

Product
Microsoft Virtual Server 2005 onWindows Server 2003
Download
Microsoft Virtual Server 2005 R2 SP1 Update onWindows Server 2008orWindows Server 2003
Header
VsComInterfaces.h

See also

IDispatch

Virtual Server Interfaces

IVMNetwork Methods

IVMNetwork Properties