8 Replies Latest reply on Jul 25, 2008 8:45 AM by rolandt

    Changing IP address

    chgarcia Novice

      Would i be able to change the IP address of a VM that is powered off using powershell?

        • 1. Re: Changing IP address
          LucD Guru
          vExpertCommunity WarriorsUser Moderators

          Not that I know of.

          The IP address is defined in the OS that runs on the VM.


          There are ways of changing/defining the IP address but it would always require starting the VM.

          • 2. Re: Changing IP address
            LucD Guru
            Community WarriorsUser ModeratorsvExpert

            Not that I know of.

            The IP address is defined in the OS that runs on the VM.

            It will always require at least starting the VM.





            Message was edited by: LucD

            • 3. Re: Changing IP address


              This is possible, using guest customization. Unfortunately I don't have an example ATM but we're working on one.



              For reference, this is how VMware Site Recovery Manager works. It's not a very pretty process (we'll have a much better one when we hook up VIX a bit more than it is today) but it does work.



              • 4. Re: Changing IP address
                LucD Guru
                vExpertCommunity WarriorsUser Moderators

                Carter, now you made me very curious.

                If that is possible for a powered off guest (Windows or Linux) some of our problems would be solved.


                In fact we have been following a recent discussion on SRM and changing IP addresses on the Dell Inside IT blog.

                It boiled down to this:

                - use a " customization wizard" similar to what we now do when we clone a guest or create a new one from a template

                - but for the actual change (hostname, IP addr...) the guest needs to be powered on


                And during the SRM Deep Dive session last February we got a similar view.

                • 5. Re: Changing IP address
                  chgarcia Novice






                  Thank you very much for all your replies.  I suppose I should tell you all what my reason for asking is.  Basically we are implementing ESX with snapshots in a staging environment.  We dont want to have to manually change every IP ( unfortunately we're using Static addresses ).  In order to automate the method we would like to know of a way to change a VMs IP without turning it on or at least set the network interface, through a script, to DHCP.



                  • 6. Re: Changing IP address





                    I just spoke with someone very knowledgable of SRM and he said we don't have any built in way for doing it with powered off VMs.



                    That being said, you could use a tool like the VDDK to edit the files of an offline VM, which you could use to change Linux IP addresses, and I believe they are also going to add the ability to do this with offline registry hives at some point, which would cover Windows.



                    Obviously this would be rather ugly, but if anyone goes down this route, please let us all know.



                    • 7. Re: Changing IP address

                      There is an entry for this in our FAQ (search for IP address), has anyone tried it?

                      • 8. Re: Changing IP address
                        rolandt Novice


                        I attempted to use the "change IP address in a VM" code snippet from the FAQ unsuccessfully.  After some tweaking here and there I got the got code to execute but it did not change the IP addr.  Since (for this particular situation) all of the VMs that I needed to do this address change in are MS W2K3, as a work-around I am using psexec to remote execute netsh.



                        It would be really nice if the toolkit customization method would really work because I will have to do this same thing with linux VMs very soon.



                        Note, do not know if it had anything to do with the code snippet not working but in this development testbed we do not have any VC OS Customization entries.