Virtual Networking in VMware Workstation:
VMware Workstation provides several ways to configure the virtual machine (VM) for virtual networking. Just after installation of VMware Workstation you will find three virtual networks pre-configured by default:
Bridged = VMnet0
NAT = VMnet8
Host-only = VMnet1
We can see and modify these networks by clicking EDIT -> Virtual Network Editor in VMware Workstation
If you choose Bridged Networking your VM will become part of the physical network in which your host (Machine where VMware Workstation is installed) is connected. Even IP address will be configured automatically if there is a DHCP server installed in the network.
NAT (Network Address Translation):
If you want to assign separate private network to your machine that can access the external network, NAT is the right choice. By default VM takes IP from VMware virtual DHCP server created automatically during VMware Workstation installation. However you can disable DHCP server if you want. Actually there is a NAT device that passes network data between virtual machines and the external network. It identifies incoming data packets intended for each virtual machine and sends them to the correct destination.
You can also modify the settings by selecting NAT in Virtual Network Editor like:
- To disable the DHCP just uncheck the checkbox adjacent to “Use local DHCP service to distribute IP address to VMs”.
- To change the network address of internal network only Subnet IP and Subnet mask need to be updated.
- By default IP address x.x.x.1 (In this example 192.168.64.1) will be assigned to host virtual adapter that will be used only to access the VM from host or share the folder from host to VM
- By default IP address x.x.x.2 (In this example 192.168.64.2) address would be assigned as a gateway to all the VMs internal network.
- If you need to set up port forwarding you can click on NAT Setting and click Add it will open a new Map Incoming Port window. Enter the required details and click OK
If you need to isolate your VMs from the external network then select Host-only Network. In this case virtual machines can only connect to its internal network and host that is running VMware Workstation. Virtual machines will not have any access to external network and internet.
Virtual Machine using host-only network by default take IP address from dedicated Host-only Network DHCP server but static IP address can also be assigned.
We can also create custom networks by clicking Add Network then it will create Virtual Network Adapter VMnetX (where X is the number of network adapter) with Host-only type network and DHCP enabled by default. It will also assign a new Class C (/24) IP address pool to the newly created network.
The maximum limit of virtual network is 20 (including 1 Bridge, 1 NAT and 18 Host-only networks) those can be created from VMnet0 to VMnet19. Also we can not create more than one NAT as of VMware Workstation 12 pro.
Private Networks (LAN Segment):
When you need to create some private networks and they do not need to communicate external network, even not to host system, and need to be isolated, you can create LAN segments.
LAN segments allows you to create as many private network as you want and not limited to 20 virtual networks.
To create and assign these networks you need to create VM then go to Virtual Machine’s Setting. Select LAN segment, click on LAN segment button and add the segments by clicking on Add button. After creating the LAN segments, all the segments will show in the LAN segment drop-down list on all the virtual machines and you can assign the segments as per your network design.