virtualbox 配置记录
网络配置
网络模式 Host-only Internal Bridged NAT 之间的区别
https://www.virtualbox.org/manual/ch06.html
virtualbox 各网络连接方式的访问性如上图所示
vmware和virtualbox的nat网络模式有个很大的区别,在vmware的nat模式下vm能够访问互联网,且host够与vm互通。而virtualbox下host与vm是不通的,需要配置端口转发
网络配置最佳实践
- 如果你希望外网其他机器访问你的虚拟机且能够确保使用某一固定ip不会与他人冲突那么你可以直接使用Bridged模式
- 如果你的虚拟机需要访问外网,但是你的公司对网络访问进行了较强的限制,例如登录认证,ip固定分配等等。你需要使用nat模式,并配置端口转发来实现主机到虚拟机的访问。
- 如果你觉得第2步中的端口转发配置过于麻烦,你还可以使用双网卡配置:NAT(网卡1)+ host-only(网卡2)。通过NAT进行外网访问,通过host-only的ip访问和操作该虚拟机。
移动虚拟机
- 全局设定修改存储路径后
- 移动原存储路径文件到新路径
- 控制-注册 .vbox文件
https://www.jianshu.com/p/a05615d1a17c
安装增强功能 VBoxGuestAdditions
VBoxGuestAdditions类似于vmware的vmware tools
使用 设备-安装增强功能菜单,挂载安装光盘
#安装依赖项
yum install kernel-devel gcc bzip2 tar make elfutils-libelf-devel -y
#挂载光盘
mkdir /mnt/cdrom
mount /dev/cdrom /mnt/cdrom
cd /mnt/cdrom
#安装
sh ./VBoxLinuxAdditions.run
#卸载
sh ./VBoxLinuxAdditions.run uninstall
#如果报错,请依据提示查看log文件,通常为缺少其他依赖
tail /var/log/vboxadd-setup.log
安装提示
[root@vm cdrom]# sh ./VBoxLinuxAdditions.run
Verifying archive integrity... All good.
Uncompressing VirtualBox 6.1.12 Guest Additions for Linux........
VirtualBox Guest Additions installer
Removing installed version 6.1.12 of VirtualBox Guest Additions...
Copying additional installer modules ...
Installing additional modules ...
VirtualBox Guest Additions: Starting.
VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel
modules. This may take a while.
VirtualBox Guest Additions: To build modules for other installed kernels, run
VirtualBox Guest Additions: /sbin/rcvboxadd quicksetup <version>
VirtualBox Guest Additions: or
VirtualBox Guest Additions: /sbin/rcvboxadd quicksetup all
VirtualBox Guest Additions: Building the modules for kernel 4.18.0-193.14.2.el8_2.x86_64.
Before installing the Guest Additions, you will have to prepare your guest system for building external kernel modules. This works similarly as described in Section 2.3.2, “The VirtualBox driver modules”, except that this step must now be performed in your Linux guest instead of on a Linux host system, as described there.
If you suspect that something has gone wrong, check that your guest is set up correctly and try executing the command
rcvboxadd setup
as root.Insert the VBoxGuestAdditions.iso CD file into your Linux guest's virtual CD-ROM drive, exactly the same way as described for a Windows guest in Section 4.2.1.1, “Installation”.
Change to the directory where your CD-ROM drive is mounted and execute as root:
sh ./VBoxLinuxAdditions.run
参考:https://docs.oracle.com/cd/E97728_01/E97727/html/guestadd-install.html#additions-linux
本文采用 知识共享署名 4.0 国际许可协议 进行许可