寵物展會(huì)2025年時(shí)間表
1074
2022-05-29
區(qū)別:
NAT模式下,虛擬機(jī)仍然可以訪問網(wǎng)絡(luò),但是從網(wǎng)絡(luò)接收者的眼中看來,這些網(wǎng)絡(luò)請求都來自宿主機(jī),而感知不到虛擬機(jī)。外網(wǎng)也無法訪問虛擬機(jī)網(wǎng)絡(luò)。虛擬機(jī)和宿主機(jī)器的IP地址在不同的子網(wǎng),比如192.168.1.1和192.168.1.2。
幫助文檔提到,如果你只是想單純的在虛擬機(jī)里訪問網(wǎng)絡(luò),使用NAT足夠了。
Host-Only: 虛擬機(jī)仍然被分配一個(gè)IP地址,但是只有在虛擬機(jī)運(yùn)行的環(huán)境里可以訪問這個(gè)IP地址。該地址對外界不可見。
Bridged:虛擬機(jī)有獨(dú)立的IP地址,能被網(wǎng)絡(luò)上其他主機(jī)訪問。
VirtualBox的幫助文檔:
https://www.virtualbox.org/manual/ch06.html
VirtualBox可以虛擬化以下六種物理網(wǎng)卡:
VirtualBox官網(wǎng)有個(gè)表格,非常清晰地展示了幾種網(wǎng)絡(luò)模式的區(qū)別:
第一列VM <-> Host: 表明虛擬機(jī)和宿主機(jī)是否可以通過網(wǎng)絡(luò)互相訪問。
第二列VM1 <-> VM2: 表明虛擬機(jī)之前是否能夠通過網(wǎng)絡(luò)相互訪問
第三列VM -> Internet: 虛擬機(jī)是否可以訪問網(wǎng)絡(luò)
第四列VM <- Internet: 網(wǎng)絡(luò)是否可以訪問虛擬機(jī)
我在啟動(dòng)minikube時(shí),遇到如下錯(cuò)誤消息:
Starting local Kubernetes v1.10.0 cluster…
Starting VM…
E1010 03:27:37.920050 4827 start.go:174] Error starting host: Error creating host: Error executing step: Running precreate checks.
: We support Virtualbox starting with version 5. Your VirtualBox install is “WARNING: The vboxdrv kernel module is not loaded. Either there is no module available for the current kernel (3.10.0-862.11.6.el7.x86_64) or it failed to load. Please recompile the kernel module and install it by sudo /sbin/vboxconfig You will not be able to start VMs until this problem is fixed. 5.2.18r124319”. Please upgrade at https://www.virtualbox.org.
Retrying.
E1010 03:27:37.921090 4827 start.go:180] Error starting host: Error creating host: Error executing step: Running precreate checks.
: We support Virtualbox starting with version 5. Your VirtualBox install is “WARNING: The vboxdrv kernel module is not loaded. Either there is no module available for the current kernel (3.10.0-862.11.6.el7.x86_64) or it failed to load. Please recompile the kernel module and install it by sudo /sbin/vboxconfig You will not be able to start VMs until this problem is fixed. 5.2.18r124319”. Please upgrade at https://www.virtualbox.org
核心是這個(gè)錯(cuò):
The vboxdrv kernel module is not loaded.
執(zhí)行命令行:
rcvboxdrv setup
結(jié)果:
vboxdrv.sh: Stopping VirtualBox services.
vboxdrv.sh: Starting VirtualBox services.
vboxdrv.sh: Building VirtualBox kernel modules.
This system is currently not set up to build kernel modules.
Please install the gcc make perl packages from your distribution.
Please install the Linux kernel “header” files matching the current kernel
for adding new hardware support to the system.
The distribution packages containing the headers are probably:
kernel-devel kernel-devel-3.10.0-862.11.6.el7.x86_64
解決方案:
1. 按照這篇文章的介紹安裝gcc make perl package:
2. 安裝kernel header文件。參考:
3. 執(zhí)行命令行:
rcvboxdrv setup
確保看到消息:
vboxdrv.sh: Building VirtualBox kernel modules.
這個(gè)vboxdrv的作用,VirtualBox的幫助文檔寫的很清楚:
In order to run other operating systems in virtual machines alongside your main operating system, VirtualBox needs to integrate very tightly into the system. To do this it installs a “driver” module called vboxdrv which does a lot of that work into the system kernel, which is the part of the operating system which controls your processor and physical hardware. Without this kernel module, you can still use the VirtualBox manager to configure virtual machines, but they will not start.
我簡單翻譯一下:
為了在宿主機(jī)里以虛擬機(jī)的方式運(yùn)行其他類型的操作系統(tǒng),VirtualBox需要和宿主機(jī)操作系統(tǒng)的Kernel交互,進(jìn)行交互的模塊就稱為vboxdrv驅(qū)動(dòng),它本身也是操作系統(tǒng)的一部分,負(fù)責(zé)控制操作系統(tǒng)的CPU和其他硬件資源。如果沒有vboxdrv驅(qū)動(dòng),我們雖然仍舊可以使用VirtualBox manager來管理虛擬機(jī),但無法在宿主系統(tǒng)上啟動(dòng)這些虛擬機(jī)。
rcvboxdrv setup執(zhí)行后問題解決。
要獲取更多Jerry的原創(chuàng)文章,請關(guān)注公眾號"汪子熙".
NAT NAT網(wǎng)關(guān) NAT 虛擬化
版權(quán)聲明:本文內(nèi)容由網(wǎng)絡(luò)用戶投稿,版權(quán)歸原作者所有,本站不擁有其著作權(quán),亦不承擔(dān)相應(yīng)法律責(zé)任。如果您發(fā)現(xiàn)本站中有涉嫌抄襲或描述失實(shí)的內(nèi)容,請聯(lián)系我們jiasou666@gmail.com 處理,核實(shí)后本網(wǎng)站將在24小時(shí)內(nèi)刪除侵權(quán)內(nèi)容。