What is the difference between NAT / Bridged / Host-Only networking?

64

47

VMWare: What is NAT vs. Bridged vs. Host-Only?

stevebot

Posted 2010-12-31T00:30:27.923

Reputation: 851

and what is vmnet1 vmnet8 – Kalpesh Soni – 2018-04-26T17:24:41.133

An aspect I looked for in this question/answers was any differences in the OSI network Layers

– humanityANDpeace – 2019-04-09T06:37:14.710

Answers

58

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.

John T

Posted 2010-12-31T00:30:27.923

Reputation: 149 037

1The description of host-only networking in this answer isn't quite accurate and implies that the VM is accessible only by the host OS. See my answer for a more thorough explanation – jamesdlin – 2017-02-20T21:06:10.387

will the VM receive it's own IP address in NAT or Host-only mode? – stevebot – 2010-12-31T00:38:40.597

2It will receive an address, but not from the DHCP server. Likely in a completely different range, and not routable on the current LAN. You will see a virtual adapter on the host OS which will have an address in the same range. – John T – 2010-12-31T00:40:09.300

So if the IP is not from a DHCP server is it static? – stevebot – 2010-12-31T00:44:50.153

I see two vmnet adapters on my host machine (vmnet1 and vmnet8). Which one is my VM? – stevebot – 2010-12-31T00:55:27.440

1Yeap, you got it. – John T – 2010-12-31T00:55:33.743

In bridged mode, vmnet adapter in host machine WILL NOT be used at all ?? – kumar – 2013-11-29T15:33:43.803

45

Same concept as the normal network setup :)

  • 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 is 192.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 like 172.16.120.50. It can be accessed by all computers in your host network.

Spike

Posted 2010-12-31T00:30:27.923

Reputation: 784

1The description of host-only networking in this answer isn't quite accurate and implies that the VM is accessible only by the host OS. See my answer for a more thorough explanation. – jamesdlin – 2017-02-20T21:06:31.550

11

While the other answers here provide good descriptions for the NAT and Bridged modes, their explanations for Host-only mode are not quite accurate.

From VMware's documentation, under Configuring Network Connections > Understanding Common Networking Configurations:

Host-only networking creates a network that is completely contained within the host computer. Host-only networking provides a network connection between the virtual machine and the host system by using a virtual network adapter that is visible on the host operating system.

(Emphasis mine.)

Note that it does not say that the VM will be accessible only by the host. The network is self-contained, not the connection. This is a subtle but important difference.

Additionally, as pointed out by user5389726598465, under Creating Virtual Machines > Preparing to Create a New Virtual Machine > Selecting the Network Connection Type for a Virtual Machine:

With host-only networking, the virtual machine can communicate only with the host system and other virtual machines in the host-only network. Select host-only networking to set up an isolated virtual network.

You should be aware that the Host-only, NAT, and Bridged modes are aliases to specific virtual networking switches ("VMnets") that are preconfigured for the different behaviors. As with a normal network switch, all machines connected to the same switch are visible to each other.

This means that all VMs connected to a host-only network will be visible to the host and to each other. If you want a VM that is visible only to the host, you will need to assign it a dedicated VMnet and avoid assigning any other VMs to that VMnet.

jamesdlin

Posted 2010-12-31T00:30:27.923

Reputation: 1 973

+1 Your answer is correct but the line after your quote in the KB is a better quote: "With host-only networking, the virtual machine can communicate only with the host system and other virtual machines in the host-only network. Select host-only networking to set up an isolated virtual network." – user5389726598465 – 2018-01-17T13:05:09.463

@user5389726598465 I agree that's a better quote, but I don't see that in the VMware Workstation product documentation. (The link I had was broken, but it's fixed now.) If your quote is from a KB article, can you please provide a reference to it? – jamesdlin – 2018-01-17T19:19:43.917

1

Here's the link: https://pubs.vmware.com/workstation-9/index.jsp?topic=%2Fcom.vmware.ws.using.doc%2FGUID-3B504F2F-7A0B-415F-AE01-62363A95D052.html. Unfortunately, the other answers seem reasonable so everyone upvotes them and skip your answer not realizing the VM's can still see e/o.

– user5389726598465 – 2018-01-18T04:17:36.030

10

The below table, from the Virtualbox documentation site, shows the connectivity between VM and Host for different network types:

Overview of Networking Modes

user76705

Posted 2010-12-31T00:30:27.923

Reputation: 201

That's what means, a picture is worth a thousand words – AbdElraouf Sabri – 2018-07-03T17:38:36.810

Can I ask you a little improvement? Can you add a column that explain if VM can access other ip of the host ip network? – realtebo – 2018-08-04T14:18:56.860

The "Internal" row is what you're looking for. From the site mentioned above: "Internal Networking is similar to bridged networking in that the VM can directly communicate with the outside world. However, the "outside world" is limited to other VMs on the same host which connect to the same internal network." – user76705 – 2018-09-20T07:11:08.670

Anyone, in NAT/NAT Network - why can't the guest connect to host? The gateway/router would have to handle it just like accessing any address on the Internet. – samshers – 2019-07-11T22:26:08.420

it looks like "NAT Network" permits both VM <--> HOST ping. Don't understand why the docs says it does not. – samshers – 2019-07-13T13:09:31.807