====== Технология VirtualBox ======
* [[https://www.virtualbox.org/|Официальный сайт]]
* [[https://www.virtualbox.org/manual/ch01.html|First steps]]
* [[https://eax.me/vboxmanage/|Управление VirtualBox из консоли с помощью vboxmanage]]
===== Интеграция с другими системами =====
* [[https://litl-admin.ru/cisco/gns3-i-virtualbox.html|Используем GNS3 для связи с реальными и виртуальными машинами VirtualBox]]
* [[Технология Vagrant]]
===== Подключение к гостевым система по RDP =====
* См. VirtualBox Extension Pack
===== Настройка алиасов =====
* [[Cmder]]
λ dir /x C:\
λ alias vboxmanage="C:\PROGRA~1\Oracle\VirtualBox\vboxmanage" $*
λ bash
$ alias vboxmanage="/c/Program\ Files/Oracle/VirtualBox/vboxmanage"
===== Основные команды работы с VM =====
vboxmanage list vms
vboxmanage list runningvms
vboxmanage import /c/Distrs/debian_11.1_64_01.ova --vsys 0 --vmname external-host
vboxmanage modifyvm external-host --nic1 nat
vboxmanage startvm external-host
vboxmanage controlvm external-host acpipowerbutton
### vboxmanage unregistervm external-host --delete
===== Вложенная виртуализация =====
* [[https://stackoverflow.com/questions/54251855/virtualbox-enable-nested-vtx-amd-v-greyed-out|Virtualbox enable nested vtx/amd-v greyed out]]
λ vboxmanage modifyvm server.corpX.un --nested-hw-virt on
===== Автоматизация развертывания стендов =====
λ bash
STAND_NUM=X
CLASS_NET=10.N.M
OVA_FILE=/c/Distrs/debian_10.0_64_01.ova
LAN_NET=192.168.${STAND_NUM}
/c/Program\ Files/Oracle/VirtualBox/vboxmanage list bridgedifs
WAN_ADAPTER_NAME=`/c/Program\ Files/Oracle/VirtualBox/vboxmanage list bridgedifs | grep ${CLASS_NET} -B 4 | head -n 1 | cut -d: -f2 | sed 's/^ *//g'`
echo $WAN_ADAPTER_NAME
/c/Program\ Files/Oracle/VirtualBox/vboxmanage list hostonlyifs
LAN_ADAPTER_NAME=`/c/Program\ Files/Oracle/VirtualBox/vboxmanage list hostonlyifs | grep ${LAN_NET} -B 4 | head -n 1 | cut -d: -f2 | sed 's/^ *//g'`
echo $LAN_ADAPTER_NAME
/c/Program\ Files/Oracle/VirtualBox/vboxmanage import ${OVA_FILE} --vsys 0 --vmname gate.corp${STAND_NUM}.un
/c/Program\ Files/Oracle/VirtualBox/vboxmanage modifyvm gate.corp${STAND_NUM}.un --nic1 hostonly --hostonlyadapter1 "${LAN_ADAPTER_NAME}" --macaddress1 auto --nic2 bridged --macaddress2 auto --bridgeadapter2 "${WAN_ADAPTER_NAME}"
/c/Program\ Files/Oracle/VirtualBox/vboxmanage startvm gate.corp${STAND_NUM}.un
/c/Program\ Files/Oracle/VirtualBox/vboxmanage controlvm gate.corp${STAND_NUM}.un poweroff soft
===== Пример с добавлением диска =====
NODE_NAME=node3
/c/Program\ Files/Oracle/VirtualBox/vboxmanage import ${OVA_FILE} --vsys 0 --vmname ${NODE_NAME}
/c/Program\ Files/Oracle/VirtualBox/vboxmanage modifyvm ${NODE_NAME} --nic1 intnet --macaddress1 auto
/c/Program\ Files/Oracle/VirtualBox/vboxmanage createhd --filename ~/${NODE_NAME}_disk2.vdi --size 8192
/c/Program\ Files/Oracle/VirtualBox/vboxmanage storageattach ${NODE_NAME} --storagectl SATA --port 1 --device 0 --type hdd --medium ~/${NODE_NAME}_disk2.vdi
===== Опции команды vboxmanage =====
λ vboxmanage
Oracle VM VirtualBox Command Line Management Interface Version 6.1.2
(C) 2005-2020 Oracle Corporation
All rights reserved.
Usage:
VBoxManage []
General Options:
[-v|--version] print version number and exit
[-q|--nologo] suppress the logo
[--settingspw ] provide the settings password
[--settingspwfile ] provide a file containing the settings password
[@] load arguments from the given response file (bourne style)
Commands:
list [--long|-l] [--sorted|-s] vms|runningvms|ostypes|hostdvds|hostfloppies|
intnets|bridgedifs|hostonlyifs|natnets|dhcpservers|
hostinfo|hostcpuids|hddbackends|hdds|dvds|floppies|
usbhost|usbfilters|systemproperties|extpacks|
groups|webcams|screenshotformats|cloudproviders|
cloudprofiles
showvminfo [--details]
[--machinereadable]
showvminfo --log
registervm
unregistervm [--delete]
createvm --name
[--groups , ...]
[--ostype ]
[--register]
[--basefolder ]
[--uuid ]
[--default]
modifyvm
[--name ]
[--groups , ...]
[--description ]
[--ostype ]
[--iconfile ]
[--memory ]
[--pagefusion on|off]
[--vram ]
[--acpi on|off]
[--ioapic on|off]
[--hpet on|off]
[--triplefaultreset on|off]
[--apic on|off]
[--x2apic on|off]
[--paravirtprovider none|default|legacy|minimal|
hyperv|kvm]
[--paravirtdebug [, ...]]
[--hwvirtex on|off]
[--nestedpaging on|off]
[--largepages on|off]
[--vtxvpid on|off]
[--vtxux on|off]
[--pae on|off]
[--longmode on|off]
[--ibpb-on-vm-exit on|off]
[--ibpb-on-vm-entry on|off]
[--spec-ctrl on|off]
[--l1d-flush-on-sched on|off]
[--l1d-flush-on-vm-entry on|off]
[--mds-clear-on-sched on|off]
[--mds-clear-on-vm-entry on|off]
[--nested-hw-virt on|off]
[--cpu-profile "host|Intel 80[86|286|386]"]
[--cpuid-portability-level <0..3>]
[--cpuid-set ]
[--cpuid-remove ]
[--cpuidremoveall]
[--hardwareuuid ]
[--cpus ]
[--cpuhotplug on|off]
[--plugcpu ]
[--unplugcpu ]
[--cpuexecutioncap <1-100>]
[--rtcuseutc on|off]
[--graphicscontroller none|vboxvga|vmsvga|vboxsvga]
[--monitorcount ]
[--accelerate3d on|off]
[--accelerate2dvideo on|off]
[--firmware bios|efi|efi32|efi64]
[--chipset ich9|piix3]
[--bioslogofadein on|off]
[--bioslogofadeout on|off]
[--bioslogodisplaytime ]
[--bioslogoimagepath ]
[--biosbootmenu disabled|menuonly|messageandmenu]
[--biosapic disabled|apic|x2apic]
[--biossystemtimeoffset ]
[--biospxedebug on|off]
[--system-uuid-le on|off]
[--boot<1-4> none|floppy|dvd|disk|net>]
[--nic<1-N> none|null|nat|bridged|intnet|hostonly|
generic|natnetwork]
[--nictype<1-N> Am79C970A|Am79C973|Am79C960|
82540EM|82543GC|82545EM|
virtio]
[--cableconnected<1-N> on|off]
[--nictrace<1-N> on|off]
[--nictracefile<1-N> ]
[--nicproperty<1-N> name=[value]]
[--nicspeed<1-N> ]
[--nicbootprio<1-N> ]
[--nicpromisc<1-N> deny|allow-vms|allow-all]
[--nicbandwidthgroup<1-N> none|]
[--bridgeadapter<1-N> none|]
[--hostonlyadapter<1-N> none|]
[--intnet<1-N> ]
[--nat-network<1-N> ]
[--nicgenericdrv<1-N> ]
[--natnet<1-N> |default]
[--natsettings<1-N> [],[],
[],[],
[]]
[--natpf<1-N> [],tcp|udp,[],
,[],]
[--natpf<1-N> delete ]
[--nattftpprefix<1-N> ]
[--nattftpfile<1-N> ]
[--nattftpserver<1-N> ]
[--natbindip<1-N> ]
[--natdnspassdomain<1-N> on|off]
[--natdnsproxy<1-N> on|off]
[--natdnshostresolver<1-N> on|off]
[--nataliasmode<1-N> default|[log],[proxyonly],
[sameports]]
[--macaddress<1-N> auto|]
[--mouse ps2|usb|usbtablet|usbmultitouch]
[--keyboard ps2|usb]
[--uart<1-N> off| ]
[--uartmode<1-N> disconnected|
server |
client |
tcpserver |
tcpclient |
file |
]
[--uarttype<1-N> 16450|16550A|16750]
[--lpt<1-N> off| ]
[--lptmode<1-N> ]
[--guestmemoryballoon ]
[--vm-process-priority default|flat|low|normal|high]
[--audio none|null|dsound]
[--audioin on|off]
[--audioout on|off]
[--audiocontroller ac97|hda|sb16]
[--audiocodec stac9700|ad1980|stac9221|sb16]
[--clipboard-mode disabled|hosttoguest|guesttohost|
bidirectional]
[--draganddrop disabled|hosttoguest|guesttohost|
bidirectional]
[--vrde on|off]
[--vrdeextpack default|]
[--vrdeproperty ]
[--vrdeport ]
[--vrdeaddress ]
[--vrdeauthtype null|external|guest]
[--vrdeauthlibrary default|]
[--vrdemulticon on|off]
[--vrdereusecon on|off]
[--vrdevideochannel on|off]
[--vrdevideochannelquality ]
[--usbohci on|off]
[--usbehci on|off]
[--usbxhci on|off]
[--usbrename ]
[--snapshotfolder default|]
[--teleporter on|off]
[--teleporterport ]
[--teleporteraddress ]
[--teleporterpassword ]
[--teleporterpasswordfile |stdin]
[--tracing-enabled on|off]
[--tracing-config ]
[--tracing-allow-vm-access on|off]
[--usbcardreader on|off]
[--autostart-enabled on|off]
[--autostart-delay ]
[--recording on|off]
[--recordingscreens all| [ ...]]
[--recordingfile ]
[--recordingvideores ]
[--recordingvideorate ]
[--recordingvideofps ]
[--recordingmaxtime ]
[--recordingmaxsize ]
[--recordingopts [, ...]]
[--defaultfrontend default|]
movevm
--type basic
[--folder ]
import
[--dry-run|-n]
[--options keepallmacs|keepnatmacs|importtovdi]
[--vmname ]
[--cloud]
[--cloudprofile ]
[--cloudinstanceid ]
[--cloudbucket ]
[more options]
(run with -n to have options displayed
for a particular OVF. It doesn't work for the Cloud import.)
export --output|-o .
[--legacy09|--ovf09|--ovf10|--ovf20|--opc10]
[--manifest]
[--iso]
[--options manifest|iso|nomacs|nomacsbutnat]
[--vsys ]
[--vmname ]
[--product ]
[--producturl ]
[--vendor ]
[--vendorurl ]
[--version ]
[--description ]
[--eula ]
[--eulafile ]
[--cloud ]
[--vmname ]
[--cloudprofile ]
[--cloudbucket ]
[--cloudkeepobject ]
[--cloudlaunchmode EMULATED|PARAVIRTUALIZED]
[--cloudlaunchinstance ]
[--clouddomain ]
[--cloudshape ]
[--clouddisksize ]
[--cloudocivcn ]
[--cloudocisubnet ]
[--cloudpublicip ]
[--cloudprivateip ]
startvm ...
[--type gui|sdl|headless|separate]
[-E|--putenv [=]]
controlvm
pause|resume|reset|poweroff|savestate|
acpipowerbutton|acpisleepbutton|
keyboardputscancode [ ...]|
keyboardputstring [ ...]|
keyboardputfile |
setlinkstate<1-N> on|off |
nic<1-N> null|nat|bridged|intnet|hostonly|generic|
natnetwork [] |
nictrace<1-N> on|off |
nictracefile<1-N> |
nicproperty<1-N> name=[value] |
nicpromisc<1-N> deny|allow-vms|allow-all |
natpf<1-N> [],tcp|udp,[],
,[], |
natpf<1-N> delete |
guestmemoryballoon |
usbattach |
[--capturefile ] |
usbdetach | |
audioin on|off |
audioout on|off |
clipboard mode disabled|hosttoguest|guesttohost|
bidirectional |
draganddrop disabled|hosttoguest|guesttohost|
bidirectional |
vrde on|off |
vrdeport |
vrdeproperty |
vrdevideochannelquality |
setvideomodehint
[[] [ |
[ ]]] |
setscreenlayout on|primary | off
screenshotpng [display] |
recording on|off |
recording screens all|none|,[...] |
recording filename |
recording videores x |
recording videorate |
recording videofps |
recording maxtime |
recording maxfilesize |
setcredentials
--passwordfile |
[--allowlocallogon ] |
teleport --host --port
[--maxdowntime ]
[--passwordfile |
--password ] |
plugcpu |
unplugcpu |
cpuexecutioncap <1-100>
webcam | |
addencpassword
|-
[--removeonsuspend ]
removeencpassword
removeallencpasswords
changeuartmode<1-N> disconnected|
server |
client |
tcpserver |
tcpclient |
file |
vm-process-priority default|flat|low|normal|high
discardstate
adoptstate
closemedium [disk|dvd|floppy]
[--delete]
storageattach
--storagectl
[--port ]
[--device ]
[--type dvddrive|hdd|fdd]
[--medium none|emptydrive|additions|
|host:|iscsi]
[--mtype normal|writethrough|immutable|shareable|
readonly|multiattach]
[--comment ]
[--setuuid ]
[--setparentuuid ]
[--passthrough on|off]
[--tempeject on|off]
[--nonrotational on|off]
[--discard on|off]
[--hotpluggable on|off]
[--bandwidthgroup ]
[--forceunmount]
[--server |]
[--target ]
[--tport ]
[--lun ]
[--encodedlun ]
[--username ]
[--password ]
[--passwordfile ]
[--initiator ]
[--intnet]
storagectl
--name
[--add ide|sata|scsi|floppy|sas|usb|pcie|virtio]
[--controller LSILogic|LSILogicSAS|BusLogic|
IntelAHCI|PIIX3|PIIX4|ICH6|I82078|
[ USB|NVMe|VirtIO]
[--portcount <1-n>]
[--hostiocache on|off]
[--bootable on|off]
[--rename ]
[--remove]
bandwidthctl
add --type disk|network
--limit [k|m|g|K|M|G] |
set
--limit [k|m|g|K|M|G] |
remove |
list [--machinereadable]
(limit units: k=kilobit, m=megabit, g=gigabit,
K=kilobyte, M=megabyte, G=gigabyte)
showmediuminfo [disk|dvd|floppy]
createmedium [disk|dvd|floppy] --filename
[--size |--sizebyte ]
[--diffparent |]
[--format VDI|VMDK|VHD] (default: VDI)]
[--variant Standard,Fixed,Split2G,Stream,ESX,
Formatted]
[[--property =] --property =