博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
ESXi 5.x 命令行操作
阅读量:6680 次
发布时间:2019-06-25

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

网络

很多命令的 -h 都包含了详细的例子

esxcli network:

这是一个命令集, 包含了很多子命令

esxcli network nic list 查看网卡信息

esxcli network ip route ipv4 list 查看路由(ipv4)
esxcli network ip dns server list 查看 dns
esxcli network ip interface ipv4 get 查看ip配置(ipv4)
esxcfg-route:

esxcfg-route 查看默认路由

esxcfg-nics:

esxcfg-nics 等价 esxcli network nic list

tcpdump-uw:

类似于Linux下的 tcpdump, 是 ESX 的抓包工具

vsish

ESXi命令行修改密码

通过 ssh 登录到 ESXi 系统后, 可以通过 passwd root 来修改密码

参考 Changing ESXi Root Password , 里面还说明了如何开启 ESXi ssh 登录.

ESXi 的 authorized_keys

For ESXi 5.0, the location of authorized_keys is: /etc/ssh/keys-<username>/authorized_keys

参考: Allowing SSH access to ESX hosts with public/private key authentication

控制虚拟机开关机

To power on a virtual machine from the command line:

List the inventory ID of the virtual machine with the command:

vim-cmd vmsvc/getallvms |grep <vm name>

Note: The first column of the output shows the vmid.

Check the power state of the virtual machine with the command:

vim-cmd vmsvc/power.getstate <vmid>

Power-on the virtual machine with the command:

vim-cmd vmsvc/power.on <vmid>

关机就是把 power.on 改为 power.off 就可以了.

参考: Powering on a virtual machine from the command line when the host cannot be managed using vSphere Client

另外还有一种方法, 只能控制关机:

Get a list of running virtual machines, identified by World ID, UUID, Display Name, and path to the .vmx configuration file, using this command:

esxcli vm process list # 只显示开机的虚拟机列表

Power off one of the virtual machines from the list using this command:

esxcli vm process kill --type=[soft,hard,force] --world-id=WorldNumber

Notes: Three power-off methods are available. Soft is the most graceful, hard performs an immediate shutdown, and force should be used as a last resort.

Alternate power off command syntax is:

esxcli vm process kill -t [soft,hard,force] -w WorldNumber

参考:

Powering off a virtual machine on an ESXi host

How to shutdown a virtual machine on ESXi5 over an ssh terminal session?

转载于:https://blog.51cto.com/bigpi/2083951

你可能感兴趣的文章
【java】【多线程】等待开启的多个线程都执行完成,再做事情,怎么实现
查看>>
java 判断String字符串是不是json数据
查看>>
psql: FATAL: role “postgres” does not exist
查看>>
新版剑指offer14 剪绳子
查看>>
Feign 请求拦截器和日志
查看>>
WPF内实现与串口发送数据和接收数据
查看>>
Ideal test 不执行main方法了
查看>>
kbengine_js_plugins
查看>>
Activity插件化解决方案
查看>>
超简单工具puer——“低碳”的前后端分离开发
查看>>
Cannot connect to WMI Provider & Invalid class [0x80041010]
查看>>
PHP操作二进制字节数据
查看>>
remove()
查看>>
Spring 的两个配置容器的讲解
查看>>
Hash算法原理的简单分析
查看>>
Production Hair Rendering in RenderMan
查看>>
STM32 可编程电压监测器(PVD)
查看>>
shell脚本(for,if,while)
查看>>
错误324 (net::ERR_EMPTY_RESPONSE):未知的错误
查看>>
matlab练习程序(旋转、径向模糊)
查看>>