Networking service

The networking profile describes the objects used for configuring the system to allow virtual machines to communicate over the network. The global networking objects, used to configure the network switch in the management operating system, include the Msvm_VirtualEthernetSwitchManagementService, Msvm_VirtualEthernetSwitch, and Msvm_EthernetSwitchPort classes. The virtual machine networking objects, used to configure the network interface card (NIC) in the virtual machine, include the Msvm_EmulatedEthernetPort, Msvm_ResourceAllocationSettingData, and Msvm_LANEndpoint classes.

The root of the global networking profile is the Msvm_VirtualEthernetSwitch class. This class represents a virtual switch device in the management operating system. Msvm_VirtualEthernetSwitch is associated with instances of the Msvm_SwitchPort class, which represents the ports on the virtual switch. Instances of the Msvm_VirtualEthernetSwitch and Msvm_EthernetSwitchPort classes are created, deleted, and connected via the Msvm_VirtualEthernetSwitchManagementService class (not shown in the illustration earlier).

Virtual Switch Management Service (VSMS) represents the networking service present on a single Hyper-V host and contains methods for Msvm_VirtualEthernetSwitchManagementService used to control the definition, modification, and destruction of global networking resources such as virtual switches, switch ports and internal Ethernet ports.

The representation of the Ethernet NIC device in the virtual machine looks very similar to that of any other device, as described in the Virtual System Management Service. The Msvm_EmulatedEthernetPort and Msvm_SyntheticEthernetPort classes represent the virtual NIC device, and are configured via an associated Msvm_ResourceAllocationSettingData (RASD) instance. The only unusual characteristic of this representation is that, when the virtual machine is instantiated and in turn creates the Msvm_EmulatedEthernetPort and Msvm_SyntheticEthernetPort devices, it also creates an associated Msvm_LANEndpoint instance for the virtual NIC. Similarly, when the virtual machine is saved or turned off and the Msvm_EmulatedEthernetPort and Msvm_SyntheticEthernetPort instances are destroyed, the associated Msvm_VmLANEndpoint instance is also destroyed. The purpose of the Msvm_LANEndpoint is to serve as a bridge for connecting two networking ports to each other. In this case, it is used to connect a virtual NIC to a port on the virtual switch device. In other words, it connects the Msvm_EmulatedEthernetPort and Msvm_SyntheticEthernetPort instances on the virtual machine to a particular Msvm_EthernetSwitchPort instance on the virtual switch. To connect a switch to the outside, you must bind the physical Ethernet port to the Msvm_VirtualSwitch through BindExternalEthernetPort. Adversely, when connecting a switch to the host networking stack, or internal NIC, use ConnectInternal to have a virtual machine talk to the host and not the outside world. Msvm_ActiveConnection connects a switch port to the Msvm_SwitchLANEndpoint to which the port is connected inside of Hyper-V. The existence of this object means that the switch port and the Msvm_SwitchLANEndpoint are actively connected and the Ethernet port associated with Msvm_LANEndpoint can communicate with the network through the switch port.