Login to participate
Endpoint Management & Virtualization ArticlesRSS

Deep Intro to VMware ESX, Part 5

erikw's picture

When you have your VMware ESX server up and running sometimes you need to change the IP address or other network information on the server. Because it is Linux and there is no GUI to help you, you need to be able to do this by the command line.

This 5th article helps you to replace the IP address and other network information.

This information works on VMware ESX 2.X, 3.X and 4.X.

More information on VMware ESX commands can be found in the previous article Deep intro to VMware ESX, Part 4

Changing the IP settings for the Service Console must be done from the physical console or through a remote console session. If you make these changes through a network connection such as SSH, network connectivity to the Service Console disconnects because the Service Console's network interface changes.

Use the following command to change the settings for the IP address:

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

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

Open the /etc/hosts file with a text editor and modify it so that it reflects the correct IP address and hostname.

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.

To make the changes take place, reboot the host or restart the network service with the command:

[root@server root]# service network restart 

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

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.

An easier way to do it is from within the VMware virtual center or Vmware Virtual Infrastructure client.

Changing settings in VMware Infrastructure Client

To change the hostname, domain, DNS servers, and default gateway in VMware Infrastructure (VI) Client:

  • Highlight the ESX host and click the Configuration tab.
  • Click DNS and Routing.
  • Click Properties.
  • To change the hostname, domain, and DNS servers, click the DNS Configuration tab and enter the appropriate values.

If you have VMware High Availability running, then first disable High Availability if you do not want virtual machines to failover during the hostname IP change.

When machines are going to failover the guests will go to other ESX servers and when they are full, that could cause an cascade of ESX servers go into maintenance.

All the clients and servers will then get transferred to all servers and eventually it will stop your environment.

To change the default gateway, click the Routing tab and enter the appropriate value.

Update the etc/opt/vmware/vpxa/vpxa.cfg file to reflect the new settings.

Reboot the ESX host for the changes to take place.

After the reboot the ESX server will have the new settings and you can continue with what you were used to doing on them.

One big note:

Make sure you do not do this on the VMkernel network interface. Check out if you have the correct interface before you do this.

Most companies have the VMkernel interface on different networks or Vlans, and it could make you're server disappear in the management interfaces and make them unable to do their work in a cluster.

fireeyes's picture

nicee

nice one