Virtual Boxと仮想マシンの設定について学んだことをまとめました。
調べ方
- ChatGPT 4o with canvasに概要をドキュメントでまとめてもらう。
- 各所わからない部分を追加質問して説明を付け加えていった。
- それでもわからないところはウェブ検索で適当な記事見つけて読み漁った(ここは以下のまとめにはほぼ反映できていないです)。
日本語版はそのうち作るかなぁ作んないかもなぁという感じ。
まとめた結果
1. General
This section covers basic properties of the virtual machine. It includes:
- Basic: Here, you can set the name, type, and version of the virtual machine. The type (e.g., Linux, Windows) and version help VirtualBox optimize its settings.
- Advanced: Contains options for snapshot folder location and shared clipboard between the host and guest. You can also enable drag and drop between the host and guest operating systems.
- Description: You can add notes to describe the purpose or configuration details of this virtual machine.
- Disk Encryption: This lets you encrypt the virtual hard disk for added security. When enabled, all data stored on the virtual disk is encrypted using a specified encryption algorithm (e.g., AES). You'll need to specify a password that will be required each time the virtual machine starts. This provides protection against unauthorized access to the data, ensuring that sensitive information is safeguarded even if the virtual disk file is accessed outside of VirtualBox. Note that disk encryption may have an impact on performance, depending on the encryption algorithm and the resources available.
2. System
This section is all about the hardware configuration of the virtual machine.
- Motherboard: Allows you to configure the base memory (RAM), and select the boot order. It also has settings for chipset (e.g., PIIX3, ICH9), TPM (Trusted Platform Module), and pointing device type.
-
Chipset: Defines the type of motherboard controller used by the VM. Note that this refers to the virtual motherboard emulated by VirtualBox, which influences how the virtual machine interacts with the virtual hardware.
- PIIX3: Suitable for older guest OS versions, such as Windows XP or older Linux distributions. It provides basic functionality but lacks modern features. Use PIIX3 when compatibility with legacy systems is required, or when running older operating systems with lower resource needs.
- ICH9: A modern chipset that provides advanced features like PCI Express support and multiple CPU support, making it suitable for modern operating systems like Windows 10 and newer Linux distributions. Use ICH9 when better performance, support for modern hardware, or advanced features are required.
-
TPM: Enables the use of a Trusted Platform Module, which is a hardware-based security feature useful for running modern operating systems that require secure boot or encryption, such as Windows 11.
- TPM 1.2: The first widely adopted version of TPM. It provides basic security features, such as key generation and storage, and is supported by older operating systems.
- TPM 2.0: The latest version of TPM, offering enhanced security features and better cryptographic algorithms. TPM 2.0 is required for newer operating systems like Windows 11 and provides improved compatibility and performance compared to TPM 1.2.
-
Pointing Device: Select the type of pointing device for the VM. This controls how input devices such as a mouse or trackpad are emulated for the guest operating system, affecting compatibility and the precision of input handling.
- PS/2 Mouse: Emulates a traditional PS/2 mouse, which is suitable for older operating systems that do not support USB devices natively. It is also useful for maintaining compatibility with legacy guest OS environments.
- USB Tablet: Emulates a USB tablet device, providing better integration and smoother mouse movement, particularly for modern operating systems. It allows for absolute pointing instead of relative movement, which reduces the need for manual mouse capture in the VM window.
- Multi-Touch Tablet: Emulates a multi-touch input device, enabling touch gestures in the guest OS. This option is ideal for operating systems that support multi-touch gestures, allowing for enhanced usability and interaction within the virtual machine.
-
Extended Features:
- Enable I/O APIC: Allows the virtual machine to use an I/O Advanced Programmable Interrupt Controller. The I/O APIC is a hardware component that manages interrupts between the CPU and peripheral devices, distributing them more effectively compared to a traditional Programmable Interrupt Controller (PIC). It allows multiple devices to send interrupts simultaneously, enabling better multitasking and improved system stability, especially in multi-processor (SMP) systems. This helps optimize how the CPU handles requests from hardware, which is critical for ensuring efficient performance in modern operating systems that rely on advanced interrupt distribution to efficiently manage hardware resources, especially in multi-threaded environments.
- Enable Hardware Clock in UTC Time: Configures the VM to use the hardware clock in UTC. This is useful when running cross-platform VMs to avoid time discrepancies between host and guest.
-
Enable EFI (special OSes only): Enables Extensible Firmware Interface (EFI) instead of the traditional BIOS. EFI and Unified Extensible Firmware Interface (UEFI) are firmware interfaces that provide a modern replacement for the older BIOS. While EFI was the initial specification developed by Intel, UEFI is its successor and has become the standardized version with additional features and widespread adoption. Enabling EFI/UEFI is required for some modern operating systems and provides support for larger drives, secure boot, and more advanced hardware initialization.
-
EFI and UEFI:
EFI (Extensible Firmware Interface) and UEFI (Unified Extensible Firmware Interface) are both modern replacements for the older BIOS firmware interface. They provide a way for the firmware to interact with the operating system and manage hardware initialization when the computer is powered on.
- EFI: Initially developed by Intel, EFI was designed to address the limitations of the traditional BIOS, providing better support for larger drives, more sophisticated boot management, and improved system initialization. However, EFI remained a proprietary specification.
- UEFI: UEFI is the successor to EFI and was developed as an open, standardized version. It includes all of EFI's features along with several additional enhancements, such as improved driver support, security features like Secure Boot, and a more user-friendly interface. UEFI has become the standard firmware interface for modern systems, providing a more versatile and robust solution compared to both BIOS and EFI.
- EFI: Initially developed by Intel, EFI was designed to address the limitations of the traditional BIOS, providing better support for larger drives, more sophisticated boot management, and improved system initialization. However, EFI remained a proprietary specification.
-
-
Enable Secure Boot: Allows the VM to use Secure Boot, a feature of EFI that helps ensure that only trusted software is loaded during the boot process, adding an extra layer of security.
- How Secure Boot Detects Trusted Devices: Secure Boot works by maintaining a database of trusted digital signatures for software and hardware components. When the system starts, Secure Boot checks each piece of software, including bootloaders and drivers, against this database. If the digital signature of the component matches one in the trusted database, the component is allowed to load. Otherwise, it is blocked to prevent unauthorized or potentially malicious software from running. This process helps ensure that only trusted and verified software can interact with the system during startup.
- Processor: Configures the number of CPU cores assigned to the virtual machine and lets you enable PAE/NX (Physical Address Extension/No eXecute). PAE allows 32-bit operating systems to access more than 4 GB of RAM, which is useful for some Linux distributions and other memory-intensive applications. NX helps prevent certain types of malicious attacks by marking areas of memory as non-executable. You can also enable Nested VT-x/AMD-V, which allows the virtual machine to run nested virtual machines if the host CPU supports hardware virtualization. This is particularly useful for testing or learning virtualization technologies within a VM. You can also configure execution cap, which limits the percentage of CPU the VM can use.
- Acceleration: Here, you can enable VT-x/AMD-V or Nested Paging if your host CPU supports it, which helps improve virtualization performance.
3. Display
This section handles the virtual display hardware.
- Screen: Configures the video memory available to the VM, and you can also enable 3D or 2D acceleration to improve graphical performance. The monitor count setting lets you set up multiple virtual displays.
- Remote Display: This allows you to configure a remote display server so that you can access the VM from another device. You can set the server port and authentication method here.
- Recording: If you want to record the VM's display, this is where you set it up. You can choose the recording format, frame rate, and storage location for recorded video.
4. Storage
Storage is where you define the virtual machine's disk settings. In the context of VirtualBox, a controller is a virtual representation of the physical interface used to manage storage devices. In physical computers, a controller is an actual hardware component that connects to the motherboard and manages data flow between the storage devices (e.g., hard drives, SSDs) and the computer. VirtualBox emulates this hardware in software, allowing the virtual machine to simulate different types of storage controllers (e.g., IDE, SATA, SCSI, NVMe). Each type has different properties that affect compatibility, performance, and feature support, similar to how physical controllers interact with storage on a real motherboard.
-
Controller Setup: VirtualBox supports multiple types of controllers like IDE, SATA, SCSI, or NVMe. You can add hard disks or optical drives to these controllers.
- Different types of controllers have unique properties and use cases:
- IDE: Suitable for older operating systems that do not require high performance.
- SATA: A widely used controller that offers better performance than IDE and supports modern operating systems.
- AHCI (SATA): Provides advanced features like hot-plugging and native command queuing, improving SATA device performance.
- PIIX4 (Default IDE): Default IDE controller used for older guest operating systems.
- PIIX3 (IDE): Another IDE controller option, similar to PIIX4, often used for compatibility with legacy systems.
- ICH6 (IDE): An IDE controller that provides improved compatibility and performance for certain guest systems.
- LsiLogic (Default SCSI): Default SCSI controller that offers good performance for SCSI devices.
- BusLogic (SCSI): An older SCSI controller, sometimes needed for compatibility with certain guest operating systems.
- LsiLogic SAS (SAS): Provides support for Serial Attached SCSI devices, offering better speed and features compared to traditional SCSI.
- I82078 (Floppy): A controller used for virtual floppy drives, mostly needed for older software installations.
- USB: Allows virtual machines to connect to USB storage devices, providing flexibility for removable storage.
- NVMe (PCIe): Provides high-speed storage access via PCI Express, suitable for modern high-performance applications.
- virtio-scsi: A paravirtualized controller that offers improved performance in virtualized environments, often used with Linux guests for better disk I/O performance.
- Different types of controllers have unique properties and use cases:
-
Attributes: This section shows attributes related to the virtual disk, such as the solid-state drive (SSD) option or hot-plugging support.
-
Virtual Disk Details: Here, you can add or modify virtual hard disks (e.g., VDI, VMDK) or connect an ISO file to an optical drive. You can also configure the storage type (dynamically allocated or fixed size).
5. Audio
The Audio section allows you to configure the virtual machine's audio settings.
- Enable Audio: You can enable or disable audio for the virtual machine.
- Audio Driver: Select the host audio driver (e.g., Windows DirectSound, ALSA).
-
Controller: Choose the audio controller type (e.g., Intel HD Audio, ICH AC97, SoundBlaster 16).
- Intel HD Audio: Provides high-definition audio support and is compatible with most modern guest operating systems, offering better sound quality and features.
- ICH AC97: Emulates the AC'97 audio standard, which is suitable for older operating systems that may not support Intel HD Audio.
- SoundBlaster 16: Emulates the classic SoundBlaster 16 audio card, which is often used for compatibility with older DOS or Windows operating systems and provides basic audio capabilities.
6. Network
This section configures the network settings of the virtual machine.
-
Adapter: You can enable up to four network adapters per VM. Each adapter can be configured with different modes like NAT, Bridged Adapter, Host-Only Adapter, Internal Network, Generic Driver, NAT Network, Cloud Network [EXPERIMENTAL], or Not Attached.
-
NAT: Network Address Translation (NAT) allows the VM to share the host's IP address. This is the simplest way to provide internet access to the VM without needing additional network configuration. The VM appears as if it is behind a router, and the host handles network traffic.
-
Bridged Adapter: This mode connects the VM directly to the physical network, allowing it to obtain its own IP address from the network's DHCP server. This makes the VM appear as a separate device on the same network as the host, suitable for scenarios where the VM needs to be accessible by other devices on the network.
- When choosing the Bridged Adapter mode in VirtualBox, you need to select a network adapter from the host machine that is connected to the network you want the virtual machine to join. Typically, you should select:
- Ethernet Adapter: If the host machine is connected to a wired network, choose the Ethernet adapter. This will make the virtual machine appear as another device on that wired network, and it will receive its own IP address from the network's DHCP server.
- Wi-Fi Adapter: If the host is connected through Wi-Fi, choose the corresponding wireless adapter. This allows the virtual machine to communicate on the same wireless network as the host.
- When choosing the Bridged Adapter mode in VirtualBox, you need to select a network adapter from the host machine that is connected to the network you want the virtual machine to join. Typically, you should select:
-
Host-Only Adapter: Creates a network limited to the host and VM, without external network access. This is useful for secure communication between the host and VM without exposing the VM to the broader network or the internet.
-
Internal Network: This mode creates an isolated network between multiple VMs, without any connection to the host or external network. It is ideal for testing scenarios where multiple VMs need to communicate with each other without any outside interference.
-
Generic Driver: Allows custom network interfaces using drivers that are not natively supported by VirtualBox, providing flexibility for advanced network setups.
-
NAT Network: Similar to NAT, but allows multiple VMs to share a private network while still providing internet access through the host. This enables communication between VMs as if they were on the same local network.
-
Cloud Network [EXPERIMENTAL]: Provides connectivity to cloud-based networks, allowing VMs to connect to external cloud services. This feature is still experimental and may require additional setup.
-
Not Attached: Disables the network adapter, meaning the VM will have no network connectivity. This can be useful for isolating the VM completely from any network.
-
- Advanced: Configure additional options like adapter type, MAC address, promiscuous mode, and cable connection status.
-
Port Forwarding: If using NAT, you can set up port forwarding rules to allow external access to services running on the VM. Port forwarding works by mapping a specific port on the host machine to a specific port on the guest VM. To exemplify, consider a scenario where you want to access a web server running on the VM:
- When you enter the host's IP address along with the forwarded port number (e.g.,
http://192.168.1.100:8080
), the request is forwarded to the VM by the NAT service. The host machine listens on port8080
and directs all incoming packets on that port to the VM's IP address and port80
. This way, the host receives incoming packets from external clients, and the NAT service sends these packets to the VM. Similarly, the response packets from the VM are forwarded back to the external clients through the host's IP and port. This effectively makes services running on the VM accessible externally through the host. Port forwarding works by mapping a specific port on the host machine to a specific port on the guest VM. - To configure port forwarding, follow these steps:
- Open the Network settings of the VM and select the adapter configured with NAT.
- Click on Port Forwarding to open the port forwarding settings.
- Add a new rule by specifying the following details:
- Name: Provide a name for the rule (e.g., HTTP, SSH).
- Protocol: Choose the protocol, typically TCP or UDP.
- Host IP: Optionally specify the IP address of the host (leave blank for all interfaces).
- Host Port: Enter the port number on the host that will be used to access the service (e.g., 8080).
- Guest IP: Optionally specify the IP address of the guest (usually left blank to use the default).
- Guest Port: Enter the port number on the guest that is running the service (e.g., 80 for an HTTP server).
- Save the rule and start the VM. Now, when you access the Host IP with the Host Port, the request will be forwarded to the specified Guest Port on the guest VM, allowing external devices to connect to services running inside the VM.
- When you enter the host's IP address along with the forwarded port number (e.g.,
7. Serial Ports
The Serial Ports section allows you to configure virtual serial ports. Serial ports are primarily used for legacy devices or specialized hardware, such as industrial equipment or debugging purposes, which communicate through serial data transmission. In VirtualBox, you can create virtual serial ports to connect the virtual machine to software or physical serial devices on the host..
- Enable Serial Port: You can enable one or more serial ports for the VM.
- Port Mode: Configure the port to work in different modes such as Host Device, Raw File, or TCP.
-
Port Number: Set the I/O Port and IRQ values for the serial port.
- IRQ (Interrupt Request Line) is a hardware signal sent to the CPU, indicating that an event requiring its attention has occurred. In virtual machines, IRQ settings allow the emulation of these signals, enabling the virtual machine to respond to specific events from virtual devices, such as serial ports. For example, an IRQ can be used to notify the CPU when data is ready to be read from a serial port, ensuring efficient and timely processing of data.
8. USB
The USB section handles USB device support for the virtual machine.
-
Enable USB Controller: You can enable USB support and choose between USB 1.1, USB 2.0, or USB 3.0 controllers.
- USB 1.1: This version of USB is suitable for older devices and provides a maximum speed of 12 Mbps. It works well for basic peripherals like keyboards and mice.
- USB 2.0: A more widely adopted version, USB 2.0 offers a significant speed boost of up to 480 Mbps and is compatible with a wide range of devices, such as storage drives, printers, and webcams.
- USB 3.0: The latest version, USB 3.0, provides up to 5 Gbps of data transfer speed, making it ideal for high-speed storage devices and other peripherals requiring fast data transfer rates. It is backward compatible with USB 2.0 and USB 1.1 devices.
- USB Device Filters: You can create filters to automatically connect specific USB devices to the virtual machine when they are plugged in.
9. Shared Folders
The Shared Folders section allows you to share directories between the host and guest.
- Add Shared Folder: You can add shared folders to be accessed by the guest OS. You can specify if the folder is read-only or auto-mount.
- Folder Path: Set the host path of the folder you want to share, and define its folder name within the guest.
10. User Interface
The User Interface section allows you to customize the VirtualBox interface for this virtual machine.
- Mini Toolbar: Configure whether the mini toolbar is shown in full-screen or seamless modes.
- Menu and Status Bar: You can enable or disable elements of the menu bar and status bar for the virtual machine window.