- 积分
- 16843
在线时间 小时
最后登录1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?开始注册
x
网络/ `% \+ ?, A$ b6 f& Y$ \# R1 M% I
6 \) M, F9 S, L& |7 b- `
很多命令的 -h 都包含了详细的例子
& O- K: j" l" b# o* g! l O
& S$ R4 C$ U2 ?# O6 O+ j" cesxcli network:. ^1 M5 j8 I4 ` b/ O1 c
u/ z2 j( H! M! g2 X7 _$ E5 v这是一个命令集, 包含了很多子命令. n5 j, \* @1 w! ^; f4 g
+ o, E% \9 ?& e, resxcli network nic list 查看网卡信息2 y% @2 r# ^# ?$ ~) m5 q* ~# _- A( r
esxcli network ip route ipv4 list 查看路由(ipv4)5 K1 ^, _, t( A# a1 y
esxcli network ip dns server list 查看 dns
7 \) s% {4 C8 k* L# U/ m. wesxcli network ip interface ipv4 get 查看ip配置(ipv4)
2 n( ?0 _# z3 r/ f; pesxcfg-route:6 o) p6 p7 i9 E. [ n
4 K& e; p, i5 |1 V/ @esxcfg-route 查看默认路由
( ^, e6 b# G2 Z( w& B3 Vesxcfg-nics:
4 p) Y' c7 J+ Q, a6 s7 Y
' y9 x% M6 D3 T R& T/ Z! Jesxcfg-nics 等价 esxcli network nic list3 k t/ u" ^3 e# B
tcpdump-uw:
9 ?; ^: P3 Y1 `2 |0 ?5 P& A P( X9 u1 ]- u- w" I/ C9 t
类似于Linux下的 tcpdump, 是 ESX 的抓包工具% b; x) w. f, K2 J( \
4 n( r* J, R* G0 t2 E
vsish$ m7 ~) R+ } D6 `8 s2 ]; `
1 m: {3 V7 Q' UESXi命令行修改密码3 J: k4 Z0 Z/ {! U; a" }+ u
# S4 ?3 v. f/ U& ?$ [通过 ssh 登录到 ESXi 系统后, 可以通过 passwd root 来修改密码) z7 v p0 l, H- d1 C% ~. K0 k
* o6 U: U9 d2 ]参考 Changing ESXi Root Password , 里面还说明了如何开启 ESXi ssh 登录.
" d; ~2 R; ]% Z% K, u- N% t& d9 {* V) t( T
ESXi 的 authorized_keys
( {7 z0 e; y8 O* l2 P Z R/ i+ }
5 J" J2 L5 O# @( l: U- C, EFor ESXi 5.0, the location of authorized_keys is: /etc/ssh/keys-<username>/authorized_keys5 n: ~6 r( \: }! {: F+ _
3 B, M4 q* B+ q7 u( T
参考: Allowing SSH access to ESX hosts with public/private key authentication
. g/ p3 R1 C9 I' V/ K
! P/ |9 I% R9 Q9 w' t) d控制虚拟机开关机
& f! v% Q7 i/ d6 R6 S% S+ F' x
/ G& O9 e( H. R% K5 A$ y1 dTo power on a virtual machine from the command line:: X" Y1 m: F( Y. x/ i, _2 ^
- Z5 x8 ?7 g* g4 ~; x
List the inventory ID of the virtual machine with the command:
Z7 f1 I4 |2 h r/ u. q% e
, Z E4 u& @: T% O/ H$ H, Y# ?6 Rvim-cmd vmsvc/getallvms |grep <vm name>
7 _2 B+ B& B- M0 w6 eNote: The first column of the output shows the vmid.
! p9 Z5 i3 o6 V! }2 ?/ s+ K7 s( H, F# I/ q
Check the power state of the virtual machine with the command:2 i/ C2 H0 v D6 s" j4 X7 }, F. a: m
# e: _7 Q: B: C% D U
vim-cmd vmsvc/power.getstate <vmid>& X5 s7 Z/ w% ]9 k4 Q$ v2 n5 J
Power-on the virtual machine with the command:
9 Q8 E# D! A0 P& B' \) \/ U7 y6 D. q
vim-cmd vmsvc/power.on <vmid>
! k4 A- e. q9 R8 a; o4 K关机就是把 power.on 改为 power.off 就可以了.' _8 ~4 }$ B% z9 c) u) F( t/ K
0 ]+ n0 a5 s0 u3 P: T参考: Powering on a virtual machine from the command line when the host cannot be managed using vSphere Client
0 A) |, b) e8 R
) j! p2 l* R* E9 P( J7 `4 [0 n另外还有一种方法, 只能控制关机:
' c- G. t m g6 H% I" d6 M: C2 j+ L
" [2 Z: `. K5 _, g! K" TGet a list of running virtual machines, identified by World ID, UUID, Display Name, and path to the .vmx configuration file, using this command:7 V+ E2 @! U* V
: b t8 H8 D9 m8 P; O
esxcli vm process list # 只显示开机的虚拟机列表
2 d+ l! I7 D' Z* k$ |3 ^6 jPower off one of the virtual machines from the list using this command:
' _# l; u, `1 ?# d3 q
2 Y' a: s; y* O7 _' resxcli vm process kill --type=[soft,hard,force] --world-id=WorldNumber
. ]% a4 `0 e1 tNotes: 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.4 ]% m) r! h- B2 ?9 d! V
+ w b4 W2 I, l6 u% i$ @% LAlternate power off command syntax is:
7 [; f$ D- A/ L( A% y2 {8 e- C# t( I- ?5 _
esxcli vm process kill -t [soft,hard,force] -w WorldNumber |
|