VMware Networking (2/3)

Introduction

On this page we will see how we can define custom networks with VMware Workstation. We will start with a very simple network that we will expand into a fairly complex network with a DMZ separated from the Internet and the internal network by dual-homed gateway firewalls.

No Host Adapter

Private network with one VM

Let's start with defining a guest VM that is connected to its own private network. Unlike the predefined "Host-Only" network the host will not be connected to this network. The VM is therefore totally isolated from the host as far as the network is concerned.

As before we create a new VM and use Ubuntu Desktop 14.04.1 as an example. When presented with the network type choice in the VM creation wizard we select "Do not use a network connection". This will create a VM without any network adapter. We will add the adapter ourselves manually later. Note that we are only creating the VM at the moment. We won't install the OS until after we have added the adapter.

Networking Type Selection Dialog
Figure 1: Networking Type Selection Dialog

Now we need to use the "Virtual Network Editor" to create a new virtual switch to which we will connect the VM to create our private network. From the Virtual Network Editor screen we select the "Add Network..." option and select VMnet2 (or any other unused choice). This is shown in Figure 2.

Add Network Dialog
Figure 2: Add Network Dialog

After we press the OK button the new network is added to the list. By default a host adapter is added and connected to the new switch. Since for this example we do not want the host to be part of the network we untick the "Connect a host virtual adapter to this network" option as shown in Figure 3.

Virtual Network Editor with new VMnet2 network
Figure 3: Virtual Network Editor with new VMnet2 network

Now that we have created the new network we add an adapter connected to VMnet2 to our new VM as shown in Figure 4.

Add Hardware Wizard (Network Adapter)
Figure 4: Add Hardware Wizard (Network Adapter)

The virtual machine is now ready and we proceed with the OS installation. We name this VM NoHost1. The network we created is shown in Figure 5.

Private Network without Host Adapter
Figure 5: Private Network without Host Adapter

Note that in this configuration the VM has no access to any other network (and so can't connect to the Internet for instance).

Private network with two VMs

There is little purpose in having a single machine connected to the network so we'll add a second machine. We create another VM called NoHost2 and connect it to the VMnet2 network. The steps to create NoHost2 are similar to the ones we used to create NoHost1. The updated network layout is shown in Figure 6.

Private Network without Host Adapter
Figure 6: Private Network without Host Adapter

As always we can use ifconfig to get the IP addresses assigned to the VMs by the DHCP server.

ifconfig for NoHost1
xavier@NoHost1:~$ ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0c:29:28:20:36  
          inet addr:192.168.157.128  Bcast:192.168.157.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fe28:2036/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3 errors:0 dropped:0 overruns:0 frame:0
          TX packets:77 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:746 (746.0 B)  TX bytes:10744 (10.7 KB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:178 errors:0 dropped:0 overruns:0 frame:0
          TX packets:178 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:21870 (21.8 KB)  TX bytes:21870 (21.8 KB)

xavier@NoHost1:~$
ifconfig for NoHost2
xavier@NoHost2:~$ ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0c:29:55:69:ad  
          inet addr:192.168.157.129  Bcast:192.168.157.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fe55:69ad/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3 errors:0 dropped:0 overruns:0 frame:0
          TX packets:72 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:746 (746.0 B)  TX bytes:9982 (9.9 KB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:190 errors:0 dropped:0 overruns:0 frame:0
          TX packets:190 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:22710 (22.7 KB)  TX bytes:22710 (22.7 KB)

xavier@NoHost2:~$

As we expect both VMs can connect to eachother since they are on the same private network. We verify this by pinging one from the other as shown below.

ping from NoHost1 to NoHost2
xavier@NoHost1:~$ ping 192.168.157.129
PING 192.168.157.129 (192.168.157.129) 56(84) bytes of data.
64 bytes from 192.168.157.129: icmp_seq=1 ttl=64 time=1.36 ms
64 bytes from 192.168.157.129: icmp_seq=2 ttl=64 time=0.614 ms
64 bytes from 192.168.157.129: icmp_seq=3 ttl=64 time=0.527 ms
^C
--- 192.168.157.129 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2001ms
rtt min/avg/max/mdev = 0.527/0.835/1.366/0.378 ms
xavier@NoHost1:~$
ping from NoHost2 to NoHost1
xavier@NoHost2:~$ ping 192.168.157.128
PING 192.168.157.128 (192.168.157.128) 56(84) bytes of data.
64 bytes from 192.168.157.128: icmp_seq=1 ttl=64 time=2.11 ms
64 bytes from 192.168.157.128: icmp_seq=2 ttl=64 time=0.255 ms
64 bytes from 192.168.157.128: icmp_seq=3 ttl=64 time=0.235 ms
^C
--- 192.168.157.128 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 0.235/0.869/2.119/0.884 ms
xavier@NoHost2:~$

blog comments powered by Disqus

Copyright(c) 2006-2017 Xavier Leclercq | Privacy policy

Home
Contact Us
Search