4

I'm running a number of virtual machines on a Ubuntu 12.04 host. For various reasons all these VMs need fixed IP addresses. The laptop in question is used for demonstrations -- and this is where the problems arise...

Depending on the circumstances I will either use WiFi or a mobile tether to get an internet connection, which in both cases leads to the laptop being assigned an address via DHCP. Frequently this dynamic address is on a different subnet to the one used by the fixed ones (192.168.0/20). This makes the static addresses unreachable from the host OS.

After some thought, it seems the most elegant solution is to create a separate LAN on the host (for the subnet used by the VMs) and then bridge it to whatever subnet is assigned to the host.

Bear in mind the VM's only need to communicate with each other and the host. They do not need access beyond that.

Questions:

  • is this the best approach?
  • if, it is how could I go about implementing it?

Many thanks.

3 Answers 3

2

If you're using VMware all you need to do is assign these virtual machines to a virtual LAN that has not connection with VMware itself nor the host machine. This is called "LAN segments" and it's easy to find under the Network Interface settings of each machine.

All you have to do is create a new LAN segment for the first machine, then add the other ones to the same network:

enter image description here

This is similar to the host-only network but with the difference that machines can't contact the hosts nor other external networks (Internet) so it's like having a LAN with those machines only. Since there's not a DHCP server in this network, you'll have to add the IP's manually in each system.

If you want them to communicate with the host, you need the host-only setting. In this case, the host will have the lower IP, since it will act as a gateway (but without forwarding packets to other networks).

1
  • I've been using this myself for months in my sysadmin course. Never had a problem (only when I tried bridge mode, sometimes DHCP from a real network fails to assign an IP to the virtual machines). Hope it helps Mar 16, 2014 at 22:11
2

Any type 2 hypervisor will be already having virtual networks of multiple types (bridged, host only, internal network).

Bridged: VM will be attached to your physical NIC as your host do, and will acquire IP from DHCP -if enabled.

Host only: VM can only communicate with HOST and not beyond that (Option should have been enabled when you were installing VMWare Workstation) more details Here

-NAT : VMs will be natted to your host IP and will communicate beyond host through its IP.

0
0

When you install the metapackage apt-get install ubuntu-virt, you'll have a NATed bridge called virbr0 right on your Desktop, which all your KVM Virtual Machines will be attached to, so, I think that this will be enough for you...

You'll probably need the virt-manager too.

4
  • I'm using Vmware Workstation. Does your reply remain valid? Tks.
    – user258959
    Mar 16, 2014 at 21:41
  • I've never used VMWare Workstation before, so, honestly, I don't know but, it probably have a similar setup.
    – ThiagoCMC
    Mar 16, 2014 at 21:47
  • Thanks, Thiago. I think what I'm looking for is something that will create a "virtual" LAN at the OS level, not at the VM level. Then again, I'm very much out of my comfort zone here.
    – user258959
    Mar 16, 2014 at 21:52
  • Okay, no problem... But, just for the record, "ubuntu-virt" metapackage deploys the "virtual LAN" right on O.S., not at the "VM level". ;-)
    – ThiagoCMC
    Mar 16, 2014 at 22:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .