The Computer Oracle

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

Become or hire the top 3% of the developers on Toptal https://topt.al/25cXVn

--

Music by Eric Matyas
https://www.soundimage.org
Track title: Light Drops

--

Chapters
00:00 Question
00:20 Accepted answer (Score 104)
00:50 Answer 2 (Score 79)
02:05 Answer 3 (Score 43)
03:26 Answer 4 (Score 25)
05:36 Thank you

--

Full question
https://superuser.com/questions/227505/w...

Answer 2 links:
[Virtualbox Docs: Networking]: https://www.virtualbox.org/manual/ch06.h...
[VBox Docs: Configuring Port Forwarding with NAT]: https://www.virtualbox.org/manual/ch06.h...

Answer 3 links:
[Configuring Network Connections > Understanding Common Networking Configurations]: https://docs.vmware.com/en/VMware-Workst...
[Creating Virtual Machines > Preparing to Create a New Virtual Machine >
Selecting the Network Connection Type for a Virtual Machine]: https://docs.vmware.com/en/VMware-Workst...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#networking #vmware #networkadapter

#avk47



ACCEPTED ANSWER

Score 112


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.




ANSWER 2

Score 81


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.




ANSWER 3

Score 48


The below table shows the connectivity between VM and Host for different network types. Please see Virtualbox Docs: Networking for a brief explanation of the modes.

Overview of Networking Modes

  • '+' means 'yes, this direction of connection-initiation is possible'
  • '-' means 'initiating connections in the direction given in the column title is not possible'

'port forward' means that you'll have to manually add to the host's network configuration instructing it as follows: "whatever connection requests come to this port on your network adapter are actually meant for this port on this VM, so simply forward it there and not to any host-based listener". This makes the hidden NAT IP and port of the VM (on which a VM service is listening) effectively visible on the host adapter and available to receive requests from external entities. See: VBox Docs: Configuring Port Forwarding with NAT for an explanation of how this can be easily done.

See also: Oracle VM VirtualBox: Networking options and how-to manage them, Virtualbox Networks: In Pictures, VirtualBox Network Settings: Complete Guide




ANSWER 4

Score 26


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.




ANSWER 5

Score 3


I installed IIS on virtual machine C1,H1,B1,N1 and Windows 10 on C2,H2,B2,N2. These 6 VM are on my host computer. I have another laptop connected by ethernet cable connected to same router as my host computer. I arranged them in pair of each switch type. I have tried this combination with port forwarding on my home router and on virtual machine N1 using NAT switch. This is what I concluded after trying to access the website on each of the device in network. I also configured my Virtual Network Editor settings to create two subnets 3.3.3.0 for VMnet1 (Host only switch) and 2.2.2.0 for VMnet8 (NAT switch). The settings are as below

enter image description here

Since NAT switch has Virtual Router (2.2.2.2) that also act as (Router + Default gateway + DNS server) for 2.2.2.0 subnet so N1,N2 can access Internet on it. But Host Only switch has no virtual router and default gateway so cannot access internet on H1,H2.

Just to summarize which all device can communicate with each other I have created one diagram for understanding enter image description here