Starting March 27, 2025, we recommend using android-latest-release
instead of aosp-main
to build and contribute to AOSP. For more information, see Changes to AOSP.
Test connectivity of multiple devices
Stay organized with collections
Save and categorize content based on your preferences.
Background
Running multiple Cuttlefish virtual devices can be done by executing the
following command:
launch_cvd --num_instances=n
When you are running two or more instances using --num_instances
flag,
instances share the connectivity medium for Wi-Fi and Bluetooth. This setting
allows the Cuttlefish instances to discover and connect to each other via
Bluetooth and Wi-Fi without additional action.
However, if you are executing multiple instances by using the
--base_instance_num
flag and multiple launch_cvd
invocations, you need
to specify wmediumd
's vhost server path to share Wi-Fi medium, and also
prevent launching multiple VM instances for AP.
Multi-device launch example
The following commands show how to launch two Cuttlefish instances that share
the Wi-Fi medium using serial execution of launch_cvd
.
launch_cvd
launch_cvd --base_instance_num=2 \
--vhost_user_mac80211_hwsim=$HOME/cuttlefish_runtime.1/internal/vhost_user_mac80211 \
--ap_kernel_image="" --ap_rootfs_image="" #Prevent launching multiple VM instances for AP
Bluetooth
The Cuttlefish bluetooth implementation is supported by rootcanal and can be
controlled with the Web UI command line console.
In the console, there are several commands that allow for the control of
bluetooth on the guest device:
Command |
Description |
list |
List current devices and phys |
add DEVICE_TYPE [ARGS] |
Create new device of type DEVICE_TYPE |
del DEVICE_INDEX |
Delete a device |
add_phy PHY_TYPE |
Add new phy with PHY_TYPE |
del_phy PHY_INDEX |
Delete a phy |
add_device_to_phy DEVICE_INDEX PHY_INDEX |
Add a device to phy |
del_device_from_phy DEVICE_INDEX PHY_INDEX |
Delete a `device from phy |
add_remote HOSTNAME PORT PHY_TYPE |
Add a remote Rootcanal as device and register it to phy |
Device type and args |
beacon [MAC_ADDRESS] [ADVERTISE_INTERVAL] |
scripted_beacon [MAC_ADDRESS] [CONFIG_PATH] [EVENTS_PATH] |
keyboard [MAC_ADDRESS] [ADVERTISE_INTERVAL] |
loopback [MAC_ADDRESS] [ADVERTISE_INTERVAL] |
sniffer |
Wi-Fi
wmediumd_control
wmediumd_control
is a command-line tool that controls Wi-Fi connectivity
medium. The tool has the following commands to manipulate Wi-Fi:
Command |
Description |
set_snr MAC_ADDR1
MAC_ADDR2
SNR_VALUE |
Set SNR value (0~255) between two
stations
|
start_pcap PCAP_FILE_PATH
|
Start capturing all frames
transmitted to air and stores it to
.pcap file |
stop_pcap
|
Stop and finalize current packet
capture |
list_stations
|
List all stations attached to
wmediumd |
reload_config
[CONFIG_FILE_PATH]
|
Reload wmediumd configuration with
CONFIG_FILE_PATH, if
CONFIG_FILE_PATH is
omitted, reload currently loaded
config file |
set_position MAC_ADDR
X_POSITION
Y_POSITION |
Set position of the station in
two-dimensional space
|
OpenWRT
If you want to connect to OpenWRT (Access Point), you can use either ssh
or
the admin webpage.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-06-12 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-06-12 UTC."],[],[],null,["# Test connectivity of multiple devices\n\nBackground\n----------\n\nRunning multiple Cuttlefish virtual devices can be done by executing the\nfollowing command: \n\n```\nlaunch_cvd --num_instances=n\n```\n\nWhen you are running two or more instances using `--num_instances` flag,\ninstances share the connectivity medium for Wi-Fi and Bluetooth. This setting\nallows the Cuttlefish instances to discover and connect to each other via\nBluetooth and Wi-Fi without additional action.\n\nHowever, if you are executing multiple instances by using the\n`--base_instance_num` flag and multiple `launch_cvd` invocations, you need\nto specify `wmediumd`'s vhost server path to share Wi-Fi medium, and also\nprevent launching multiple VM instances for AP.\n\nMulti-device launch example\n---------------------------\n\nThe following commands show how to launch two Cuttlefish instances that share\nthe Wi-Fi medium using serial execution of `launch_cvd`. \n\n```\nlaunch_cvd\n``` \n\n```\nlaunch_cvd --base_instance_num=2 \\\n --vhost_user_mac80211_hwsim=$HOME/cuttlefish_runtime.1/internal/vhost_user_mac80211 \\\n --ap_kernel_image=\"\" --ap_rootfs_image=\"\" #Prevent launching multiple VM instances for AP\n```\n\nBluetooth\n---------\n\nThe Cuttlefish bluetooth implementation is supported by rootcanal and can be\ncontrolled with the Web UI command line console.\n\nIn the console, there are several commands that allow for the control of\nbluetooth on the guest device:\n\n| Command | Description |\n|--------------------------------------------------------------------------------------------------|-----------------------------------------------------------------|\n| `list` | List current devices and phys |\n| `add` \u003cvar translate=\"no\"\u003eDEVICE_TYPE\u003c/var\u003e \u003cvar translate=\"no\"\u003e[ARGS]\u003c/var\u003e | Create new device of type \u003cvar translate=\"no\"\u003eDEVICE_TYPE\u003c/var\u003e |\n| `del` \u003cvar translate=\"no\"\u003eDEVICE_INDEX\u003c/var\u003e | Delete a device |\n| `add_phy` \u003cvar translate=\"no\"\u003ePHY_TYPE\u003c/var\u003e | Add new phy with \u003cvar translate=\"no\"\u003ePHY_TYPE\u003c/var\u003e |\n| `del_phy` \u003cvar translate=\"no\"\u003ePHY_INDEX\u003c/var\u003e | Delete a phy |\n| `add_device_to_phy` \u003cvar translate=\"no\"\u003eDEVICE_INDEX\u003c/var\u003e \u003cvar translate=\"no\"\u003ePHY_INDEX\u003c/var\u003e | Add a device to phy |\n| `del_device_from_phy` \u003cvar translate=\"no\"\u003eDEVICE_INDEX\u003c/var\u003e \u003cvar translate=\"no\"\u003ePHY_INDEX\u003c/var\u003e | Delete a \\`device from phy |\n| `add_remote` \u003cvar translate=\"no\"\u003eHOSTNAME\u003c/var\u003e \u003cvar translate=\"no\"\u003ePORT PHY_TYPE\u003c/var\u003e | Add a remote Rootcanal as device and register it to phy |\n\n| Device type and args |\n|-------------------------------------------------------------------------------------------------------------------------------------------|\n| `beacon` \u003cvar translate=\"no\"\u003e[MAC_ADDRESS]\u003c/var\u003e \u003cvar translate=\"no\"\u003e[ADVERTISE_INTERVAL]\u003c/var\u003e |\n| `scripted_beacon` \u003cvar translate=\"no\"\u003e[MAC_ADDRESS]\u003c/var\u003e \u003cvar translate=\"no\"\u003e[CONFIG_PATH]\u003c/var\u003e \u003cvar translate=\"no\"\u003e[EVENTS_PATH]\u003c/var\u003e |\n| `keyboard` \u003cvar translate=\"no\"\u003e[MAC_ADDRESS]\u003c/var\u003e \u003cvar translate=\"no\"\u003e[ADVERTISE_INTERVAL]\u003c/var\u003e |\n| `loopback` \u003cvar translate=\"no\"\u003e[MAC_ADDRESS]\u003c/var\u003e \u003cvar translate=\"no\"\u003e[ADVERTISE_INTERVAL]\u003c/var\u003e |\n| `sniffer` |\n\nWi-Fi\n-----\n\n### wmediumd_control\n\n`wmediumd_control` is a command-line tool that controls Wi-Fi connectivity\nmedium. The tool has the following commands to manipulate Wi-Fi:\n\n| Command | Description |\n|-----------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `set_snr` \u003cvar translate=\"no\"\u003eMAC_ADDR1\u003c/var\u003e \u003cvar translate=\"no\"\u003eMAC_ADDR2\u003c/var\u003e \u003cvar translate=\"no\"\u003eSNR_VALUE\u003c/var\u003e | Set SNR value (0\\~255) between two stations |\n| `start_pcap` \u003cvar translate=\"no\"\u003ePCAP_FILE_PATH\u003c/var\u003e | Start capturing all frames transmitted to air and stores it to .pcap file |\n| `stop_pcap` | Stop and finalize current packet capture |\n| `list_stations` | List all stations attached to wmediumd |\n| `reload_config` \u003cvar translate=\"no\"\u003e[CONFIG_FILE_PATH]\u003c/var\u003e | Reload wmediumd configuration with \u003cvar translate=\"no\"\u003eCONFIG_FILE_PATH\u003c/var\u003e, if \u003cvar translate=\"no\"\u003eCONFIG_FILE_PATH\u003c/var\u003e is omitted, reload currently loaded config file |\n| `set_position` \u003cvar translate=\"no\"\u003eMAC_ADDR\u003c/var\u003e \u003cvar translate=\"no\"\u003eX_POSITION\u003c/var\u003e \u003cvar translate=\"no\"\u003eY_POSITION\u003c/var\u003e | Set position of the station in two-dimensional space |\n\n### OpenWRT\n\nIf you want to connect to OpenWRT (Access Point), you can use either `ssh` or\nthe admin webpage.\n\n| Connection Type | Method |\n|-----------------|-------------------------------|\n| ssh | ``` ssh root@192.168.96.2 ``` |\n| Admin webpage | \u003chttps://192.168.96.2\u003e |"]]