-->
Showing posts with label create virtual switch. Show all posts
Showing posts with label create virtual switch. Show all posts

Saturday, February 16, 2019

VMware Workstation Pro 15] 9. Configuring Virtual Networks


Hello, guys. You will figure out how to configure virtual networks in this post. When you finish this practice, you will be able to configure your virtual networks in VMware Workstation Pro.

Virtual Networking Components

VMware Workstation Pro provides virtual networking components for network communication. You can use them to create a variety of network environments for virtual machine-to-machine or virtual machine-to-host communication.

Virtual Network Adapter

Imagine how a computer communicates with another one or with an external network. If you look at the computer, there is a communication device, which is the network adapter. It is connected with an L2 switch. If you use a computer at home, perhaps the IP Router is connected to your computer.

A Virtual machine also has a communication device, which is the virtual network adapter. It works just like a physical adapter. You can add up to 10 virtual network adapters to a virtual machine. Where is the virtual network adapter connected? This is connected to the virtual switch. Or it's called a virtual network.


Virtual Switch

It works like a physical L2 switch. Typically, a switch is used to construct a small network, while a virtual switch is used to connect virtual machines. Of course, they are connected by software. If the host operating system is Windows, up to 20 virtual switches can be created. On Linux, you can create up to 256 virtual switches.

There are four types of virtual switches: Bridged, NAT, Host-Only, and Custom.

The Bridged type is connected to the same physical network that your host computer is connected to. If you look at the picture below, you can understand it in no time.


The Custom type is used to construct an isolated network. Alternatively, you can create virtual machines with router functionality to connect to another virtual switch. It can also be used to configure the environment for network firewall testing.


The Host-Only type is also used to construct an isolated network. But a host can communicate with a virtual machine because a host virtual adapter is created when a virtual switch is created.



The NAT(Network Address Translation) technology is an IP address remapping technology that allows multiple hosts to communicate the Internet by sharing one public IP. The NAT Device allows communicating one or more virtual machines connected to the NAT type virtual switch to an external network. The NAT device is implemented as a program and operates as a process as shown below.




Here is the result of the command executed on Linux.

root@vt01:~# pgrep -l natd
2568 vmnet-natd
root@vt01:~# lsof -p 2568
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/111/gvfs
      Output information may be incomplete.
COMMAND    PID USER   FD      TYPE             DEVICE SIZE/OFF      NODE NAME
vmnet-nat 2568 root  cwd       DIR              252,0     4096        96 /
vmnet-nat 2568 root  rtd       DIR              252,0     4096        96 /
vmnet-nat 2568 root  txt       REG              252,0   888632    546525 /usr/bin/vmnet-natd
vmnet-nat 2568 root  mem       REG              252,0  1868984 134809874 /lib/x86_64-linux-gnu/libc-2.23.so
vmnet-nat 2568 root  mem       REG              252,0    14608 134809858 /lib/x86_64-linux-gnu/libdl-2.23.so
vmnet-nat 2568 root  mem       REG              252,0   138696 134809658 /lib/x86_64-linux-gnu/libpthread-2.23.so
vmnet-nat 2568 root  mem       REG              252,0   101200 134809864 /lib/x86_64-linux-gnu/libresolv-2.23.so
vmnet-nat 2568 root  mem       REG              252,0    31712 134809661 /lib/x86_64-linux-gnu/librt-2.23.so
vmnet-nat 2568 root  mem       REG              252,0   162632 134809652 /lib/x86_64-linux-gnu/ld-2.23.so
vmnet-nat 2568 root    0r      CHR                1,3      0t0         6 /dev/null
vmnet-nat 2568 root    1w      CHR                1,3      0t0         6 /dev/null
vmnet-nat 2568 root    2w      CHR                1,3      0t0         6 /dev/null
vmnet-nat 2568 root    3u      CHR              119,8      0t0       627 /dev/vmnet8
vmnet-nat 2568 root    4u  netlink                         0t0  75553504 ROUTE
vmnet-nat 2568 root    6u      raw                         0t0  75553518 00000000:0001->00000000:0000 st=07
vmnet-nat 2568 root    7u     unix 0xffff881aa1141c00      0t0  75553519 /var/run/vmnat.2568 type=STREAM

If you are using an IP router, check its Tech specs on the product's website. If you do not know about NAT technology, see the link below.

https://en.wikipedia.org/wiki/Network_address_translation

If the host operating system is Windows, you can create only one NAT virtual switch. On Linux, you can create one or more NAT virtual switches.

All kinds of virtual switches except Bridged can use the DHCP Server function. This allow you to automatically assign an IP address to a virtua machine.

Creating a Virtual Switch

You can use the Virtual Network Editor to create a new virtual switch and modify a created virtual switch.


To create a new virtual switch, click the Change Settings button and select Add Network. Select a network to add and click the OK button.


Set Subnet IP and click the Apply button.


If you want to set the scope of IP addresses to assign automatically, select the DHCP Settings button.


I do not use a local DHCP service and a host virtual adapter. So I create a virtual switch after removing both checkboxes.


Test environment

The virtual network environment I use for VMware Workstation is shown below. Note please. :D


You have acquired the skill to create a virtual switch. I encourage you to practice a few more times to become proficient. In the next post, you will find out how to create a router. See you next. Thank you.