Assigning IP addresses to multiple VMs that are regularly powered off and on

1

1

I have a newbie networking question. In my office there are about 200 machines on 192.168.0.x IPs. At home I have a similar setup but with far fewer IPs. I run 5 virtual machines on my local machine and I have given them all 192.168.0.x IPs too but this seems wasteful because they only ever need to talk to one another. The default gateway is 192.168.0.1. Should I give my VMs IPs of 192.168.100.x ? 192.168.122.x ? What's so special about having VMs on 192.168.100.x / 192.168.122.x IPs ? If this is the right thing to do, what should the default gateway be set to ? I assume that if I have a VM with a 192.168.100.x address when it won't be able to use the 192.168.0.1 gateway ? Many thanks.

ale

Posted 2012-10-02T12:03:39.293

Reputation: 115

1There's nothing particularly special about the third octet of the address, whether it's 0, 1, 100, 122, or what-have-you; as long as the gateway and the machines are all on the same subnet, it'll work.

The default gateway can be whatever you like, but using 192.168.x.1 is typical -- if the VMs are on 192.168.100.x, then the gateway must be 192.168.100.something, and ideally will be 192.168.100.1.

Best way to do this would be with your VM host's NAT. Please identify your VM host (VirtualBox, VMware, &c., &c.) and I'll see if I can offer more specific advice on how to set that up. – Aaron Miller – 2012-10-02T12:37:29.657

@Aaron Miller Thank you. I'm using VirtualBox.. I'll experiment now after reading your tips +1. – ale – 2012-10-03T07:56:43.407

Answers

1

  1. If you ever decide to make a tunnel from your home to your office then better change all 192.168.0.x addresses on your home network to, say, 192.168.1.x. This will eliminate routing problems when tunnel is active.

  2. There is not very much special on using 192.168.100.x or whatever different subnet for your VM's. You have to set up the address within the same subnet to the VM host's virtual interface that is used to communicate with VM. you need to tell VM that its default router is this address.You need to tell the other machines on your LAN that this subnet is reachable through this hosts by setting appropriate routes.

The answer to your last question: Yes, your assumption is correct. See the point 2) in my answer how to solve it

Serge

Posted 2012-10-02T12:03:39.293

Reputation: 2 585