This procedure is how to set the IP address in an VMWare ESX 4.x server. We compiled this information from multiple sources, and even had to correct the procedure from what we found on the VMware site!! So frustrating when these things are so poorly documented. This worked for us:
Step 1: Changing settings from the physical or remote console connection
Changing the IP for the Service Console must be done from the physical console. If you make changes through a network connection such as SSH, network connectivity to the Service Console disconnects because the Service Console’s network interface changes.
- Log in to the physical console
- At the prompt, enter the following command: “esxcfg-vswif -l” to view your current IP address settings.
- At the prompt, enter the following command: “esxcfg-vswif -i -n vswif0“, where is the IP address and is the subnet mask.
- Now we must edit two files:
- Open the /etc/hosts file with a text editor (we used VI – so we entered “vi /etc/hosts” on the command line) and modify it so that it reflects the new/correct IP address. You should have “127.0.0.1 localhost” on the first line and “::1 localhost” on the second line. Add “a.b.c.d newhostname” where a.b.c.d is your new IP address and use your preferred host name in place of newhostname. Save the file (:wq in the VI editor).
- Open the /etc/sysconfig/network file in an editor, change the HOSTNAME parameter to the same name you used, and either change or add the default GATEWAY address. If it missing, simply add a line at the end of the file “GATEWAY=w.x.y.z” (where w.x.y.z is the default gateway IP address).
- Now let’s restart the network services so we can do step 2 below by entering “service network restart” at the command line. After step 2, a hard reset will actually put everything in place, so even though you restart the network service, you will still be unable to connect to the new IP with the VSphere Client.
Step 2: Generating new certificates for the ESX host
The ESX host generates certificates the first time the system is started. Under certain circumstances, it might be required to force the host to generate new certificates. Typically new certificates only need to be generated if the hostname has been changed or the certificates have been deleted accidentally.
Each time you restart the vmware-hostd process, the mgmt-vmware script searches for existing certificate files (rui.crt and rui.key). If the files cannot be found, new certificate files are generated.
- In the directory /etc/vmware/ssl, back up any existing certificates by renaming them with these commands:
- mv /etc/vmware/ssl/rui.crt /etc/vmware/ssl/orig.rui.crt
- mv /etc/vmware/ssl/rui.key /etc/vmware/ssl/orig.rui.key
- Restart the vmware-hostd process with the command: “service mgmt-vmware restart”. This will generate new certificates based on the new IP address.
- Confirm that the ESX host successfully generated new certificates by running this command and comparing the time stamps of the new certificate files with orig.rui.crt and orig.rui.key: “ls -la /etc/vmware/ssl/rui*“
You should be good. Do a hard reset of the server, and the new hostname and IP address should be in place.