VMware Networking (3/3)

Dual-Homed Gateway

We ended the first part of the custom configuration tutorial with the creation of a private network with two virtual machines. This private network has no connection to the host. We will now extend this example by adding a virtual machine that will serve as a gateway between the private network and the host. To achieve this this new virtual machine will have two network adapters: one connected to the VMnet2 network and one connected to the VMnet1 network. We have studied the VMnet1 network on a previous page and it has a connection to the host.

We create a new VM called "Gateway1" and select the "Use host-only networking" option as shown in Figure 1. You could actually choose Bridged or NAT if you want. because in this example it's the second network adapter connected to VMnet2 that we care about. If you want the gateway to have access to the Internet or be accessible from other machines than the host you could select Bridged or NAT.

Then we add the second adapter and connect it to the VMnet2 network as shown on Figure 1.

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

We are now ready to install the OS (Ubuntu Desktop 14.04.1 as in all the examples so far). Each adapter will get an IP address from the corresponding DHCP server.

After the OS is installed you can get the IP address assigned to each adapter with ifconfig as shown below.

ifconfig for Gateway1
xavier@Gateway1:~$ ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0c:29:1a:f4:a2  
          inet addr:192.168.232.128  Bcast:192.168.232.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fe1a:f4a2/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:10 errors:0 dropped:0 overruns:0 frame:0
          TX packets:57 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1406 (1.4 KB)  TX bytes:9369 (9.3 KB)

eth1      Link encap:Ethernet  HWaddr 00:0c:29:1a:f4:ac  
          inet addr:192.168.157.138  Bcast:192.168.157.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fe1a:f4ac/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:15 errors:0 dropped:0 overruns:0 frame:0
          TX packets:69 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1826 (1.8 KB)  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:184 errors:0 dropped:0 overruns:0 frame:0
          TX packets:184 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:22314 (22.3 KB)  TX bytes:22314 (22.3 KB)

xavier@Gateway1:~$
Network with dual-homed machine
Figure 2: Network with dual-homed machine

blog comments powered by Disqus

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

Home
Contact Us
Search