Skip to content

Commit 3a04a98

Browse files
committed
Splitting into multiple articles
1 parent 70955f3 commit 3a04a98

File tree

3 files changed

+121
-90
lines changed

3 files changed

+121
-90
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
title: Configure virtual switches for dev boxes
3+
description: Learn to configure virtual switches for dev boxes, enabling communication between dev boxes, VMs, and physical devices.
4+
author: RoseHJM
5+
ms.author: rosemalcolm
6+
ms.service: dev-box
7+
ms.topic: how-to
8+
ms.date: 12/05/2024
9+
10+
#customer intent: As a developer, I want to learn how to connect to a Dev Box using a virtual switch, so that my dev boxes, VMs, and physical devices can communicate.
11+
---
12+
13+
# Configure virtual switches for dev boxes
14+
15+
This article provides guidance on how to set up and use dev box with virtual switches. Virtual switches are used to connect dev boxes and other virtual machines (VMs) to both virtual networks and physical networks. They provide a way for dev boxes to communicate with each other and with external networks.
16+
17+
Dev box supports nested virtualization. You can create virtual machines inside a dev box and connect them to the default virtual switch *Default Switch*"*. If you want to create another virtual switch with internet access, set up a NAT network with an internal virtual switch. Use an IP address range that suits your required configuration.
18+
19+
> [!WARNING]
20+
> Incorrect configuration of virtual switch will cause you to lose the connection to dev box immediately and this is NOT reversable. Please setup with extreme care.
21+
22+
## Prerequisites
23+
- A dev box with Hyper-V and Virtual Machine Platform installed.
24+
25+
## Create virtual switch with NAT network
26+
27+
Create a virtual switch with a NAT network to enable internet access for your dev box and its guest VMs.
28+
29+
1. Create internal virtual switch:
30+
```powershell
31+
New-VMSwitch -SwitchName "VM-Internal" -SwitchType Internal
32+
```
33+
34+
1. Create an IP address for the NAT gateway
35+
```powershell
36+
New-NetIPAddress -IPAddress 192.168.100.1 -PrefixLength 24 -InterfaceIndex 34
37+
```
38+
39+
To find the *InterfaceIndex*, run `Get-NetAdapter`. Use the *ifIndex* of the adapter linked to the VM-Internal switch. If you choose a different IP range, ensure the IP address ends with “.1”.
40+
41+
1. Create the NAT network
42+
```powershell
43+
New-NetNat -Name VM-Internal-Nat -InternalIPInterfaceAddressPrefix 192.168.100.0/24
44+
```
45+
46+
## Configure guest VMs
47+
48+
Configure guest virtual machines (VMs) to use the virtual switch.
49+
50+
1. Create guest virtual machines (VMs) in your dev box, using the *VM-Internal* virtual switch. At this stage, the guest VM doesn't have internet access because it doesn't have an IP address.
51+
52+
1. Assign IP addresses to the guest VM.
53+
54+
1. On the guest VM, set the IP address to an available address in the range, like 192.168.100.10, 192.168.100.11, etc.
55+
1. Use the subnet mask 255.255.255.0, default gateway 192.168.100.1, and your desired DNS (for example, 8.8.8.8 for internet or your dev box's DNS).
56+
1. Open Network Connections, right-click the network adapter, select **Properties** > **Internet Protocol Version 4 (TCP/IPv4)**.
57+
58+
:::image type="content" source="media/how-to-connect-devices-to-dev-box/tcpip-config.png" alt-text="Screenshot that shows the TCP/IP version 4 configuration dialog.":::
59+
60+
After setting the IP address, the setup is complete. Verify that you have:
61+
62+
- Internet access from the guest VM.
63+
- Access between guest VMs.
64+
- Access to guest VMs from the dev box.
65+
66+
## Related content
67+
68+
- [Microsoft Dev Box: Frequently asked questions](dev-box-faq.yml)
Lines changed: 39 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,128 +1,80 @@
11
---
2-
title: How to connect devices to a dev box for development
3-
description: This article provides step-by-step instructions on how to connect physical devices to a dev box for Android application development.
2+
title: How to connect Android devices to a dev box
3+
description: Learn how to connect Android devices to a dev box for efficient testing and debugging, enhancing your app development workflow and productivity.
44
author: RoseHJM
55
ms.author: rosemalcolm
66
ms.service: dev-box
77
ms.topic: how-to
8-
ms.date: 12/05/2024
8+
ms.date: 12/11/2024
99

10-
#customer intent: As a developer, I want to set up dev box with physical Android devices so that I can efficiently develop Android applications.
10+
#customer intent: As a developer, I want to connect Android devices to my dev box so that I can develop apps for Android.
1111

1212
---
1313

14-
# Connect physical devices to a dev box
14+
# Connect Android devices to a dev box
1515

16-
This article provides a step-by-step guide on how to set up and use dev box with physical devices to develop Android applications. By following these instructions, you can ensure a smooth connection and configuration for your development environment.
16+
Connecting Android devices to a dev box enhances your app development process by allowing you to test and debug directly on physical devices. This article provides step-by-step instructions to help you connect your Android devices to a dev box, streamlining your development workflow.
1717

18-
## Connect Android devices to a dev box
18+
## Prerequisites
19+
20+
- Access to a dev box
21+
- A client computer to connect to the dev box from
22+
23+
## Prepare your client computer
24+
25+
To connect Android devices to your dev box, you first connect the devices to client computer you use to connect to the dev box.
26+
27+
### Connect Android devices
28+
29+
Connect your Android device to the client computer you'll use to connect to your dev box.
1930

20-
**Prepare the computer you connect from:**
2131
1. To open Device Manager, from the search box on the taskbar, run `devmgmt.msc`.
2232
1. Check that your device displays like one of the following options:
2333
- Device name: Universal Serial Bus / Pixel 6
2434
- Android Device / Android Composite Android Debug Bridge (ADB) Interface
2535
1. Uninstall nonstandard devices and drivers and restart your computer.
36+
1. In Device manager, verify your Android device displays.
2637

2738
> [!CAUTION]
28-
> Samsung devices will not connect if the ADB interface device exists on the computer you connect from. Uninstall the device.
39+
> Some devices like Samsung might not connect if the ADB interface device exists on the computer you connect from. To resolve this issue, uninstall the device.
40+
41+
### Configure USB redirection
42+
43+
Configure following Local Group Policy settings to allow USB redirection on your client computer.
2944

30-
**After your Android device and driver are verified:**
3145
1. To open Local Group Policy Editor, from a cmd window, run `gpedit.msc`.
3246
1. Navigate to **Computer Configuration\Administrative Templates\Windows Components\Remote Desktop Services\Remote Desktop Connection Client\RemoteFX USB Redirection**.
33-
1. Enable **RDP redirection of other supported RemoteFX USB devices from this computer** for **Administrators and Users**.
47+
1. Enable **Allow RDP redirection of other supported RemoteFX USB devices from this computer** for **Administrators and Users**.
3448
1. To apply the policy changes, from a cmd window, run `gpupdate /force`.
3549
1. Restart your computer.
3650

37-
**From your dev box:**
51+
## Prepare your dev box
52+
53+
When your Android devices are connected to your client computer, you can configure your dev box to access them by enabling USB redirection.
54+
55+
### Configure USB redirection
56+
57+
Configure following Local Group Policy settings to allow USB redirection on your dev box.
58+
3859
1. To open Local Group Policy Editor, from a cmd window, run `gpedit.msc`.
3960
1. Open **Computer Configuration\Administrative Templates\Windows Components\Remote Desktop Services\Remote Desktop Session Host\Device and Resource Redirection**.
4061
1. Set **Do not allow supported Plug and Play device redirection** to **Disabled**.
41-
1. Navigate to **Computer Configuration\Administrative Templates\Windows Components\Remote Desktop Services\Remote Desktop Connection Client\RemoteFX USB Device Direction**.
62+
1. Navigate to **Computer Configuration\Administrative Templates\Windows Components\Remote Desktop Services\Remote Desktop Connection Client\RemoteFX USB Device Redirection**.
4263
1. Enable **Allow RDP redirection of other supported RemoteFX USB devices from this computer** for **Administrators and Users**.
4364
1. To apply the policy changes, from a cmd window, run `gpupdate /force`.
4465
1. Restart your computer.
4566

46-
**If the Android device is not accessible to ADB:**
67+
## Troubleshoot ADB Connection Issues
68+
69+
If the Android device isn't accessible to ADB, check the latest device drivers are installed and the device displays in Device Manager.
70+
4771
1. To open Device Manager, from the search box on the taskbar, run `devmgmt.msc`.
48-
1. Ensure the Google USB driver is installed and the device appears as **Android Device \ Android Composite ADB Interface** (https://developer.android.com/studio/run/win-usb).
72+
1. Ensure the Google USB driver is installed and the device appears as [**Android Device \ Android Composite ADB Interface**](https://developer.android.com/studio/run/win-usb).
4973
- Devices from other manufacturers might not display in Device manager.
5074
- If your device is from another manufacturer, check [Install a USB driver](https://developer.android.com/studio/run/oem-usb#InstallingDriver) for manufacturer specific drivers. The goal is to make the ADB interface device show up in Device Manager.
5175
- The device name can vary from manufacturer to manufacturer, such as "Samsung Android Phone \ Samsung Android ADB Interface" or "Android Device \ Android Composite ADB Interface".
5276
1. Restart your computer.
5377

54-
## Set up virtual switches for nested VMs
55-
56-
Dev box supports nested virtualization. You can create virtual machines (VMs) inside a dev box and connect them to the default virtual switch *Default Switch*"*. If you want to create another virtual switch with internet access, set up a NAT network with an internal virtual switch. Use an IP address range that suits your required configuration.
57-
58-
> [!WARNING]
59-
> Incorrect configuration of virtual switch will cause you to lose the connection to dev box immediately and this is NOT reversable. Please setup with extreme care.
60-
61-
### Prerequisites
62-
- On your dev box, install the Hyper-V and Virtual Machine Platform.
63-
64-
### Create virtual switch with NAT network
65-
66-
1. Create internal virtual switch:
67-
```powershell
68-
New-VMSwitch -SwitchName "VM-Internal" -SwitchType Internal
69-
```
70-
71-
1. Create an IP address for the NAT gateway
72-
```powershell
73-
New-NetIPAddress -IPAddress 192.168.100.1 -PrefixLength 24 -InterfaceIndex 34
74-
```
75-
76-
To find the *InterfaceIndex*, run `Get-NetAdapter`. Use the *ifIndex* of the adapter linked to the VM-Internal switch. If you choose a different IP range, ensure the IP address ends with “.1”.
77-
78-
1. Create the NAT network
79-
```powershell
80-
New-NetNat -Name VM-Internal-Nat -InternalIPInterfaceAddressPrefix 192.168.100.0/24
81-
```
82-
83-
### Configure guest VMs
84-
85-
1. Create guest VMs in your dev box, using the *VM-Internal* virtual switch. At this stage, the guest VM doesn't have internet access because it doesn't have an IP address.
86-
87-
1. Assign IP addresses to the guest VM.
88-
89-
1. On the guest VM, set the IP address to an available address in the range, like 192.168.100.10, 192.168.100.11, etc.
90-
1. Use the subnet mask 255.255.255.0, default gateway 192.168.100.1, and your desired DNS (for example, 8.8.8.8 for internet or your dev box's DNS).
91-
1. Open Network Connections, right-click the network adapter, select **Properties** > **Internet Protocol Version 4 (TCP/IPv4)**.
92-
93-
:::image type="content" source="media/how-to-connect-devices-to-dev-box/tcpip-config.png" alt-text="Screenshot that shows the TCP/IP version 4 configuration dialog.":::
94-
95-
After setting the IP address, the setup is complete. Verify that you have:
96-
97-
- Internet access from the guest VM.
98-
- Access between guest VMs.
99-
- Access to guest VMs from the dev box.
100-
101-
## Prevent local drive redirection
102-
103-
By default, drives from your local client computer are available from within the dev box. This feature is called *drive-redirection*.
104-
105-
:::image type="content" source="media/how-to-connect-devices-to-dev-box/automatic-drive-redirection.png" alt-text="Screenshot that shows redirected drives on the dev box.":::
106-
107-
If you want to stop automatic local drive redirection, go to your dev box:
108-
109-
1. To open Local Group Policy Editor, from a cmd window, run `gpedit.msc`.
110-
1. Navigate to **Computer Configuration\Administrative Templates\Windows Components\Remote Desktop Services\Remote Desktop Session Host\Device and Resource Redirection**.
111-
1. Set **Do not allow drive redirection** to **Enabled**.
112-
113-
Subsequent RDP sessions no longer have the local drive mapped.
114-
115-
## Connect USB devices to dev box
116-
117-
Connect the USB device like a YubiKey to your local computer. Start remote desktop to your dev box.
118-
119-
120-
1. To open Local Group Policy Editor, from a cmd window, run `gpedit.msc`.
121-
1. Navigate to **Computer Configuration\Administrative Templates\Windows Components\Remote Desktop Services\Remote Desktop Session Host\Device and Resource Redirection**.
122-
1. Set **Do not allow supported Plug and Play device redirection** to **Disabled**.
123-
1. To apply the policy changes, from a cmd window, run `gpupdate /force`.
124-
1. Restart your computer.
125-
12678
## Related content
12779

12880
- [Microsoft Dev Box: Frequently asked questions](dev-box-faq.yml)

articles/dev-box/toc.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,6 @@ items:
9393
href: tutorial-connect-to-dev-box-with-remote-desktop-app.md
9494
- name: Use multiple monitors
9595
href: tutorial-configure-multiple-monitors.md
96-
- name: Connect physical devices to a dev box
97-
displayName: USB, devices, connect, physical, peripherals, android, switch
98-
href: how-to-connect-devices-to-dev-box.md
9996
- name: Security
10097
items:
10198
- name: Provide access to project admins
@@ -124,6 +121,20 @@ items:
124121
href: how-to-configure-stop-on-disconnect.md
125122
- name: Skip or delay an automatic shutdown
126123
href: how-to-skip-delay-stop.md
124+
- name: Connect devices to dev boxes
125+
items:
126+
- name: Connect physical devices to a dev box
127+
displayName: USB, devices, connect, physical, peripherals, android
128+
href: how-to-connect-devices-to-dev-box.md
129+
- name: Configure virtual switch
130+
displayName: connect, devices, switch
131+
href: how-to-connect-dev-box-virtual-switch.md
132+
- name: Drives and storage
133+
displayName: drives, storage, connect, physical, peripherals, android, switch
134+
href: /virtual-desktop/redirection-configure-drives-storage?tabs=group-policy&pivots=dev-box
135+
- name: USB redirection
136+
displayName: USB, devices, connect, physical, peripherals, android, switch
137+
href: /virtual-desktop/redirection-configure-usb?tabs=intune&pivots=dev-box
127138
- name: Troubleshooting
128139
items:
129140
- name: Automatically repair connectivity issues

0 commit comments

Comments
 (0)