Re-assign IP address for VMWare image that is already running

1

I'm using VMWare Player. When an image running CentOS (Linux) 6.5 boots up, VMWare Player assigns an IP address dynamically (probably using DHCP) to that image. I'm assuming the IP address on the subnet is assigned by the VMWare software itself and not by Linux.

Before any image starts up for the first time, from observation I am assuming there really isn't an IP address for that image. A way you can observe this is by making a copy of a VMWare image that has already started up, and start up the copied image on that same workstation (which VMWare Player is installed on).

How can the IP address be re-assigned (either dynamically or statically) for an image in Linux ? If there is a way to do this, I'm assuming there is a step to restart all services (with a reboot).

MacGyver

Posted 2014-05-19T19:33:40.213

Reputation: 892

Please comment on the reason you are suggesting to close before you click the "close" button. Why is this question not related to servers? I'm fine with it being closed, but I am not learning anything here. The same thing happened to thousands of other questions closed by people who have permission to do so. serverfault.com/questions/473736/… – MacGyver – 2014-05-19T20:00:30.703

1VMware Player is a desktop virtualization software. Great for dev environments and for testing one-off things, but it's not a topic appropriate for professional systems administration. That's not to say your question is bad, rather it's just off-topic for Serverfault (which is why it got migrated here). – EEAA – 2014-05-19T20:18:17.403

Answers

1

I am not familiar with VMWare Player in particular, but most DHCP servers assign IP addresses from a pool, and cache which addresses they have given out, along with the corresponding MAC address. If a machine comes up and asks for an IP address later on, it's MAC address is looked up, and if there is a match, the corresponding address is returned, otherwise a new address is taken from the pool. Unused entries are removed after a timeout, the so-called lease time.

VMs have network interfaces with MAC addresses. These are generally randomly generated. When you copy a VM, a new MAC address is assigned to the interface, to avoid collisions on the network. This is why VMWare will ask you if you copied or moved a VM when you import it; if you say you copied it, the MAC address is changed, if you moved it, it isn't.

I don't know how configurable the DHCP server in VMWare Player is. My guess is that it's a closed system and there isn't much you can do. Maybe someone else can prove me wrong or right on that one.

jornane

Posted 2014-05-19T19:33:40.213

Reputation: 977

0

How the IP Address is assigned depends on how the virtual machine (VM) is set up. If you have it set to Bridged, your guest OS (I'm assuming CentOS) requests it through DHCP the same way the host OS does, or else the guest can set one manually. If you have it set to NAT, it gets a random private DHCP address different from your local network (see Nathan C's comment). VMWare Player has little to do really with assigning an IP to a guest Operating System.

In short, what exactly do you need to do? Release and renew the IP? Or something different? The VM needs to be turned off to be able to adjust network settings, by the way.

Joshua Nurczyk

Posted 2014-05-19T19:33:40.213

Reputation: 2 316

Not completely right. In NAT, it gets a random private IP address (I think the 10.0.0.0/8 range). – Nathan C – 2014-05-19T20:13:04.567

Depends on your IP address, I think, now that I look at it – Joshua Nurczyk – 2014-05-19T20:45:56.220

Vmware Player/Workstation runs a DHCP server. The range/scope that is provided is generated at installation time, and the installers will choose ranges somewhat randomly from the private networks, that will not conflict with your current network addressing. You can change the network configuration by opening the VMware Virtual Network Editor tool. – Zoredache – 2014-05-19T20:57:52.783

I was given no networking options when I installed Player a few weeks ago. It doesn't seem to have the Virtual Network Editor Tool either. I know Workstation has the DHCP server among many other upgrades to player. With how NAT works, it has to, but still doesn't do much. – Joshua Nurczyk – 2014-05-19T21:05:08.500