1、简介
VMware vSphere ESXi6.0常用命令使用,对于一些个人认为比较常用的命令进行总结,如果读者需要了解更多请访问VMware官网下载文档,链接如下:https://www.vmware.com/support/developer/vcli/。
ESXi命令行获取帮助的方法为<命令关键字 --help>,常用的命令一般都是以esxcli开头,如果忘记命令可以使用帮助:esxcli --help;输出如下:
[root@localhost:~] esxcli --help
Usage: esxcli [options] {namespace} {cmd} [cmd options]
Options:
--formatter=FORMATTER
Override the formatter to use for a given command. Available formatter: xml, csv, keyvalue
--debug Enable debug or internal use options
--version Display version information for the script
-?, --help Display usage information for the script
Available Namespaces:
device Device manager commands
elxnet elxnet esxcli functionality
esxcli Commands that operate on the esxcli system itself allowing users to get additional information.
fcoe VMware FCOE commands.
graphics VMware graphics commands.
hardware VMKernel hardware properties and commands for configuring hardware.
iscsi VMware iSCSI commands.
network Operations that pertain to the maintenance of networking on an ESX host. This includes a wide variety of
commands to manipulate virtual networking components (vswitch, portgroup, etc) as well as local host IP, DNS and
general host networking settings.
rdma Operations that pertain to remote direct memory access (RDMA) protocol stack on an ESX host.
sched VMKernel system properties and commands for configuring scheduling related functionality.
software Manage the ESXi software p_w_picpath and packages
storage VMware storage commands.
system VMKernel system properties and commands for configuring properties of the kernel core system and related system
services.
vm A small number of operations that allow a user to Control Virtual Machine operations.
vsan VMware Virtual SAN commands
2、常用命令
1)、vmware -v
查看系统版本,例子:
[root@localhost:~] vmware -v
VMware ESXi 6.0.0 build-3620759
2)、esxcli system version get
查看系统版本包括patch等信息,例子:
[root@localhost:~] esxcli system version get
Product: VMware ESXi
Version: 6.0.0
Build: Releasebuild-3620759
Update: 2
Patch: 34
3)、esxcli system time get
查看系统时间,例子:
[root@localhost:~] esxcli system time get
2016-09-13T02:02:39Z
4)、esxcli system time set
修改系统时间,例子:
Cmd options:
-d|--day= Day
-H|--hour= Hour
-m|--min= Minute
-M|--month= Month
-s|--sec= Second
-y|--year= Year
[root@localhost:~] esxcli system time set -y=2016 -M=9 -d=13 -H=10 -m=9
[root@localhost:~] esxcli system time get
2016-09-13T10:09:27Z
5)、esxcli system maintenanceMode set --enable true/false
ESXi主机进入/退出,维护模式,例子:
[root@localhost:~] esxcli system maintenanceMode set --enable true
[root@localhost:~] esxcli system maintenanceMode get //查看维护模式的状态
Enabled
[root@localhost:~] esxcli system maintenanceMode set --enable false
[root@localhost:~] esxcli system maintenanceMode get
Disabled
[root@localhost:~]
6)、esxcli system shutdown reboot/poweroff
系统重启/关机(必须处于维护模式,否则命令不生效)
7)、esxcli network ip interface ipv4 get
查看接口ipv4地址,例子:
[root@localhost:~] esxcli network ip interface ipv4 get
Name IPv4 Address IPv4 Netmask IPv4 Broadcast Address Type DHCP DNS
vmk0 10.1.98.165 255.255.255.0 10.1.98.255 STATIC false
8)、esxcli network ip route ipv4 list
查看路由表,例子:
[root@localhost:~] esxcli network ip route ipv4 list
Network Netmask Gateway Interface Source
default 0.0.0.0 10.1.98.254 vmk0 MANUAL
10.1.98.0 255.255.255.0 0.0.0.0 vmk0 MANUAL
9)、esxcli network nic list
查看ESXi主机网卡列表(nic)或up-link列表,例子:
[root@localhost:~] esxcli network nic list
Name PCI Device Driver Admin Status Link Status Speed Duplex MAC Address MTU Description
vmnic0 0000:03:00.0 e1000e Up Up 1000 Full 00:50:56:9d:bd:b7 1500 Intel Corporation 82574L Gigabit Network Connection
vmnic1 0000:0b:00.0 e1000e Up Up 1000 Full 00:50:56:9d:7c:7f 1500 Intel Corporation 82574L Gigabit Network Connection
10)、esxcli network nic down/up -n=vmnic1
关闭/打开vmnic1接口
11)、esxcli storage core device list
查看磁盘列表