Setting a new or Static IP in ESX VM Server

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.
 
  1. Log in to the physical console
  2. At the prompt, enter the following command: “esxcfg-vswif -l” to view your current IP address settings.
  3. At the prompt, enter the following command: “esxcfg-vswif -i -n vswif0“, where is the IP address and is the subnet mask.
  4. Now we must edit two files:
    1. 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).
    2. 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).
  5. 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.
  1. In the directory /etc/vmware/ssl, back up any existing certificates by renaming them with these commands:
    1. mv /etc/vmware/ssl/rui.crt /etc/vmware/ssl/orig.rui.crt
    2. mv /etc/vmware/ssl/rui.key /etc/vmware/ssl/orig.rui.key
  2. Restart the vmware-hostd process with the command: “service mgmt-vmware restart”.  This will generate new certificates based on the new IP address.
  3. 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.

 

Leave a Comment

Contact Us Here


Please verify.
Validation complete :)
Validation failed :(
 
Your contact request has been received. We usually respond within an hour, but please be patient. We will get back to you very soon.
Scroll to Top