пятница, 27 ноября 2009 г.

Virtual LAN with Sun VirtualBox


Some time ago I had to get myself acquainted with Sun Grid Engine, which is a distributed computing support system. The only computer I had was a laptop, while to accomplish the task of installing Grid Engine there were needed at least two networked computers - with three or more being desirable. So sprang the decision to use the network of virtual machines.

I use Sun VirtualBox 3.0 as a virtualization software. The host operating system is Windows Vista. There were created 3 virtual machines with Ubuntu 9.10 installed on each. After the  installing of an OS one also has to install guest additions.
It's worth noting that in order to simultaneously run all machines one should consider the RAM size. Initially the laptop had 1 Gb. Even single virtual machine ran really slowly. After adding 2 more gygabytes the performance impoved and there were no problems since.

So in order to create a local area network between virtual machines you've got to perform the following steps:

  1. Choose the page Network in the Settings... dialog.
  2. Enable Adapter 1. Adapter type can be left untouched. Pick the NAT option in the Attached to box. This network adapter will be used to access the Internet.
  3. Enable Adapter 2. Adapter type can stay unchanged too. The Internal network option must be chosen in the Attached to box. The value of the Name field must be the same on all virtual machines. It is this network interface that will be used to connect to the virtual LAN.
  4. Run the virtual machine.
  5. Add the following lines into /etc/network/interfaces file (you should use different ip addresses for different machines):

    auto eth0
    iface eth0 inet dhcp

    auto eth1
    iface eth1 inet static
        address 192.168.0.1
        netmask 255.255.255.0
        network 192.168.0.0
        broadcast 192.168.0.255


    The first part specifies that the eth0 interface address must be obtained using DHCP. This is necessary to access the Internet.
    The second part indicates that the eth1 interface will use a static address and provides all the necessary information. IP address must be unique on every VM.
  6. Restart the networking daemon with command

    sudo /etc/init.d/networking restart

After the successful completion of the above steps all virtual machines should ping each other. The access to the Internet should also be present.

Комментариев нет:

Отправить комментарий