PowerCLI :  Set IP address of host??


  1. get mac address of vm (powered on or off)
  2. set the mac address manually with vi using command line at /et/sysconfig/network-scripts/ifcfg-eth2
  3. Or use power CLI after powering on VM
  4. Power on vm, 
  5. get ip addrress info.
  6. change ip address 
  7. change <guestvm>.vmx file at
     /vmfs/volumes/datastore3()/vmNAME will be added these lines as:
         
tools.syncTime = "FALSE"
time.synchronize.continue = "0"
time.synchronize.restore = "0"
time.synchronize.resume.disk = "0"
time.synchronize.shrink = "0"
time.synchronize.tools.startup = "0"
time.synchronize.tools.enable = "0"
time.synchronize.resume.host = "0"


                1. Get mac address
                get-networkadapter  -vm fts-vm-stage2
                Name                 Type       NetworkName  MacAddress         WakeOnLan
                                                                                  Enabled
                ----                 ----       -----------  ----------         ---------
                Network adapter 1    Vmxnet3    VM Network   00:50:56:b0:70:34       True

                2. power on vm
                start-vm -vm fts-vm-prod2 -server fts-esxi-c2u2
                3. Get ip address and mask.

                Get-vmguestNetworkInterface -VM fts-vm-prod2 -GuestUser root -GuestPassword xxxxxx


                VM              Name                      IP              IPPolicy   SubnetMask
                --              ----                      --              --------   ----------
                fts-vm-prod2    lo                        127.0.0.1       Unknown    255.0.0.0


                6. change IP addresess (can't bind to eth2  as it was off )
                 Set-VMGuestNetworkInterface -VMGuestNetworkInterface eth2 -GuestUser root -GuestPassword xxxxxxx-Ip 171.69.86.235 -Netmask 255.
                255.254.0 -Gateway 171.69.86.1 -Dns 171.70.168.183,173.36.131.10 

                Popular Posts