|
| 1 | +--- |
| 2 | +title: Create a new virtual switch in Azure Stack Edge via PowerShell |
| 3 | +description: Describes how to create a virtual switch on an Azure Stack Edge device by using PowerShell. |
| 4 | +services: databox |
| 5 | +author: alkohli |
| 6 | + |
| 7 | +ms.service: databox |
| 8 | +ms.subservice: edge |
| 9 | +ms.topic: how-to |
| 10 | +ms.date: 04/06/2021 |
| 11 | +ms.author: alkohli |
| 12 | +--- |
| 13 | + |
| 14 | +# Create a new virtual switch in Azure Stack Edge Pro GPU via PowerShell |
| 15 | + |
| 16 | +[!INCLUDE [applies-to-GPU-and-pro-r-and-mini-r-skus](../../includes/azure-stack-edge-applies-to-gpu-pro-r-mini-r-sku.md)] |
| 17 | + |
| 18 | +This article describes how to create a new virtual switch on your Azure Stack Edge Pro GPU device. For example, you would create a new virtual switch if you want your virtual machines to connect through a different physical network port. |
| 19 | + |
| 20 | +## VM deployment workflow |
| 21 | + |
| 22 | +1. Connect to the PowerShell interface on your device. |
| 23 | +2. Query available physical network interfaces. |
| 24 | +3. Create a virtual switch. |
| 25 | +4. Verify the virtual network and subnet that are automatically created. |
| 26 | + |
| 27 | +## Prerequisites |
| 28 | + |
| 29 | +Before you begin, make sure that: |
| 30 | + |
| 31 | +- You've access to a client machine that can access the PowerShell interface of your device. See [Connect to the PowerShell interface](azure-stack-edge-gpu-connect-powershell-interface.md#connect-to-the-powershell-interface). |
| 32 | + |
| 33 | + The client machine should be running a [Supported OS](azure-stack-edge-gpu-system-requirements.md#supported-os-for-clients-connected-to-device). |
| 34 | + |
| 35 | +- Use the local UI to enable compute on one of the physical network interfaces on your device as per the instructions in [Enable compute network](azure-stack-edge-gpu-deploy-configure-network-compute-web-proxy.md#enable-compute-network) on your device. |
| 36 | + |
| 37 | + |
| 38 | +## Connect to the PowerShell interface |
| 39 | + |
| 40 | +[Connect to the PowerShell interface of your device](azure-stack-edge-gpu-connect-powershell-interface.md#connect-to-the-powershell-interface). |
| 41 | + |
| 42 | +## Query available network interfaces |
| 43 | + |
| 44 | +1. Use the following command to display a list of physical network interfaces on which you can create a new virtual switch. You will select one of these network interfaces. |
| 45 | + |
| 46 | + ```powershell |
| 47 | + Get-NetAdapter -Physical |
| 48 | + ``` |
| 49 | + Here is an example output: |
| 50 | + |
| 51 | + ```powershell |
| 52 | + [10.100.10.10]: PS>Get-NetAdapter -Physical |
| 53 | + |
| 54 | + Name InterfaceDescription ifIndex Status MacAddress LinkSpeed |
| 55 | + ---- -------------------- ------- ------ ---------- ----- |
| 56 | + Port2 QLogic 2x1GE+2x25GE QL41234HMCU NIC ... 12 Up 34-80-0D-05-26-EA ...ps |
| 57 | + Ethernet Remote NDIS Compatible Device 11 Up F4-02-70-CD-41-39 ...ps |
| 58 | + Port1 QLogic 2x1GE+2x25GE QL41234HMCU NI...#3 9 Up 34-80-0D-05-26-EB ...ps |
| 59 | + Port5 Mellanox ConnectX-4 Lx Ethernet Ad...#2 8 Up 0C-42-A1-C0-E3-99 ...ps |
| 60 | + Port3 QLogic 2x1GE+2x25GE QL41234HMCU NI...#4 7 Up 34-80-0D-05-26-E9 ...ps |
| 61 | + Port6 Mellanox ConnectX-4 Lx Ethernet Adapter 6 Up 0C-42-A1-C0-E3-98 ...ps |
| 62 | + Port4 QLogic 2x1GE+2x25GE QL41234HMCU NI...#2 4 Up 34-80-0D-05-26-E8 ...ps |
| 63 | + |
| 64 | + [10.100.10.10]: PS> |
| 65 | + ``` |
| 66 | +2. Choose a network interface that is: |
| 67 | +
|
| 68 | + - In the **Up** status. |
| 69 | + - Not used by any existing virtual switches. Currently, only one vswitch can be configured per network interface. |
| 70 | + |
| 71 | + To check the existing virtual switch and network interface association, run the `Get-HcsExternalVirtualSwitch` command. |
| 72 | + |
| 73 | + Here is an example output. |
| 74 | +
|
| 75 | + ```powershell |
| 76 | + [10.100.10.10]: PS>Get-HcsExternalVirtualSwitch |
| 77 | +
|
| 78 | + Name : vSwitch1 |
| 79 | + InterfaceAlias : {Port2} |
| 80 | + EnableIov : True |
| 81 | + MacAddressPools : |
| 82 | + IPAddressPools : {} |
| 83 | + ConfigurationSource : Dsc |
| 84 | + EnabledForCompute : True |
| 85 | + SupportsAcceleratedNetworking : False |
| 86 | + DbeDhcpHostVnicName : f4a92de8-26ed-4597-a141-cb233c2ba0aa |
| 87 | + Type : External |
| 88 | + |
| 89 | + [10.100.10.10]: PS> |
| 90 | + ``` |
| 91 | + In this instance, Port 2 is associated with an existing virtual switch and shouldn't be used. |
| 92 | +
|
| 93 | +## Create a virtual switch |
| 94 | +
|
| 95 | +Use the following cmdlet to create a new virtual switch on your specified network interface. After this operation is complete, your compute instances can use the new virtual network. |
| 96 | +
|
| 97 | +```powershell |
| 98 | +Add-HcsExternalVirtualSwitch -InterfaceAlias <Network interface name> -WaitForSwitchCreation $true |
| 99 | +``` |
| 100 | + |
| 101 | +Use the `Get-HcsExternalVirtualSwitch` command to identify the newly created switch. The new switch that is created is named as `vswitch-<InterfaceAlias>`. |
| 102 | + |
| 103 | +Here is an example output: |
| 104 | + |
| 105 | +```powershell |
| 106 | +[10.100.10.10]: P> Add-HcsExternalVirtualSwitch -InterfaceAlias Port5 -WaitForSwitchCreation $true |
| 107 | +[10.100.10.10]: PS>Get-HcsExternalVirtualSwitch |
| 108 | +
|
| 109 | +Name : vSwitch1 |
| 110 | +InterfaceAlias : {Port2} |
| 111 | +EnableIov : True |
| 112 | +MacAddressPools : |
| 113 | +IPAddressPools : {} |
| 114 | +ConfigurationSource : Dsc |
| 115 | +EnabledForCompute : True |
| 116 | +SupportsAcceleratedNetworking : False |
| 117 | +DbeDhcpHostVnicName : f4a92de8-26ed-4597-a141-cb233c2ba0aa |
| 118 | +Type : External |
| 119 | +
|
| 120 | +Name : vswitch-Port5 |
| 121 | +InterfaceAlias : {Port5} |
| 122 | +EnableIov : True |
| 123 | +MacAddressPools : |
| 124 | +IPAddressPools : |
| 125 | +ConfigurationSource : Dsc |
| 126 | +EnabledForCompute : False |
| 127 | +SupportsAcceleratedNetworking : False |
| 128 | +DbeDhcpHostVnicName : 9b301c40-3daa-49bf-a20b-9f7889820129 |
| 129 | +Type : External |
| 130 | +
|
| 131 | +[10.100.10.10]: PS> |
| 132 | +``` |
| 133 | + |
| 134 | +## Verify network, subnet |
| 135 | + |
| 136 | +After you have created the new virtual switch, Azure Stack Edge Pro GPU automatically creates a virtual network and subnet that corresponds to it. You can use this virtual network when creating VMs. |
| 137 | + |
| 138 | +<!--To identify the virtual network and subnet associated with the new switch that you created, use the `Get-HcsVirtualNetwork` command. This cmdlet will be released in April some time. --> |
| 139 | + |
| 140 | +## Next steps |
| 141 | + |
| 142 | +- [Deploy VMs on your Azure Stack Edge Pro GPU device via Azure PowerShell](azure-stack-edge-gpu-deploy-virtual-machine-powershell.md) |
| 143 | + |
| 144 | +- [Deploy VMs on your Azure Stack Edge Pro GPU device via the Azure portal](azure-stack-edge-gpu-deploy-virtual-machine-portal.md) |
0 commit comments