- 积分
- 16843
在线时间 小时
最后登录1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?开始注册
x
网络1 \. ~3 Z/ C& U) V
- r6 X# s$ Y( w) R( {
很多命令的 -h 都包含了详细的例子
: W3 P" ]' M9 W) o" w% q9 X
* n/ Q. y, `$ eesxcli network:
. b7 ]$ A! H; U1 R& w& Z' P/ P
$ M9 c& ?) A8 @5 y# U- u9 l这是一个命令集, 包含了很多子命令
5 h( g# Z$ z9 j# L$ w" n/ C
% z& V8 v6 T% [5 ]esxcli network nic list 查看网卡信息( f& y& D* Y! d5 C x
esxcli network ip route ipv4 list 查看路由(ipv4)! j; p6 v: m7 W- F/ h
esxcli network ip dns server list 查看 dns0 y6 p( s0 S7 s$ G6 K
esxcli network ip interface ipv4 get 查看ip配置(ipv4)
1 J3 s* Y( ^6 ~" G4 n2 Z5 pesxcfg-route:2 ^' ^6 f/ ? K5 [: F. N1 d# i$ s
. s5 A2 X- n* _$ `
esxcfg-route 查看默认路由" \+ Y, ^1 r, y; u: d( T
esxcfg-nics:. f* H+ D' k* T& v2 |; u9 ~( c
7 G1 W& O- p* P5 F) j; [# C
esxcfg-nics 等价 esxcli network nic list4 o+ t: N! E( e, n0 T' G
tcpdump-uw:
+ ]! J7 N( Q( V% E T, r9 C4 z3 J, Z
类似于Linux下的 tcpdump, 是 ESX 的抓包工具
/ e8 @: U; p6 n( L
& y$ `" i: q, Evsish
+ R& O$ {1 [! C. Z9 E& D4 {) t; Y4 H+ @ g; c" B
ESXi命令行修改密码4 E) B5 R6 d9 t" p( a# Z
9 S7 y0 H2 ~% ?' d6 x+ X: H. t! h7 p通过 ssh 登录到 ESXi 系统后, 可以通过 passwd root 来修改密码
; O7 \; i) {. T( b0 j0 `8 ]$ ?0 [ ^
参考 Changing ESXi Root Password , 里面还说明了如何开启 ESXi ssh 登录.% y, R Y2 W. G) s: ?; ^( v, {
4 K6 V4 B S. z4 nESXi 的 authorized_keys6 D- s {; x3 l5 {9 r3 _
& R! k: ]: g6 m! c
For ESXi 5.0, the location of authorized_keys is: /etc/ssh/keys-<username>/authorized_keys; U1 s1 h% u. ]8 g' a" j) A
H }2 \9 s2 V8 p" ^$ r5 Z
参考: Allowing SSH access to ESX hosts with public/private key authentication7 N# N7 `( G8 g
* k) X1 _5 x: L! l' A7 m7 g1 q
控制虚拟机开关机
- x+ Y& ^# O1 v
0 M% r4 b' `' n+ O7 dTo power on a virtual machine from the command line:# c+ O' d3 }7 L X0 i* {
4 H3 b, K" @& z" L. f" _+ yList the inventory ID of the virtual machine with the command:9 s$ e) J) ~& Z! p/ R
d/ A6 F' \, \8 W1 pvim-cmd vmsvc/getallvms |grep <vm name>
7 V& I& f* P; ~5 R/ A& INote: The first column of the output shows the vmid.
" v; a0 Y# Y2 ~- `( d6 M, d- R g0 K9 y( h" d9 c0 ?
Check the power state of the virtual machine with the command:! R) u- K7 h t u, e# Z
9 @9 X% `" y3 P# V
vim-cmd vmsvc/power.getstate <vmid>
3 X+ Y H) L) ~+ DPower-on the virtual machine with the command:! L& P9 |5 C* w( d8 o
: D; D) M B; Q5 B* b, M
vim-cmd vmsvc/power.on <vmid>
# r# g1 k' M! P' i5 G0 L d关机就是把 power.on 改为 power.off 就可以了.
5 e# E0 ^, x; |2 E
* ~- Y+ p8 N- B参考: Powering on a virtual machine from the command line when the host cannot be managed using vSphere Client, E4 T1 p9 `" ~$ j* K1 E
# }: \ e2 C6 H( A- p
另外还有一种方法, 只能控制关机:& V( B6 _- [4 u" p; u5 m- D
! X8 b5 k2 q! I! I, U y/ jGet a list of running virtual machines, identified by World ID, UUID, Display Name, and path to the .vmx configuration file, using this command:
: j) c2 H3 B+ e# M' C! w2 r) F) ~* J5 f- h3 B0 X& U
esxcli vm process list # 只显示开机的虚拟机列表
1 r2 y6 Q5 y/ s. ?% g$ P& t8 hPower off one of the virtual machines from the list using this command:
1 N m1 E) a, J' L! F/ @; y; o; v7 q! z1 \# U
esxcli vm process kill --type=[soft,hard,force] --world-id=WorldNumber
. B: ?5 s5 |# l% H. }) {* z$ }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.: g7 e1 w6 P! a' Y& ]: A0 g Y1 z
5 q1 n* \) Z7 U1 [0 H
Alternate power off command syntax is:! N2 x, x3 ~) F; V
+ f( t5 u! O7 ]" w& g( N
esxcli vm process kill -t [soft,hard,force] -w WorldNumber |
|