2

I have a few VMs which I want to keep with static IP addresses. However, I run those on my laptop and frequently connect to different networks which use different default gateway and different DNS server addresses.

Is it possible to use DHCP to obtain default gateway and DNS server information, but ignore the IP address so it stays fixed?

Otherwise I need to change the gateway and DNS servers manually every time it doesn't work...

I'm using a Windows 8.1 host, with VMware Workstation 10, Ubuntu 12.04 VMs and bridged networking.

Thank you!

Eduardo

2
  • you could probably script something with dhclient
    – MaQleod
    Commented Feb 24, 2014 at 6:12
  • So for example: Your local IP is 10.0.0.5 right now and you want to keep that local IP across all your networks? Is that what you mean? So are the different networks all in the same LAN? e.g. you have 3 routers, with one main one connected to your modem/ISP and then two for bridging that are connected to your main router.
    – cbalos
    Commented Feb 24, 2014 at 6:22

1 Answer 1

1

The only practical solution here is to use NAT for the VMs instead of bridged networking.

The problem with keeping the IP address on different networks is that the IP address ranges in different networks are often different.

For example, in network A you get IP address 192.168.15.200, the default gateway is 192.168.15.1 and the subnet mask is 255.255.255.0

In network B, you get IP address 192.168.10.15, and its default gateway is 192.168.10.1, subnet mask 255.255.255.0.

Now, if you only set up default gateway and DNS addresses for network B, you will have no connectivity at all, since your IP address is from different subnet than is used in network B.

You must log in to answer this question.

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