inleon 2007-11-15 20:03
如何更改Esx的IP地址
Changing the IP and Gateway Address of the Service Console in VI3
Products
VMware ESX Server
Details
This article describes how to change the service console IP address, gateway address and hostname on your ESX Server 3.x host.
Solution
There are two ways you can change the IP address:
From the VI Client
Or, from the Physcial Console Connection
See the following sections for details on each method.
From the VI Client
Using the Virtual Infrastructure Client, the DNS information (Configuration tab > DNS and Routing) can be changed on the fly. Similarly, the gateway address (routing subtab of the DNS and Routing window) and the hostname (DNS Configuration subtab of DNS and Routing) can be changed through the user interface. Hostname and domain changes through the VI Client do not take place until the ESX host is rebooted.
From the Physical Console Connection
Changing the IP for the service console must be done from a physical console connection, either at the host, through a KVM or other remote console connection. If you make changes through a network connection such as SSH, network connectivity to the service console will disconnect because the service console's network interface will change.
For this example, it is assumed that vswif0 is the service console adapter that is the interface to which to apply the IP address change. Running the command
esxcfg-vswif -i x.x.x.x vswif0
will set the IP address to the value substituted for x.x.x.x in the command. You will need to edit the /etc/hosts file and change it so that it reflects the new IP address in use for the service console.
The gateway address and hostname are in /etc/sysconfig/network.
After you edit these files, you must reboot the host or restart the network service using the following command:
service network restart
Note: This command breaks any current network connections to the service console.
You can also dynamically change the host name using the command:
hostname newname
Note: This command creates a temporary host name change. This change is lost when the system is rebooted.
To change the DNS server settings, edit the /etc/resolv.conf file and update the nameserver IPs and search domain if applicable.