VMware Cloud Community
vishalkoolkarni
Contributor
Contributor
Jump to solution

Scripted ip and hostname configuration for esxi

Hi Guys,

I have installed an ESXi VM on a base ESXi. Then I have cloned this ESXi VM to create another 40 ESXi VMs on the base.

Now all the other 40 VMs are having the same IP as the ESXi VM I am using for cloning.

Is there a scripted method to set the static IP and hostname for the other 40 ESXi VMs ?.

Or is there a way I can input the IP and hostname for ESXi clones ?

Reply
0 Kudos
1 Solution

Accepted Solutions
jgaddi
VMware Employee
VMware Employee
Jump to solution

That works too but it won't be a good idea to add the host to VC and THEN change the IP There. Since this is a VM, better to open a VI client directly to the "physical" ESX host that has these VMs, open a console and change the IP/hostname using DCUI

View solution in original post

Reply
0 Kudos
9 Replies
jgaddi
VMware Employee
VMware Employee
Jump to solution

problem here is you cannot use a remote script to change the ip since the IPS are all the same for the ESXi clones, and there's no way to push the ip during clone coz putting ESXi in a VM is not even supported. Nevertheless, you best bet is to go thru the DCUI of each ESXi host and changing the IP.

another option is to create an ESXi VM with DHCP, then the cloned VMs will just be set that way and get the IP from ur DHCP server

vishalkoolkarni
Contributor
Contributor
Jump to solution

Thanks for the reply

I am looking at on option of power on ESXi VM one at a time. It will be

then be accessible with the IP got from the ESXi it was clones from.

Then add as a host to a vCenter and then use remote cli to change the IP

and hostname.

Reply
0 Kudos
vishalkoolkarni
Contributor
Contributor
Jump to solution

Thanks for the reply

I am looking at on option of power on ESXi VM one at a time. It will be

then be accessible with the IP got from the ESXi it was clones from.

Then add as a host to a vCenter and then use remote cli to change the IP

and hostname.

Reply
0 Kudos
jgaddi
VMware Employee
VMware Employee
Jump to solution

That works too but it won't be a good idea to add the host to VC and THEN change the IP There. Since this is a VM, better to open a VI client directly to the "physical" ESX host that has these VMs, open a console and change the IP/hostname using DCUI

Reply
0 Kudos
vishalkoolkarni
Contributor
Contributor
Jump to solution

I can do that, but the issue is, we need to automate the whole process.

We are looking at bulk deployment of VM's in terms of 1000 .

Using DCUI for each will be tedious

Reply
0 Kudos
jgaddi
VMware Employee
VMware Employee
Jump to solution

we are talking about 1000 ESXi VMs? well, if that's the case, then you can just run esxcfg-vmknic.pl to add a new vmknic and delete the original to maintain connectivity.

vishalkoolkarni
Contributor
Contributor
Jump to solution

Hi the issue is all these VMs are on a base ESXi server.

So I cannot use the esxcfg-vmknic.pl on the VM.

esxcfg-vmknic.pl can be run only if the ESXi is added as a host to vCenter. Let me describe my setup it in a better way.I have a base ESXi say BESX. on this BESX I have a esxi VM VMESX1. I have cloned this VMESX1 to have more ESX VMs on the BESX.so BESX is the physical ESX having 40 ESXi VMs VMESX1 to VMESX40. and all these 40 VMs are having same IP as VMESX1.I need to assign IP and hostnames to VMESX2 - 40. Can I do this using esxcfg-vmknic.pl ?AFAIK i can use esxcfg-vmknic.pl only for BESX not the ESXi VMs on the BESX.Is there any other way ?

 DHCP is not working unless I manually change the vmnic interface and refresh the network. 

Reply
0 Kudos
vishalkoolkarni
Contributor
Contributor
Jump to solution

Hi the issue is all these VMs are on a base ESXi server.

So I cannot use the esxcfg-vmknic.pl on the VM.

esxcfg-vmknic.pl can be run only if the ESXi is added as a host to vCenter. Let me describe my setup it in a better way.I have a base ESXi say BESX. on this BESX I have a esxi VM VMESX1. I have cloned this VMESX1 to have more ESX VMs on the BESX.so BESX is the physical ESX having 40 ESXi VMs VMESX1 to VMESX40. and all these 40 VMs are having same IP as VMESX1.I need to assign IP and hostnames to VMESX2 - 40. Can I do this using esxcfg-vmknic.pl ?AFAIK i can use esxcfg-vmknic.pl only for BESX not the ESXi VMs on the BESX.Is there any other way ?

 DHCP is not working unless I manually change the vmnic interface and refresh the network. 

Reply
0 Kudos
jgaddi
VMware Employee
VMware Employee
Jump to solution

As I've stated earlier, you cannot change an existing vmknic interface since you will get disconnected. So either you use DHCP to push IPs, or if you are using static, then its using the powercli to change the hostname and ip. Refer to http://www.vmware.com/go/powercli .

Reply
0 Kudos