Changing the IP address of ESX 3.x
Changing the ip address of your ESX host, or specifically the ip address of the ESX Service Console, can be done on the console using the esxcfg commands. The esxcfg- utilities are the console commands for many ESX configuration options. To see all these commands at the console prompt simply enter “esxcfg-” and hit the tab button.
To change the IP address of the ESX 3.x host, you need to use the esxcfg-vswif command. To see the options and syntax of the esxcfg-vswif command you can enter:
To change the ip address of the ESX host:
First list your vswifs:
We will assume that vswif0 is the ESX console vswif for the rest of this post.
In the command above, the \ in the Service\ Console is deliberate, the -i is the new ip address and the -n is the new netmask.
You now need to change your default gateway, you can do this by editing the network file located at /etc/sysconfig/network. To do this at the command prompt with nano (I am “vi challenged” but you could use vi too):
Using nano, go to the location of the default gateway using the arrow keys and make the change. Hit ctrl + x, say yes when prompted to save and overwrite.
It’s best to restart the ESX host after these changes. Some other things to consider:
- Make sure you’ve updated your DNS A records for all ESX hosts that ip address has changed.
- Make sure you’ve updated the /etc/host files of all ESX hosts to reflect the changed ip addresses.
- Check the Virtual Center Management Server. You will probably have to reconnect the host, or in a worst case scenario remove it from VC and add it again.
- Once the host is connected in Virtual Center you may need to change the vmotion ip address (depending on your network). If so, you can change the ip address and subnet mask using the VI Client from the propoerties of the virtual switch with the VMKernel port group.












I encountered a weird problem this week after changing the IP of the hosts. In the future I will remove the host from virtualcenter before I change the IP… just to be sure.
my problem: http://www.yellow-bricks.com/2008/01/24/clone-and-roll-out-template-fail-with-failed-to-connect-to-host/
A very easy way to change the service console network settings are this two vimsh commands:
/usr/bin/vimsh -n -e “hostsvc/net/dns_set –dns-hostname=$targethostname”
/usr/bin/vimsh -n -e “hostsvc/net/consolevnic_set –ip-address=$targetip –ip-subnet=$targetnetmask vswif0″
Attention: The ip is immediately changed. It’s not a good idea to try this by ssh! The variables $targethostname, $targetip and $targetnetmask have to be defined.
See also this to change vmkernel settings: http://communities.vmware.com/blogs/cleygraf/2008/02/21/script-vimsh-change-ip-of-vmkernel-interface
Excellent information – spent three hours assuming that it was my network integrator’s fault, when actually it was just that I had changed the IP address of the server.
Changing the IP Address is never easy. Changing the machine IP Address may fast. But the problem usually coming from another machine which still configured to connect to old IP Address.
Probably a good idea to put in some info about changing the vlan on which the service console resides. Such a change can also be necessary in big networks where much network traffic is divided by vlan’s? Changing the vlan van be done with th -v switch.
Great post about the changing the Ip-address nice..I knew only how to find ip-address of the website before the i found the ip-address in the site ip-details.com..
I followed the directions. When I use the esxcfg-vswif -l it lists the new IP and subnet mask. I rebooted the server. But on the main screen of my server, it says to connect to the old IP address to manage the server.Any ideas? Thanks.
Greg,
I would start by looking at your /etc/hosts file. My guess would be the old ip address is lingering around in there still. Use the console editor of your choice such as nano or vi. ( >nano /etc/hosts will get you there)