Network Experiment with Three VMWare Nodes on One Machine

21 Sep

Recently I had to set up a network experiment using three nodes, and I had only one machine, and I was able to successfully set this up using three VMs on VMWare Workstation. This is how I did it.

Three VMWare nodes running on one machine. This is the network topology to configure.

I had to set up the following:

  • Content server: public IP address with Apache installed
  • NetServ node: a router with one public IP and one private IP
  • Client: Private IP, connected through the NetServ node gateway

I need the client to access the outside world only through the NetServ router.

First, I downloaded a Fedora 10 VMWare image from thoughtpolice.co.uk and configured it as I needed. Then I made three copies of it.

[Note about clean-start: When copying the VMWare images to create clones, make sure to shutdown the images first before copying. The reason is that when you copy and start the clone, VMWare changes the MAC address and other settings, and you need to clean-start the VM to get the new MAC address and other settings to apply.]

I then created a few virtual network configurations to get my network topology right. A screenshot of the Virtual Network Editor is below.

The Virtual Network Editor showing the three VMNets used in the experiment.

  • I have three physical network adapters. I configured each of them to map to one particular VMNet. VMNet0 is bridged to the first physical adapter (that is my host machine).
    • The two other VMNets – which are bridged to the physical adapters – are the ones used by the public network adapters for the Content Server and the NetServ node.
  • For the private network, I created host-only VMNet with DHCP service, which basically provides a private network.
    • The private network adapter for the NetServ node and the Client are mapped to this VMNet.

Settings for Client VMWare network adapter.

So far, so good. Boot up the nodes and they should get correct IP addresses and:

  • Content Server and Netserv Node can connect to the public Internet.
  • Client can only ping the Netserv node’s private IP address.

Now to get the full network topology working.

For this, we need to allow NetServ node to run as a router and a DNS server. Here is how to do so (all as root):

Now, on the client machine, you need to set up the default gateway to be the NetServ router:

  • route add default gw NETSERV_IP_ADDR eth0

[UPDATE Sep 24 2010] On the client machine, you also need to:

  • sudo vi /etc/resolv.conf

and add the NetServ/gateway machine as the default DNS server.

And that’s it : you should have a complete network topology up and running! Try a few pings and opening a few websites, and it should all work!

Advertisements

One Response to “Network Experiment with Three VMWare Nodes on One Machine”

  1. richhpal November 28, 2010 at 10:43 am #

    Dear sir,
    This is richhpal doing MCA . I am developing a port-scanner in java as a mini project.i m using jpcap library.so please giude me how to configure TCP packet to get responses frm target.
    Thanks
    Richhpal

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: