Monday, May 2, 2011

Changing the IP address, default gateway, and hostname in ESX

Changing settings from the physical or remote console connection
Changing the IP for the Service Console must be done from the physical console or through a remote console session. 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. Run this command to set the IP address:

    [root@server root]# esxcfg-vswif -i <a.b.c.d> -n <w.x.y.z> vswif0 , where <a.b.c.d> is the IP address and <w.x.y.z> is the subnet mask.

    Note: In this example, v swif0 is the Service Console adapter that is the interface to which you are applying the IP address change.

  2. Open the /etc/hosts file with a text editor and modify it so that it reflects the correct IP address and hostname.
  3. To change the default gateway address and the hostname, edit the /etc/sysconfig/network file and change the GATEWAY and HOSTNAME parameters to the proper values.
  4. For the changes to take place, reboot the host or restart the network service with the command:

    [root@server root]# service network restart

    Note: This command breaks any current network connections to the Service Console.

Changing the hostname without rebooting

To dynamically change the hostname, run the command:
[root@server root]# hostname newname

Note: This command creates a temporary hostname change. This change is lost when the system is rebooted.
Changing the DNS server settings
To change the DNS server settings, update the nameserver IPs and search domain the /etc/resolv.conf file.
Changing settings in VMware vSphere or Infrastructure Client
To change the hostname, domain, DNS servers, and default gateway in VMware vSphere or Infrastructure Client:
  1. Highlight the ESX host and click the Configuration tab.
  2. Click DNS and Routing.
  3. Click Properties.
  4. To change the hostname, domain, and DNS servers, click the DNS Configuration tab and enter the appropriate values.

    Note: Disable VMware High Availability if you do not want virtual machines to failover during the hostname IP change.

  5. To change the default gateway, click the Routing tab and enter the appropriate value.
  6. Reboot the ESX host for the changes to take effect.
  7. Reconnect the ESX host to vCenter Server with the new IP address. 
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..
To generate new certificates:
  1. In the directory /etc/vmware/ssl, back up any existing certificates by renaming them with these commands:

    root@server root]# mv /etc/vmware/ssl/rui.crt /etc/vmware/ssl/orig.rui.crt
    [root@server root]# mv /etc/vmware/ssl/rui.key /etc/vmware/ssl/orig.rui.key

    Note: If you are regenerating certificates because you accidentally deleted them, you do not have to rename them.

  2. Restart the vmware-hostd process with the command:

    [root@server root]# service mgmt-vmware restart

  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:

    [root@server root]# ls -la /etc/vmware/ssl/rui*

No comments: