玩龙天子 发表于 2018-6-4 07:27:35

VMware vSphere ESXi6.0常用命令

  1、简介
  VMware vSphere ESXi6.0常用命令使用,对于一些个人认为比较常用的命令进行总结,如果读者需要了解更多请访问VMware官网下载文档,链接如下:https://www.vmware.com/support/developer/vcli/。
  ESXi命令行获取帮助的方法为<命令关键字 --help>,常用的命令一般都是以esxcli开头,如果忘记命令可以使用帮助:esxcli --help;输出如下:

   esxcli --help
  Usage: esxcli {namespace}+ {cmd}
  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 image 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
  查看系统版本,例子:
   vmware -v
  VMware ESXi 6.0.0 build-3620759
  

  2)、esxcli system version get
  查看系统版本包括patch等信息,例子:
   esxcli system version get
  Product: VMware ESXi
  Version: 6.0.0
  Build: Releasebuild-3620759
  Update: 2
  Patch: 34
  

  3)、esxcli system time get
  查看系统时间,例子:

   esxcli system time get
  2016-09-13T02:02:39Z
  

  4)、esxcli system time set <options>
  修改系统时间,例子:

  Cmd options:
  -d|--day=<long>       Day
  -H|--hour=<long>      Hour
  -m|--min=<long>       Minute
  -M|--month=<long>   Month
  -s|--sec=<long>       Second
  -y|--year=<long>      Year
   esxcli system time set -y=2016 -M=9 -d=13 -H=10 -m=9
   esxcli system time get
  2016-09-13T10:09:27Z
  

  5)、esxcli system maintenanceMode set --enable true/false
  ESXi主机进入/退出,维护模式,例子:
   esxcli system maintenanceMode set --enable true
   esxcli system maintenanceMode get   //查看维护模式的状态
  Enabled
   esxcli system maintenanceMode set --enable false
   esxcli system maintenanceMode get
  Disabled
  
  

  6)、esxcli system shutdown reboot/poweroff
  系统重启/关机(必须处于维护模式,否则命令不生效)

  

  7)、esxcli network ip interface ipv4 get
  查看接口ipv4地址,例子:
   esxcli network ip interface ipv4 get
  NameIPv4 Address   IPv4 Netmask   IPv4 BroadcastAddress TypeDHCP DNS
  ----------------------------------------------------------------
  vmk010.1.98.165    255.255.255.0   10.1.98.255   STATIC          false
  

  8)、esxcli network ip route ipv4 list
  查看路由表,例子:

   esxcli network ip route ipv4 list
  Network      Netmask      Gateway      InterfaceSource
  ----------------------------------------------------
  default      0.0.0.0      10.1.98.254vmk0       MANUAL
  10.1.98.0255.255.255.00.0.0.0      vmk0       MANUAL
  

  9)、esxcli network nic list
  查看ESXi主机网卡列表(nic)或up-link列表,例子:

   esxcli network nic list
  Name    PCI Device    DriverAdmin StatusLink StatusSpeedDuplexMAC Address         MTUDescription
  ----------------------------------------------------------------------------------------------------------------------------------
  vmnic00000:03:00.0e1000eUp            Up            1000Full    00:50:56:9d:bd:b71500Intel Corporation 82574L Gigabit Network Connection
  vmnic10000:0b:00.0e1000eUp            Up            1000Full    00:50:56:9d:7c:7f1500Intel Corporation 82574L Gigabit Network Connection
  

  10)、esxcli network nic down/up -n=vmnic1
  关闭/打开vmnic1接口

  

  11)、esxcli storage core device list
  查看磁盘列表
页: [1]
查看完整版本: VMware vSphere ESXi6.0常用命令