from https://www.slyar.com/blog/vmware-bridged-nat-hostonly.html
Vmware在安裝時默認安裝了兩塊虛擬網卡,VMnet1和VMnet8,另外還有VMnet0。這些虛擬網卡的配置都是由Vmware虛擬機自動生成的,一般來說不需要用戶自行設置。
Vmware提供了三種網絡連接模式,分別為
1、bridged(橋接模式):默認使用VMnet0,不提供DHCP服務
在橋接模式下,虛擬機和宿主計算機處於同等地位,虛擬機就像是一台真實主機一樣存在於局域網中。因此在橋接模式下,我們就要像對待其他真實計算機一樣為其配置IP、網關、子網掩碼等等。
當我們可以自由分配局域網IP時,使用橋接模式就可以虛擬出一台真實存在的主機。
2、NAT(網絡地址轉換模式):默認使用VMnet8,提供DHCP服務
在NAT模式下,宿主計算機相當於一台開啟了DHCP功能的路由器,而虛擬機則是內網中的一台真實主機,通過路由器(宿主計算機)DHCP動態獲得網絡參數。因此在NAT模式下,虛擬機可以訪問外部網絡,反之則不行,因為虛擬機屬於內網。
使用NAT模式的方便之處在於,我們不需要做任何網絡設置,只要宿主計算機可以連接到外部網絡,虛擬機也可以。
NAT模式通常也是大學校園網Vmware最普遍采用的連接模式,因為我們一般只能擁有一個外部IP。很顯然,在這種情況下,非常適合使用NAT模式。
3、Host-only(主機模式):默認使用VMnet1,提供DHCP服務
在Host-only模式下,相當於虛擬機通過雙絞線和宿主計算機直連,而宿主計算機不提供任何路由服務。因此在Host-only模式下,虛擬機可以和宿主計算機互相訪問,但是虛擬機無法訪問外部網絡。
當你想組成一個與物理網絡相隔離的虛擬網絡時,無疑非常適合使用Host-only模式。
Host-only only permits network operations with the Host OS.
NAT mode will mask all network activity as if it came from your Host OS, although the VM can access external resources.
Bridged mode replicates another node on the physical network and your VM will receive it's own IP address if DHCP is enabled in the network.
-
Host-Only: The VM will be assigned one IP, but it's only accessible by the box VM is running on. No other computers can access it.
-
NAT: Just like your home network with a wireless router, the VM will be assigned in a separate subnet, like
192.168.6.1
is your host computer, and VM is192.168.6.3
, then your VM can access outside network like your host, but no outside access to your VM directly, it's protected. -
Bridged: Your VM will be in the same network as your host, if your host IP is
172.16.120.45
then your VM will be like172.16.120.50
. It can be accessed by all computers in your host network.