How to change ESX 4.1i Host IP address

So I had to change the IP address of my ESX hosts running 4.1i and after doing some re-search I managed to achieve that today.

Here is how you do that...

1) First put your ESX Hosts in maintenance mode and disconnect them from Virtualcentre

You need to have physical access to the console so that you can login with the root password and issues some commands.

2) Login with your root password

3) Remove the old IP address by deleting the vswif interface

esxcfg-vswif -d vswif0

4) Create a new vswif interface with the new IP Address

esxcfg-vswif -a vswif0 -p "Service Console" -i <new ip address> -n <subnet mask>

eg: esxcfg-vswif -a vswif0 -p "Service Console" -i -n

5) Update the defauly gateway by modifying the network file

nano /etc/sysconfig/network file

Here you will see an entry for the default gateway, modify it if necessary and then Press "CTRL + O" and "Enter" and then CTRL+X twice.

6) Then you need to restart the network service by saying

service network restart or you can reboot your ESX Hosts as I just did.

7) Then after you connect the host back to Virtualcentre update the DNS and Routing by going to the Configuration tab and clicking on "DNS and Routing"