Gestion du réseau
Rappel de l'architecture Hyper-V

La figure ci-dessus est bien connu des personnes qui connaissent Hyper-V. L'intérêt est ici de rappeler que les machines virtuelles sont isolées de l'hyperviseur. La communication IO de toutes les VM utilise le VMBus. Les ordres qui circulent sur ce bus sont orchestrés par la VM parente, c'est à dire la VM de l'OS de management (la VM qui est présente dès que vous installer un OS Windows Server ou Hyper-V Server)
Concernant la partie réseau de l'hyperviseur :
Un swith virtuel ou commutateur virtuel est un commutateur qui permet le lien entre la machine virtuelle et la machine hôte. Il joue un rôle de passerelle intermédiaire entre la machine virtuelle et le LAN.
Il existe 3 type de switches virtuels avec Hyper-V :
=======================================
- Type Externe : le switch virtuel est obligatoirement relié à au moins une carte réseau physique du serveur hôte. En cochant
« Autoriser le système d’exploitation de gestion à partager cette carte réseau », le serveur hôte Hyper-V sera relié au switch virtuel
et aura une nouvelle interface réseau virtuelle créée automatiquement.
- Type Interne : le switch virtuel permet aux machines virtuelles de communiquer entre elles et avec le serveur hôte Hyper-V qui aura
une nouvelle interface virtuelle créée automatiquement.
_ Type privé : le switch virtuel ne peut être connecté qu’à des machines virtuelles. Il est donc isolé du LAN et du serveur hôte Hyper-V
Gerer le réseau avec Powershell - Spécifique Hyper-V
======================================================================================================================================================================================================================================================================
-------------- Commandes réseaux pécifiques Hyper-V ---------------------------------------------------------------------------------------
===================================================================================================================================
===================================================================================================================================
=========================================
Pour rappel : type de switch virtuel pour Hyper-V :
=========================================
Afin de comprendre certaines commandes à suivre, un petit rappel sur les type de switches virtuels avec Hyper-V
- Type Externe : le switch virtuel est obligatoirement relié à au moins une carte réseau physique du serveur hôte. En cochant
« Autoriser le système d’exploitation de gestion à partager cette carte réseau », le serveur hôte Hyper-V sera relié au switch virtuel
et aura une nouvelle interface réseau virtuelle créée automatiquement.
- Type Interne : le switch virtuel permet aux machines virtuelles de communiquer entre elles et avec le serveur hôte Hyper-V qui aura
une nouvelle interface virtuelle créée automatiquement.
_ Type privé : le switch virtuel ne peut être connecté qu’à des machines virtuelles. Il est donc isolé du LAN et du serveur hôte Hyper-V
=======================
Création d'un switch virtuel :
=======================
Example pour Hyper-V
Création du switch externe :
New-VMSwitch "MyVirtualSwitch" -MinimumBandwidthMode weight -NetAdapterName "Ethernet 2" –AllowManagement $false
Ajout de 3 interfaces virtuelles (VMNic) au switche :
- vNIC LiveMigration
Add-VMNetworkAdapter -ManagementOS -Name "LiveMigration" -SwitchName "MyVirtualSwitch"
- vNIC Cluster
Add-VMNetworkAdapter -ManagementOS -Name "Cluster" -SwitchName "MyVirtualSwitch"
- vNIC Management
Add-VMNetworkAdapter -ManagementOS -Name "Management" -SwitchName "MyVirtualSwitch"
Pour contrôler les différents flux réseaux véhiculés par ces interfaces, nous appliquons à chacune
une politique de QOS :
- LiveMigration QoS
Set-VMNetworkAdapter -ManagementOS -Name "LiveMigrationNet" -MinimumBandwidthWeight 20
- Cluster QoS
Set-VMNetworkAdapter -ManagementOS -Name "ClusterNet" -MinimumBandwidthWeight 30
- Management QoS
Set-VMNetworkAdapter -ManagementOS -Name "ManagementNet" -MinimumBandwidthWeight 50
Remarque : il est vivement souhaitable que la somme des Weights soit de 100.
Pour voir les interfaces virtuelles crées (elles ne sont pas visible depuis l’interface graphique Hyper-V):
Get-VMNetworkAdapter –ManagementOS .
===========================================
Configurer une interface réseau virtuel dans une VM :
===========================================
Pour configurer les caractéristiques d'une interface virtuelle dans une machine virtuelle ou dans la machine de management :
PS C:\> Set-VMNetworkAdapter
Pour voir les interface virtuelles (VMnic) de toutes les machines virtuelles :
PS C:\> Get-VMNetworkAdapter -All
Name IsManagementOs VMName SwitchName MacAddress Status IPAddresses
---- -------------- ------ ---------- ---------- ------ -----------
Switch-Externe-HV12 True Switch-Externe-HV12 001EC9AFFDD2 {Ok}
Carte réseau False ARS-ADMW2K12R2-US-01 Switch-Externe-HV12 00155D0B691C {Ok} {192.168.1.114, fe80::e965:3ce8:3ae2:403c}
Carte réseau False ARS-EXCH2K13-01 Switch-Externe-HV12 00155D0B691D {Degraded, ProtocolVersion} {192.168.10.223, fe80::d0d3:fc9b:2687:ed76}
Carte réseau False ARS-EXCH2K13-02 Switch-Externe-HV12 00155D0B691E {Degraded, ProtocolVersion} {192.168.10.229, fe80::560:20ba:1b02:8a1c}
Network Adapter False ARS-STDW2K12-01 Switch-Externe-HV12 00155D0B6921 {Degraded, ProtocolVersion} {192.168.10.128, fe80::a58d:26cf:79:e0a7}
Network Adapter False ars-stdw2k12r2-01 Switch-Externe-HV12 00155D0B6920 {NoContact} {}
Network Adapter False ARS-STDW2K12R2-01 Switch-Externe-HV12 00155D0B691F {}
Carte réseau False ARS-TESTW2K12-01 Switch-Externe-HV12 000000000000 {}
Legacy Network Adapter False ARS-TESTW2K12-01 Switch-Externe-HV12 000000000000 {}
Pour voir les interfaces virtuelles d'une ou certaines machines virtuelles :
PS C:\> Get-VMNetworkAdapter -VMName *
Name IsManagementOs VMName SwitchName MacAddress Status IPAddresses
---- -------------- ------ ---------- ---------- ------ -----------
Carte réseau False ARS-TESTW2K12-01 Switch-Externe-HV12 000000000000 {}
Legacy Network Adapter False ARS-TESTW2K12-01 Switch-Externe-HV12 000000000000 {}
Network Adapter False ARS-STDW2K12R2-01 Switch-Externe-HV12 00155D0B691F {}
Network Adapter False ars-stdw2k12r2-01 Switch-Externe-HV12 00155D0B6920 {NoContact} {}
Network Adapter False ARS-STDW2K12-01 Switch-Externe-HV12 00155D0B6921 {Degraded, ProtocolVersion} {192.168.10.128, fe80::a58d:26cf:79:e0a7}
Carte réseau False ARS-EXCH2K13-02 Switch-Externe-HV12 00155D0B691E {Degraded, ProtocolVersion} {192.168.10.229, fe80::560:20ba:1b02:8a1c}
Carte réseau False ARS-EXCH2K13-01 Switch-Externe-HV12 00155D0B691D {Degraded, ProtocolVersion} {192.168.10.223, fe80::d0d3:fc9b:2687:ed76}
Carte réseau False ARS-ADMW2K12R2-US-01 Switch-Externe-HV12 00155D0B691C {Ok} {192.168.1.114, fe80::e965:3ce8:3ae2:403c}
PS C:\>
Pour voir les interfaces virtuelles (VMnic) de la partition de management :
PS C:\> Get-VMNetworkAdapter -ManagementOS
Name IsManagementOs VMName SwitchName MacAddress Status IPAddresses
---- -------------- ------ ---------- ---------- ------ -----------
Switch-Externe-HV12 True Switch-Externe-HV12 001EC9AFFDD2 {Ok}
Sur le serveur Hôte Hyper-V , voir les interfaces réseaux :
PS C:\> Get-NetAdapter
Name InterfaceDescription ifIndex Status MacAddress LinkSpeed
---- -------------------- ------- ------ ---------- ---------
vEthernet (Switch-Exte... Carte Ethernet virtuelle Hyper-V #3 19 Up 00-1E-C9-AF-FD-D2 10 Gbps
Ethernet 3 Broadcom BCM5708C NetXtreme II Gi...#48 14 Up 00-1E-C9-AF-FD-D2 1 Gbps
Ethernet 2 Broadcom BCM5708C NetXtreme II Gi...#50 13 Disconnected 00-1E-C9-AF-FD-D4 0 bps
Voir les switches virtuels externes :
PS C:\> Get-VMSwitch -SwitchType External
Name SwitchType NetAdapterInterfaceDescription
---- ---------- ------------------------------
Switch-Externe-HV12 External Broadcom BCM5708C NetXtreme II GigE (client NDIS VBD) #48
PS C:\>
==================
Gérer la partie VLAN :
==================
Virtual local area network (VLAN) settings can cause network connectivity issues. To display a list of virtual switch ports and associated VLANs,
type Get-VMNetworkAdapterVlan, and press ENTER. See the following example:
PS C:\> Get-VMNetworkAdapterVlan
VMName VMNetworkAdapterName Mode VlanList
------ -------------------- ---- --------
Internal network Access 2
Intel(R) 82567LM-3 Gigabit Network Connection - Virtual Switch Untagged
VM01.contoso.com Network Adapter Trunk 10,1-100
VM02.contoso.com Network Adapter Untagged
VM02.contoso.com Network Adapter Access 200
VM03.contoso.com Network Adapter Isolated 10,200
A virtual switch also provides support for VLAN trunk mode. In trunk mode, a virtual switch port receives
traffic from all VLANs that you configure in an allowed VLAN list. In the following example, the virtual
machine VM01.contoso.com is configured to send or receive traffic on any VLAN in the range 1-100.
If there is no VLAN specified in the packet, the packet is treated as if it is from VLAN 10.
Set-VMNetworkAdapterVlan –VMName VM01.contoso.com –Trunk –AllowedVlanIdList 1-100 –NativeVlanId 10
A virtual machine and virtual switch might also be configured with port VLANs (PVLANs). PVLAN is a virtual switch property that enables
the use of two VLAN IDs: a primary VLAN ID and a secondary VLAN ID. A PVLAN can be set in one of the following three modes:
PVLAN Mode Description
Isolated --> Communicates only with promiscuous ports in the PVLAN
Promiscuous --> Communicates with all ports in the PVLAN
Community --> Communicates with ports in the same community and any promiscuous ports in the PVLAN
A PVLAN can be used to create an environment where virtual machines can interact only with the Internet and not
have visibility into other virtual machine network traffic.
To accomplish this, set the virtual switch ports on all virtual machines to the same PVLAN in isolated mode. In this configuration,
all virtual machines are isolated from each other.
In the following example, the PVLAN is set in isolated mode with a primary VLAN ID of 10 and a secondary VLAN ID of 200:
Set-VMNetworkAdapterVlan –VMName VM03.contoso.com –Isolated –PrimaryVlanId 10 –SecondaryVlanId 200
Exemple pour ajouter des VLAN à un Team :
Voir http://blogs.technet.com/b/keithmayer/archive/2012/11/20/vlan-tricks-with-nic-teaming-in-windows-server-2012.aspx#.UzFlxulOUdU
Il s'agit en fait d'ajouter au team autand de nouvelles in terfaces que de VLAN :
Below are sample PowerShell commands that can be used to team two Ethernet ports on a server,
and then create four different VLAN interfaces. The four VLANs will have VLAN ID 10, 11, 12, 13.
The commands assume a network adaptor with four ports that are named “Ethernet, Ethernet1, Ethernet2, Ehernet3”
by the operating system. The commands shown in Example 1 below will team the first and third ports together, and then
create appropriate VLANs.
•New-NetLbfoTeam -Name "Lan Team" -TeamMembers Ethernet,Ethernet2 –TeamingMode SwitchIndependent
•Add-NetLbfoTeamNic -Team "Lan Team" -vLanID 10 -Name "Management VLAN"
•Add-NetLbfoTeamNic -Team "Lan Team" -vLanID 11 -Name "Live Migration VLAN"
•Add-NetLbfoTeamNic -Team "Lan Team" -vLanID 12 -Name "Cluster Network VLAN"
•Add-NetLbfoTeamNic -Team "Lan Team" -vLanID 13 -Name "HyperV Swtich VLAN"
Once the teams and VLANs are created, Hyper-V can then be configured to use the teams for network traffic like Management
or Live Migration. By taking advantage of the new network team features in Server 2012 and PowerShell, Systems Administrators
and Services Engineers can automate what was a more manual, time consuming, and potentially error-prone process in the past.
===========================
Spécifique TEAMING for Hyper-V :
===========================
Prérequis : les team sont créés au niveau de l'hôte Hyper-V (via New-NetLbfoTeam)
1 - Créer un Team sur la partition Hyper-V de management (représente l'hôte Hyper-V ) :
A faire sur l'hôte Hyper-V
La Cmdlet New-NetLbfoTeam cmdlet est utilisé ici pour créer un nouveau Team avec les 2 ports Ethernet physiques du serveur hôte.
PS C:\> New-NetLbfoTeam -Name TestTeam -TeamMembers "Ethernet", "Ethernet 2" -WhatIf
What if: Creates Team:'TestTeam' with TeamMembers:{'Ethernet', 'Ethernet 2'},
TeamNicName:'TestTeam', TeamingMode:'SwitchIndependent' and LoadBalancingAlgorithm:'Dynamic'.
Créons la team avec uniquement le premier port ethernet physique :
PS C:\> New-NetLbfoTeam -Name TestTeam -TeamMembers "Ethernet"
Confirm
Are you sure you want to perform this action?
Creates Team:'TestTeam' with TeamMembers:{'Ethernet'}, TeamNicName:'TestTeam', TeamingMode:'SwitchIndependent' andLoadBalancingAlgorithm:'Dynamic'.
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): y
Name : TestTeam
Members : Ethernet
TeamNics : TestTeam
TeamingMode : SwitchIndependent
LoadBalancingAlgorithm : Dynamic
Status : Down
2 - Ajout du second port Ethernet physique au team que l'on vient de créer :
A faire sur l'hôte hyper-V
PS C:\> Add-NetLbfoTeamMember -Name "Ethernet 2" -Team TestTeam
Confirm
Are you sure you want to perform this action?
Adds the Member:'Ethernet 2' with AdministrativeMode:'Active' to the Team:'TestTeam'
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): y
Name : Ethernet 2
InterfaceDescription : Broadcom NetXtreme Gigabit Ethernet #2
Team : TestTeam
AdministrativeMode : Active
OperationalStatus : Failed
TransmitLinkSpeed(Mbps) : 0
ReceiveLinkSpeed(Mbps) : 0
FailureReason : PhysicalMediaDisconnected
3 - Configuration du mode failover pour le Team :
A faire sur l'hôte hyper-V
Nous avons choisi dans l'exemple de configurer le team en mode Failover plutôt qu'en mode aggrégation de liens (link aggregation):
Le Team utilisera le l'interface "Ethernet" comme active par défaut et s'il y a une defaillance sur
ce port Ethernet alors l'interface "Ethernet 2" deviendra l'interface active
Pour modifier le mode, il faut utiliser la Cmdlet Set-NetLbfoTeamMember cmdlet :
PS C:\> Set-NetLbfoTeamMember -Name "Ethernet 2" -AdministrativeMode Standby
PS C:\> Get-NetLbfoTeamMember -Team TestTeam
Name : Ethernet 2
InterfaceDescription : Broadcom NetXtreme Gigabit Ethernet #2
Team : TestTeam
AdministrativeMode : Standby
OperationalStatus : Standby
TransmitLinkSpeed(Mbps) : 100
ReceiveLinkSpeed(Mbps) : 100
FailureReason : AdministrativeDecision
Name : Ethernet
InterfaceDescription : Broadcom NetXtreme Gigabit Ethernet
Team : TestTeam
AdministrativeMode : Active
OperationalStatus : Active
TransmitLinkSpeed(Mbps) : 100
ReceiveLinkSpeed(Mbps) : 100
FailureReason : NoFailure
Si vous souhaitez changer du mode Failover au mode Link Aggrefgation (les 2 ports Ethernet sont alors actifs), la commande est :
PS C:\> Set-NetLbfoTeamMember -Name "Ethernet 2" -AdministrativeMode Active
PS C:\>
4 - Partie VM - Activation du TEAMING dans une VM :
A faire sur la machine virtuelle :
Au préalable, il faut définir au moins 2 interfaces virtuelles dans les propriétés de la VM.
L'idéal est que chaque interface virtuelle soit connectée à un switch virtual différent
parce que chaque switch virtuel est lui-même associé à un port Ethernet physique différent du serveur hôte.
Après avoir stopper la VM, ajouter les interfaces Ethernet virtuelle et redémarrer la VM. Se connecter
sur cette machine virtuelle et afficher les adaptateurs virtuels présents.
PS C:\> Get-NetAdapter
Name InterfaceDescription ifIndex Status
---- -------------------- ------- -----
Ethernet 4 Microsoft Hyper-V Network Adapter #4 30 Up
Ethernet 3 Microsoft Hyper-V Network Adapter #3 26 Up
Ethernet 2 Microsoft Hyper-V Network Adapter #2 22 Up
Ethernet Microsoft Hyper-V Network Adapter 12 Up
Dans l'exemple, nous constatons la précense de 4 interfaces virtuelles :
- Ethernet 2 : connectée à un switch virtuel de type privé (aucune connexion avec le LAN ni le serveur hôte)
- Ethernet 3 : connectée à un switch virtuel de type interne (connexion avec le serveur Hôte mais aucune connextivité externe vers le LAN)
- Ethernet et Ethernet 4 : connectées à un switch virtuel de type externe : celle qui nousd interessent car elles sont connectées aux interfaces
Ethernet physique du serveur hôte. Ce sont les 2 que nous allons définir en teaming.
Pour vérifier que les 2 interfaces virtiuelles raccordées au LAN sont bien Ethernet et Ethernet 4, affichons les adresses IP
pour voir quelles interfaces ont obtenu une adresse IP via le serveur DHCP du LAN :
PS C:\> Get-NetIPAddress -InterfaceAlias "Eth*" -AddressFamily IPv4 | Format-Table InterfaceAlias,IPAddress,PrefixLength -AutoSize
InterfaceAlias IPAddress PrefixLength
-------------- --------- ------------
Ethernet 4 172.16.1.65 24
Ethernet 3 169.254.22.148 16
Ethernet 2 169.254.225.24 16
Ethernet 172.16.1.64 24
Nous constatons que les 2 cartes réseaux virtuelles connectées sur un Switch externe sont bien Ethernet et Ethernet 4 (en
effet, comme le montre leur adresse IP, ce sont les 2 interfaces virtuelles qui ont reçu un bail DHCP à partir du serveur DHCP sur la LAN)
Nous allons créé un Team avec ces 2 interfaces virtuelles
A faire sur l'hôte hyper-V :
Vérifions à partir du serveur hôte Hyper-V si le Teaming est déjà actifs ou non pour les interfaces réseaux virtuelles de la VM :
PS C:\> Get-VMNetworkAdapter -VMName Your-VM-Name | Format-Table MacAddress,SwitchName,AllowTeaming -AutoSize
MacAddress SwitchName AllowTeaming
---------- ---------- ------------
00155D0B1E09 vSwitch-1 Off
00155D0B1E0B vSwitch-2 Off
00155D0B1E0C vSwitch-INT Off
00155D0B1E0D vSwitch-PRI Off
Nous constatons que le paramètre AllowTeaming est à Off pour chacune des 4 interfaces virtuelles
Pour Activer la fonction de NIC Teaming sur ces interfaces, utilisons la cmdlet Set-VMNetworkAdapter :
PS C:\> Set-VMNetworkAdapter -VMName Your-VM-Name -AllowTeaming On
5 - Creating a new team in the GUEST OS (i.e. in a VM) :
Toutes les commandes doivent maintenant être exécutées sur la virtual machine.
Vérifions s'il existe déjà un team dans la VM
PS C:\> Get-NetLbfoTeam
Création du Team avec les interfaces virtuelles "Ethernet" et "Ethernet4"
(Rappel: ces cartes virtuelles sont connectées chacune à un switch externe)
PS C:\> New-NetLbfoTeam -Name VMTestTeam -TeamMembers "Ethernet","Ethernet 4" -WhatIf
What if: Creates Team:'VMTestTeam' with TeamMembers:{'Ethernet', 'Ethernet 4'},TeamNicName...
PS C:\> New-NetLbfoTeam -Name VMTestTeam -TeamMembers "Ethernet","Ethernet 4"
Confirm
Are you sure you want to perform this action?
Creates Team:'VMTestTeam' with TeamMembers:{'Ethernet', 'Ethernet 4'},TeamNicName...
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help
(default is "Y"):y
Name : VMTestTeam
Members : {Ethernet 4, Ethernet}
TeamNics : VMTestTeam
TeamingMode : SwitchIndependent
LoadBalancingAlgorithm : TransportPorts
Status : Degraded
Le nouveau Team est créé mais son statut est Degraded. Pas d'inquiétude, cette situation est provisoire et disparaît après quelques secondes
Pour lancer le GUI de gestion du team et vérifier l'état, taper :
PS C:\> lbfoadmin
Ou bien en lignes de commande Powershell
PS C:\> Get-NetLbfoTeam
Name : VMTestTeam
Members : {Ethernet 4, Ethernet}
TeamNics : VMTestTeam
TeamingMode : SwitchIndependent
LoadBalancingAlgorithm : TransportPorts
Status : Up
PS C:\> Get-NetLbfoTeamMember -Team VMTestTeam
Name : Ethernet 4
InterfaceDescription : Microsoft Hyper-V Network Adapter #4
Team : VMTestTeam
AdministrativeMode : Active
OperationalStatus : Active
TransmitLinkSpeed(Gbps) : 10
ReceiveLinkSpeed(Gbps) : 10
FailureReason : NoFailure
Name : Ethernet
InterfaceDescription : Microsoft Hyper-V Network Adapter
Team : VMTestTeam
AdministrativeMode : Active
OperationalStatus : Active
TransmitLinkSpeed(Gbps) : 10
ReceiveLinkSpeed(Gbps) : 10
FailureReason : NoFailure
PS C:\> Get-NetLbfoTeamNic -Team VMTestTeam
Name : VMTestTeam
InterfaceDescription : Microsoft Network Adapter Multiplexor Driver
Team : VMTestTeam
VlanID :
Primary : True
Default : True
TransmitLinkSpeed(Gbps) : 20
ReceiveLinkSpeed(Gbps) : 20
6 - Considération sur la configuration du team de la VM :
Essayons de modifier le mode du Teaming de Switch Independent à Static.
PS C:\> Set-NetLbfoTeam -Name VMTestTeam -TeamingMode Static
Set-NetLbfoTeam : 'SwitchIndependent' is the only TeamingMode value supported in a Virtual Machine
At line:1 char:1
+ Set-NetLbfoTeam -Name VMTestTeam -TeamingMode Static
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (MSFT_NetLbfoTea...2F94693B1C8A
}"):root/StandardCimv2/MSFT_NetLbfoTeam) [Set-NetLbfoTeam], CimException
+ FullyQualifiedErrorId : MiClientApiError_InvalidParameter,Set-NetLbfoTeam
The PowerShell command has thrown an exception and provides the following reason: 'SwitchIndependent'
is the only TeamingMode value supported in a Virtual Machine.
Essayons maintenant de modifier du mode Transport au mode Load balancing
(Load balancing est une forme de répartition de charge utilisant un hachage des addresses) vert le mode HyperVPort :
PS C:\> Set-NetLbfoTeam -Name VMTestTeam -LoadBalancingAlgorithm HyperVPort
Set-NetLbfoTeam : The only valid LoadBalancingAlgorithms in a Virtual Machine are 'TransportPorts', 'IPAddresses', and 'MacAddresses'
At line:1 char:1
+ Set-NetLbfoTeam -Name VMTestTeam -LoadBalancingAlgorithm HyperVPort
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (MSFT_NetLbfoTea...2F94693B1C8A
}"):root/StandardCimv2/MSFT_NetLbfoTeam) [Set-NetLbfoTeam], CimException
+ FullyQualifiedErrorId : MiClientApiError_InvalidParameter,Set-NetLbfoTeam
Once again we see an exception, this time with a failure reason of: The only valid LoadBalancingAlgorithms in a
Virtual Machine are 'TransportPorts', 'IPAddresses', and 'MacAddresses'
The above examples indicate two other important considerations when implementing NIC teaming inside a virtual machine:
Switch Independent is the only supported teaming mode when you implement NIC teaming in a virtual machine.
You cannot use Static Teaming or LACP as a teaming mode for teamed virtual network adapters.
Address Hash is the only supported load balancing mode when you implement NIC teaming in a virtual machine.
You cannot use Hyper-V Port as a load balancing mode for teamed virtual network adapters.
In addition, we can see from the second example above that Address Hash load balancing can be configured using PowerShell
to utilize one of three different kinds of hashing methods:
•TCP Ports Uses the source and destination TCP ports and also the source and destination IP addresses as inputs for
the hashing function. Note that this is the default hashing method when Address Hash is selected in the NIC Teaming GUI
as the load balancing mode for the team.
•IP Addresses Uses only the source and destination IP addresses as inputs for the hashing function.
•MAC Addresses Uses only the source and destination MAC addresses as inputs for the hashing function.
============================================
Création particulière d'un commutateur réseau Team :
============================================
Le switch ou commutateur réseau TEAM correspond à un TEAM qui est contrôlée par les extensions "Forwarding" de switch réseau Hyper-V.
Aucune autre applets de commande ne peuvent être utilisés pour gérer un Switch Team
et les applets de commande NetSwitchTeam ne doivent pas être utilisés pour gérer les TEAM d'interfaces réseaux standard (non-switch Team).
La cmdlet New-NetSwitchTeam crée une nouvelle équipe de commutateur. Un commutateur réseau Team doit avoir un nom
et doit être créé avec un ou plusieurs membres (des interfaces Ethernet physiques).
Exemple :
PS C:\> New-NetSwitchTeam -Name "MyTeam1" -TeamMembers "Ethernet 2","Ethernet 3"
===========================================
Capture du trafic réseau pour une machine virtuelle :
===========================================
Capture de tout le trafic de l'hote via une machine virtuelle nommé VM1 :
Il fait activer le mirroring de port réseau pour toutes les VM
Par exemple : HVServer1 est un Hyper-v server qui héberge 2 VMs nommées Server1 and Server2.
Both virtual machines connect to a virtual switch named Switch1.
On Server2, you install a network monitoring application named App1.
You need to capture all of the inbound and outbound traffic to Server1 by using App1
Get-VM "Server1" | Set-VMNetworkAdapter -PortMirroring Source
Get-VM "Server2" | Set-VMNetworkAdapter -PortMirroring Destination
-PortMirroring - Specifies the port mirroring mode for the network adapter to be configured.
Allowed values are None, Source, and Destination. If a virtual network adapter is configured as Source,
every packet it sends or receives is copied and forwarded to a virtual network adapter configured to
receive the packets. If a virtual network adapter is configured as Destination, it receives copied packets
from the source virtual network adapter. The source and destination virtual network adapters must be connected
to the same virtual switch. Specify None to disable the feature.