博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
虚拟化之esxi命令行管理
阅读量:5807 次
发布时间:2019-06-18

本文共 29436 字,大约阅读时间需要 98 分钟。

Vmware PowerCLI和Vmware CLI

vMA
A Linux virtual appliance that includes the vSphere SDK for Perl and the vCLI package.Also supports the vi-fastpass authentication component.
ESXi Shell commands
Set of troubleshooting commands to use when vCLI cannot access your ESXi system. Includes ESXCLI commands and esxcfg-commands (deprecated).

VMware vSphere PowerCLI 是一款功能强大的命令行工具,可自动执行 vSphere 的各方面管理,包括主机、网络、存储、虚拟机、客户操作系统等等。 PowerCLI 作为 Windows PowerShell 插件分发,包括超过 150 个 PowerShell cmdlet,以及文档和示例。 PowerCLI 将 vSphere 平台与 Windows 和 .*-NET 无缝地融合在一起,这意味着您可以单独使用 PowerCLI,也可以在众多其他第三方工具中使用。

直接控制台UI

~ # dcui

按ctrl+c退出

~ # esxcfg-vswitch -lSwitch Name      Num Ports   Used Ports  Configured Ports  MTU     UplinksvSwitch0         128         5           128               1500    vmnic0  PortGroup Name        VLAN ID  Used Ports  Uplinks  VM Network            0        1           vmnic0  Management Network    0        1           vmnic0

 

两种方法

1.直接在ESXi控制台界面上按住ALT+F1也能进入

2.把ESXi的SSH功能开开,然后用工具连接行了,root/password。

开启后,会有感叹号

主机>配置>安全配置文件

 

~ # esxcfg-vmknic -lInterface  Port Group/DVPort   IP Family IP Address                              Netmask         Broadcast       MAC Address       MTU     TSO MSS   Enabled Typevmk0       Management Network  IPv4      172.16.1.17                             255.255.255.128 172.16.1.127    00:e0:4c:21:c7:a5 1500    65535     true    STATICvmk0       Management Network  IPv6      fe80::2e0:4cff:fe21:c7a5                64                              00:e0:4c:21:c7:a5 1500    65535     true    STATIC, PREFERRED~ # esxcfg-nics -lName    PCI           Driver      Link Speed     Duplex MAC Address       MTU    Descriptionvmnic0  0000:01:00.00 r8168       Up   100Mbps   Full   00:e0:4c:21:c7:a3 1500   Realtek Realtek 8168 Gigabit Ethernet~ # esxcfg-routeVMkernel default gateway is 172.16.1.126~ # esxcfg-scsidevs  -Avmhba33     t10.ATA_____ST500DM0022D1BD142___________________________________Z3TFY6H0~ # esxcfg-scsidevs  -avmhba0  ata_piix          link-n/a  sata.vmhba0                             (0:0:31.2) Intel Corporation Cougar Point 4 port SATA IDE Controllervmhba1  ata_piix          link-n/a  sata.vmhba1                             (0:0:31.5) Intel Corporation Cougar Point 2 port SATA IDE Controllervmhba32 ata_piix          link-n/a  sata.vmhba32                            (0:0:31.2) Intel Corporation Cougar Point 4 port SATA IDE Controllervmhba33 ata_piix          link-n/a  sata.vmhba33                            (0:0:31.5) Intel Corporation Cougar Point 2 port SATA IDE Controllervmhba34 iscsi_vmk         online    iscsi.vmhba34                           iSCSI Software Adapter~ # esxcfg-scsidevs  -lt10.ATA_____ST500DM0022D1BD142___________________________________Z3TFY6H0   Device Type: Direct-Access   Size: 476940 MB   Display Name: Local ATA Disk (t10.ATA_____ST500DM0022D1BD142___________________________________Z3TFY6H0)   Multipath Plugin: NMP   Console Device: /vmfs/devices/disks/t10.ATA_____ST500DM0022D1BD142___________________________________Z3TFY6H0   Devfs Path: /vmfs/devices/disks/t10.ATA_____ST500DM0022D1BD142___________________________________Z3TFY6H0   Vendor: ATA       Model: ST500DM002-1BD14  Revis: KC45   SCSI Level: 5  Is Pseudo: false Status: on   Is RDM Capable: false Is Removable: false   Is Local: true  Is SSD: false   Other Names:      vml.01000000002020202020202020202020205a33544659364830535435303044   VAAI Status: unknown~ # esxcfg-info -hUsage: esxcfg-info mode  -a, --all           Print all information  -w, --hardware      Print hardware information  -r, --resource      Print resource information  -s, --storage       Print storage information  -n, --network       Print network information  -y, --system        Print system information  -o, --advopt        Print advanced options  -u, --hwuuid        Print hardware uuid  -b, --bootuuid      Print boot partition uuid  -e, --boottype      Print boot type (VMVisor Only)  -c, --cmdline       Print vmkernel command line  -F, --format        Print the information in the given format                      Valid values are "xml" and "perl"  -h, --help          Print this message.

 

~ # esxcliUsage: 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 scriptAvailable Namespaces:  esxcli                Commands that operate on the esxcli system itself allowing users to get additional information.  fcoe                  VMware FCOE 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.  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.  vm                    A small number of operations that allow a user to Control Virtual Machine operations.

 

~ # esxcli system -hUsage: esxcli system {cmd} [cmd options]Available Namespaces:  boot                  Operations relating to host boot that allow manipulation of VMkernel boot time configuration.  coredump              Operations pertaining to the VMkernel Core dump configuration.  module                Operations that allow manipulation of the VMkernel loadable modules and device drivers. Operations include load, list and setting                        options.  process               Commands relating to running processes.  secpolicy             Options related to VMkernel access control subsystem. These options are typically in place for specific workarounds or debugging.                        These commands should be used at the direction of VMware Support Engineers.  settings              Operations that allow viewing and manipulation of system settings.  stats                 Access to various system statistics  syslog                Operations relating to system logging  visorfs               Operations pertaining to the visorfs memory filesytem.  hostname              Operations pertaining the network name of the ESX host.  maintenanceMode       Command to manage the system's maintenance mode.  shutdown              Command to shutdown the system.  snmp                  Commands pertaining to SNMPv1/v2c/v3 Agent configuration.  time                  Commands to get and set system time.  uuid                  Get the system UUID  version               Commands to get version information.  welcomemsg            Commands to get and set the welcome banner for DCUI.~ # esxcli system versionUsage: esxcli system version {cmd} [cmd options]Available Commands:  get                   Display the product name, version and build information.~ # esxcli system version get   Product: VMware ESXi   Version: 5.1.0   Build: Releasebuild-1065491   Update: 1
~ # esxcli esxcli command listNamespace                                               Command------------------------------------------------------  -----------esxcli.command                                          listfcoe.adapter                                            listfcoe.nic                                                disablefcoe.nic                                                discoverfcoe.nic                                                listhardware.bootdevice                                     listhardware.clock                                          gethardware.clock                                          sethardware.cpu.cpuid                                      gethardware.cpu.global                                     gethardware.cpu.global                                     sethardware.cpu                                            listhardware.ipmi.fru                                       gethardware.ipmi.fru                                       listhardware.ipmi.sdr                                       gethardware.ipmi.sdr                                       listhardware.ipmi.sel                                       gethardware.ipmi.sel                                       listhardware.memory                                         gethardware.pci                                            listhardware.platform                                       gethardware.trustedboot                                    getiscsi.adapter.auth.chap                                 getiscsi.adapter.auth.chap                                 setiscsi.adapter.capabilities                              getiscsi.adapter.discovery                                 rediscoveriscsi.adapter.discovery.sendtarget                      addiscsi.adapter.discovery.sendtarget.auth.chap            getiscsi.adapter.discovery.sendtarget.auth.chap            setiscsi.adapter.discovery.sendtarget                      listiscsi.adapter.discovery.sendtarget.param                getiscsi.adapter.discovery.sendtarget.param                setiscsi.adapter.discovery.sendtarget                      removeiscsi.adapter.discovery.statictarget                    addiscsi.adapter.discovery.statictarget                    listiscsi.adapter.discovery.statictarget                    removeiscsi.adapter.discovery.status                          getiscsi.adapter.firmware                                  getiscsi.adapter.firmware                                  setiscsi.adapter                                           getiscsi.adapter                                           listiscsi.adapter.param                                     getiscsi.adapter.param                                     setiscsi.adapter                                           setiscsi.adapter.target                                    listiscsi.adapter.target.portal.auth.chap                   getiscsi.adapter.target.portal.auth.chap                   setiscsi.adapter.target.portal                             listiscsi.adapter.target.portal.param                       getiscsi.adapter.target.portal.param                       setiscsi.ibftboot                                          getiscsi.ibftboot                                          importiscsi.logicalnetworkportal                              listiscsi.networkportal                                     addiscsi.networkportal.ipconfig                            getiscsi.networkportal.ipconfig                            setiscsi.networkportal                                     listiscsi.networkportal                                     removeiscsi.physicalnetworkportal                             listiscsi.physicalnetworkportal.param                       getiscsi.physicalnetworkportal.param                       setiscsi.plugin                                            listiscsi.session                                           addiscsi.session.connection                                listiscsi.session                                           listiscsi.session                                           removeiscsi.software                                          getiscsi.software                                          setnetwork.diag                                            pingnetwork.fence                                           listnetwork.fence.network.bte                               listnetwork.fence.network                                   listnetwork.fence.network.port                              listnetwork.firewall                                        getnetwork.firewall                                        loadnetwork.firewall                                        refreshnetwork.firewall.ruleset.allowedip                      addnetwork.firewall.ruleset.allowedip                      listnetwork.firewall.ruleset.allowedip                      removenetwork.firewall.ruleset                                listnetwork.firewall.ruleset.rule                           listnetwork.firewall.ruleset                                setnetwork.firewall                                        setnetwork.firewall                                        unloadnetwork.ip.connection                                   listnetwork.ip.dns.search                                   addnetwork.ip.dns.search                                   listnetwork.ip.dns.search                                   removenetwork.ip.dns.server                                   addnetwork.ip.dns.server                                   listnetwork.ip.dns.server                                   removenetwork.ip                                              getnetwork.ip.interface                                    addnetwork.ip.interface.ipv4                               getnetwork.ip.interface.ipv4                               setnetwork.ip.interface.ipv6.address                       addnetwork.ip.interface.ipv6.address                       listnetwork.ip.interface.ipv6.address                       removenetwork.ip.interface.ipv6                               getnetwork.ip.interface.ipv6                               setnetwork.ip.interface                                    listnetwork.ip.interface                                    removenetwork.ip.interface                                    setnetwork.ip.interface.tag                                addnetwork.ip.interface.tag                                getnetwork.ip.interface.tag                                removenetwork.ip.ipsec.sa                                     addnetwork.ip.ipsec.sa                                     listnetwork.ip.ipsec.sa                                     removenetwork.ip.ipsec                                        setnetwork.ip.ipsec.sp                                     addnetwork.ip.ipsec.sp                                     listnetwork.ip.ipsec.sp                                     removenetwork.ip.neighbor                                     listnetwork.ip.route.ipv4                                   addnetwork.ip.route.ipv4                                   listnetwork.ip.route.ipv4                                   removenetwork.ip.route.ipv6                                   addnetwork.ip.route.ipv6                                   listnetwork.ip.route.ipv6                                   removenetwork.ip                                              setnetwork.nic                                             downnetwork.nic                                             getnetwork.nic                                             listnetwork.nic                                             setnetwork.nic.stats                                       getnetwork.nic                                             upnetwork.nic.vlan.stats                                  getnetwork.nic.vlan.stats                                  setnetwork.port.filter.stats                               getnetwork.port.stats                                      getnetwork.sriovnic                                        listnetwork.sriovnic.vf                                     listnetwork.vm                                              listnetwork.vm.port                                         listnetwork.vswitch.dvs.vmware.lacp.get                     confignetwork.vswitch.dvs.vmware.lacp.get                     statsnetwork.vswitch.dvs.vmware.lacp.get                     statusnetwork.vswitch.dvs.vmware                              listnetwork.vswitch.dvs.vmware.vxlan.config.stats           getnetwork.vswitch.dvs.vmware.vxlan.config.stats           setnetwork.vswitch.dvs.vmware.vxlan                        listnetwork.vswitch.dvs.vmware.vxlan.network                listnetwork.vswitch.dvs.vmware.vxlan.network.mapping        listnetwork.vswitch.dvs.vmware.vxlan.network.mapping        resetnetwork.vswitch.dvs.vmware.vxlan.network.port           listnetwork.vswitch.dvs.vmware.vxlan.network.port.stats     listnetwork.vswitch.dvs.vmware.vxlan.network.port.stats     resetnetwork.vswitch.dvs.vmware.vxlan.network.stats          listnetwork.vswitch.dvs.vmware.vxlan.network.stats          resetnetwork.vswitch.dvs.vmware.vxlan.stats                  listnetwork.vswitch.dvs.vmware.vxlan.stats                  resetnetwork.vswitch.dvs.vmware.vxlan.vmknic                 listnetwork.vswitch.dvs.vmware.vxlan.vmknic.multicastgroup  listnetwork.vswitch.dvs.vmware.vxlan.vmknic.stats           listnetwork.vswitch.dvs.vmware.vxlan.vmknic.stats           resetnetwork.vswitch.standard                                addnetwork.vswitch.standard                                listnetwork.vswitch.standard.policy.failover                getnetwork.vswitch.standard.policy.failover                setnetwork.vswitch.standard.policy.security                getnetwork.vswitch.standard.policy.security                setnetwork.vswitch.standard.policy.shaping                 getnetwork.vswitch.standard.policy.shaping                 setnetwork.vswitch.standard.portgroup                      addnetwork.vswitch.standard.portgroup                      listnetwork.vswitch.standard.portgroup.policy.failover      getnetwork.vswitch.standard.portgroup.policy.failover      setnetwork.vswitch.standard.portgroup.policy.security      getnetwork.vswitch.standard.portgroup.policy.security      setnetwork.vswitch.standard.portgroup.policy.shaping       getnetwork.vswitch.standard.portgroup.policy.shaping       setnetwork.vswitch.standard.portgroup                      removenetwork.vswitch.standard.portgroup                      setnetwork.vswitch.standard                                removenetwork.vswitch.standard                                setnetwork.vswitch.standard.uplink                         addnetwork.vswitch.standard.uplink                         removesched.swap.system                                       getsched.swap.system                                       setsoftware.acceptance                                     getsoftware.acceptance                                     setsoftware.profile                                        getsoftware.profile                                        installsoftware.profile                                        updatesoftware.profile                                        validatesoftware.sources.profile                                getsoftware.sources.profile                                listsoftware.sources.vib                                    getsoftware.sources.vib                                    listsoftware.vib                                            getsoftware.vib                                            installsoftware.vib                                            listsoftware.vib                                            removesoftware.vib                                            updatestorage.core.adapter                                    liststorage.core.adapter                                    rescanstorage.core.adapter.stats                              getstorage.core.claiming                                   autoclaimstorage.core.claiming                                   reclaimstorage.core.claiming                                   unclaimstorage.core.claimrule                                  addstorage.core.claimrule                                  convertstorage.core.claimrule                                  liststorage.core.claimrule                                  loadstorage.core.claimrule                                  movestorage.core.claimrule                                  removestorage.core.claimrule                                  runstorage.core.device.detached                            liststorage.core.device.detached                            removestorage.core.device                                     liststorage.core.device.partition                           liststorage.core.device.partition                           showguidstorage.core.device                                     setstorage.core.device                                     setconfigstorage.core.device.smart                               getstorage.core.device.stats                               getstorage.core.device.vaai.status                         getstorage.core.device.world                               liststorage.core.path                                       liststorage.core.path                                       setstorage.core.path.stats                                 getstorage.core.plugin                                     liststorage.core.plugin.registration                        addstorage.core.plugin.registration                        liststorage.core.plugin.registration                        removestorage.filesystem                                      automountstorage.filesystem                                      liststorage.filesystem                                      mountstorage.filesystem                                      rescanstorage.filesystem                                      unmountstorage.nfs                                             addstorage.nfs                                             liststorage.nfs                                             removestorage.nmp.device                                      liststorage.nmp.device                                      setstorage.nmp.path                                        liststorage.nmp.psp.fixed.deviceconfig                      getstorage.nmp.psp.fixed.deviceconfig                      setstorage.nmp.psp.generic.deviceconfig                    getstorage.nmp.psp.generic.deviceconfig                    setstorage.nmp.psp.generic.pathconfig                      getstorage.nmp.psp.generic.pathconfig                      setstorage.nmp.psp                                         liststorage.nmp.psp.roundrobin.deviceconfig                 getstorage.nmp.psp.roundrobin.deviceconfig                 setstorage.nmp.satp.generic.deviceconfig                   getstorage.nmp.satp.generic.deviceconfig                   setstorage.nmp.satp.generic.pathconfig                     getstorage.nmp.satp.generic.pathconfig                     setstorage.nmp.satp                                        liststorage.nmp.satp.rule                                   addstorage.nmp.satp.rule                                   liststorage.nmp.satp.rule                                   removestorage.nmp.satp                                        setstorage.san.fc.events                                   clearstorage.san.fc.events                                   getstorage.san.fc                                          liststorage.san.fc                                          resetstorage.san.fc.stats                                    getstorage.san.fcoe                                        liststorage.san.fcoe                                        resetstorage.san.fcoe.stats                                  getstorage.san.iscsi                                       liststorage.san.iscsi.stats                                 getstorage.san.sas                                         liststorage.san.sas                                         resetstorage.san.sas.stats                                   getstorage.vmfs.extent                                     liststorage.vmfs.snapshot.extent                            liststorage.vmfs.snapshot                                   liststorage.vmfs.snapshot                                   mountstorage.vmfs.snapshot                                   resignaturestorage.vmfs                                            upgradesystem.boot.device                                      getsystem.coredump.network                                 checksystem.coredump.network                                 getsystem.coredump.network                                 setsystem.coredump.partition                               getsystem.coredump.partition                               listsystem.coredump.partition                               setsystem.hostname                                         getsystem.hostname                                         setsystem.maintenanceMode                                  getsystem.maintenanceMode                                  setsystem.module                                           getsystem.module                                           listsystem.module                                           loadsystem.module.parameters                                listsystem.module.parameters                                setsystem.module                                           setsystem.process                                          listsystem.process.stats.load                               getsystem.process.stats.running                            getsystem.secpolicy.domain                                 listsystem.secpolicy.domain                                 setsystem.settings.advanced                                listsystem.settings.advanced                                setsystem.settings.kernel                                  listsystem.settings.kernel                                  setsystem.settings.keyboard.layout                         getsystem.settings.keyboard.layout                         listsystem.settings.keyboard.layout                         setsystem.shutdown                                         poweroffsystem.shutdown                                         rebootsystem.snmp                                             getsystem.snmp                                             hashsystem.snmp                                             setsystem.snmp                                             testsystem.stats.uptime                                     getsystem.syslog.config                                    getsystem.syslog.config.logger                             listsystem.syslog.config.logger                             setsystem.syslog.config                                    setsystem.syslog                                           marksystem.syslog                                           reloadsystem.time                                             getsystem.time                                             setsystem.uuid                                             getsystem.version                                          getsystem.visorfs                                          getsystem.visorfs.ramdisk                                  addsystem.visorfs.ramdisk                                  listsystem.visorfs.ramdisk                                  removesystem.visorfs.tardisk                                  listsystem.welcomemsg                                       getsystem.welcomemsg                                       setvm.process                                              killvm.process                                              list

 

~ # esxcli software acceptance getPartnerSupported~ # esxcli software vib listName                           Version                               Vendor  Acceptance Level  Install Date-----------------------------  ------------------------------------  ------  ----------------  ------------ata-pata-amd                   0.3.10-3vmw.510.0.0.799733            VMware  VMwareCertified   2014-05-22ata-pata-atiixp                0.4.6-4vmw.510.0.0.799733             VMware  VMwareCertified   2014-05-22ata-pata-cmd64x                0.2.5-3vmw.510.0.0.799733             VMware  VMwareCertified   2014-05-22ata-pata-hpt3x2n               0.3.4-3vmw.510.0.0.799733             VMware  VMwareCertified   2014-05-22ata-pata-pdc2027x              1.0-3vmw.510.0.0.799733               VMware  VMwareCertified   2014-05-22ata-pata-serverworks           0.4.3-3vmw.510.0.0.799733             VMware  VMwareCertified   2014-05-22~ # esxcli software vib get -n ata-pata-amdVMware_bootbank_ata-pata-amd_0.3.10-3vmw.510.0.0.799733   Name: ata-pata-amd   Version: 0.3.10-3vmw.510.0.0.799733   Type: bootbank   Vendor: VMware   Acceptance Level: VMwareCertified   Summary: pata_amd: ata driver for VMware ESX   Description: AMD/NVidia PATA Driver   ReferenceURLs:   Creation Date: 2012-08-02   Depends: vmkapi_2_1_0_0, com.vmware.driverAPI-9.2.1.0, com.vmware.libata-9.2.1.0   Conflicts:   Replaces:   Provides:   Maintenance Mode Required: True   Hardware Platforms Required:   Live Install Allowed: False   Live Remove Allowed: False   Stateless Ready: True   Overlay: False   Tags: driver, module   Payloads: ata-pata~ # esxcli software profile get(Updated) ESXi-5.1.0-20130402001-standard   Name: (Updated) ESXi-5.1.0-20130402001-standard   Vendor: localhost   Creation Time: 2014-05-23T18:02:36   Modification Time: 2015-02-16T06:28:57   Stateless Ready: True   Description:      2014-05-23T18:02:29.976940+00:00: The following VIBs are      installed:        vmware-fdm    5.1.0-799731      ----------      For more information, see http://kb.vmware.com/kb/2041635.

 

转载地址:http://fjubx.baihongyu.com/

你可能感兴趣的文章
Tesla辅助驾驶测试报告遭爆正确性有疑问
查看>>
Android精通之AsyncTask与ListView讲解
查看>>
Linux命令参数详细解析 curl
查看>>
Blockathon,挑战区块链开发,敢不敢来!
查看>>
Java中抽象类和接口有什么异同
查看>>
《iOS开发》系列在线课程
查看>>
重学前端学习笔记(三十一)--JavaScript的语句
查看>>
深浅拷贝数组
查看>>
关于Android中软键盘显示隐藏的监听判断总结
查看>>
iOS数据结构与算法实战 - Binary Tree Traversal
查看>>
DataBining用法<一>
查看>>
开发文档及资源整理
查看>>
Vue 全家桶实现一个移动端酷狗音乐
查看>>
30个Python物联网小实验5:光线感应灯
查看>>
VSCode缩进方式转换
查看>>
【只发精品】匠心打造Vue侧滑菜单组件
查看>>
Django初探一
查看>>
数据结构:快速排序代码(已优化)
查看>>
小猿圈python学习-生成器
查看>>
Kotlin Delegated Properties
查看>>