iT邦幫忙

0

ESXi 5.1的Guest VM機器可以遠端開機嗎?

Google找不到結果,只有一個人說『vsphere PowerCli』

請問要怎樣Wake On Lan??或是其他,一般人即可開機的方法。

謝大家。

圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中
4
cojad
iT邦新手 3 級 ‧ 2013-08-22 13:25:05
最佳解答

想要讓使用者點個按鈕就能開機ESXi的主機你需要準備
1.在ESXi的主機上設定好適當權限的帳號, 以免使用者獲取到過大的權限,並開啟SSH連線功能
2.在使用者的電腦安裝Putty並設定好自動執行的Script檔

第一點我就不解釋了,應該沒有甚麼問題
第二點Putty是Windows下的SSH連線Client程式,載到使用者電腦後,替使用者建立好捷徑
執行的內容如下
putty -ssh user@127.0.0.1 -pw password -m script.txt

user請替換成你給使用者指定用來登入ESXi的帳號(記得帳號要賦予權限可以控制該台Guest VM的開關機)
password請替換成你給使用者指定用來登入ESXi的密碼
script.txt就是我們要透過SSH來下達的開機指令

所以Script.txt的內容就是

<pre class="c" name="code">vim-cmd vmsvc/power.on <vmid>

vmid的查詢方法可以透過用 putty 連到 ESXi Server 中,以 vim-cmd vmsvc/getallvms查詢所有 VMs 資料。
PS. 據我所知vSphere Client中,預設是沒有辦法查到vmid的,除非有人寫特別的plugin不然,一定只能透過vim-cmd vmsvc/getallvms來查到id

Putty官網: http://www.chiark.greenend.org.uk/~sgtatham/putty/
Pietty官網: http://ntu.csie.org/~piaip/pietty/
Pietty 源自於 PuTTY ,修正與完整支援亞洲等多國語系字元、 並在使用界面上大幅改進、易學易用的版本。

enable SSH on the ESXi 5.0 host.

  1. start the vSphere Client
    2.Select the ESXi host in the configurations / Security Profile
    3.Click on Properties in the upper right corner and you will get the a popup with all the services on this ESXi 5.0 hosts. Select the SSH service and press the Options button.
    4.start the services and set the startup options

取得VMID之後即可
vim-cmd vmsvc/power.on VMID
vim-cmd vmsvc/power.off VMID

感謝講得很清楚,雖然還是需要在用戶端放Putty,但是已經是最簡單的了

VM狀態
vim-cmd vmsvc/power.getstate VMID

12
u8526425
iT邦大師 1 級 ‧ 2013-08-20 11:54:25

原則上就是用SSH登入是比較簡易的辦法
Powering on a virtual machine from the command line
http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1038043

To power on a virtual machine from the command line:
vim-cmd vmsvc/getallvms |grep <vm name>
問題是,用戶端怎麼可能有這些東西.........

8
hector958
iT邦研究生 2 級 ‧ 2013-08-21 00:42:49

http://pubs.vmware.com/vsphere-50/index.jsp?topic=%2Fcom.vmware.vsphere.vm_admin.doc_50%2FGUID-35CD5E60-6FFA-47CE-A5CF-78B6D6B42CB8.html

Manage Power Management Settings for a Virtual Machine
You can set the power options so that a virtual machine is suspended or remains powered on when the guest operating system is placed on standby.

Power Management options are not available on every guest operating system. Wake on LAN supports only Windows guest operating systems and is not available on Vlance NICs, or when a Flexible NIC is operating in Vlance mode (that is, the current VMware Tools are not installed on the guest operating system).

Wake on LAN can resume virtual machines that are in an S1 sleep state only. It cannot resume suspended, hibernated, or powered off virtual machines.

The following NICs support Wake on LAN:

■ Flexible (VMware Tools required).

■ vmxnet

■ Enhanced vmxnet

■ vmxnet 3

Prerequisites
You must power off the virtual machine.

Procedure
1 In the vSphere Client inventory, right-click the virtual machine and select Edit Settings.

2 Click the Options tab and select Power Management.

3 In the Guest Power Management panel, select a power option.

■ Suspend the virtual machine

■ Put the guest operating system in standby mode and leave the virtual machine powered on

4 (Optional) Select Wake on LAN for virtual machine traffic on and select the virtual NICs to trigger this action.

Unsupported NICs might be listed, but are unavailable to connect.

5 Click OK to save your changes and close the dialog box.

這好像是『把電腦叫醒』而不是開機
完整關機之後,沒法用這個開機

hector958 iT邦研究生 2 級 ‧ 2013-08-27 10:40:49 檢舉

是阿,因為要"WAKE" ON LAN嘛。

4
yesongow
iT邦大師 1 級 ‧ 2013-08-21 16:03:22

我對文字的使用上,會很龜毛,所以,這兩個問題,我會覺得是不相同的!

ESXi 5.1的Guest VM機器可以遠端開機嗎?
-->用vShpere Client登入Host,將所選的Guest OS選Power On即可!

ESXi 5.1的Host VM機器可以遠端開機嗎?
-->你的環境,有裝Router or Firewall嗎?某款商業的Firewall有含WOL管理功能!只要將Host實體主機的Mac-address存入,即可遠端透過magic-packet sender喚醒開機,
當然,你必須先確認:
你的Host VM機器的BIOS 可以接受 Wake on Lan or Wake On PCI。

1.我是要Guest VM,不是Host唷
2.『一般人即可開機』,不能裝vShpere Client,所以希望用CommandLine Wake On Lan(AP亦可)

謝謝囉

yesongow iT邦大師 1 級 ‧ 2013-08-21 18:07:08 檢舉

vim-cmd vmsvc/power.on <vmid>

至於vmid從哪查呢?
請用vim-cmd vmsvc/getallvms | more 去查吧!第一個欄位的數字就是!

至於vim-cmd vmsvc/power.getstate <vmid>,可以查到狀態

例如,我有系統,它的vmid是992

~ # vim-cmd vmsvc/power.getstat 992
Retrieved runtime info
Powered on

感謝!!

4
cmwang
iT邦大師 1 級 ‧ 2013-08-21 22:22:58

實體機的WOL是NIC的MAC在有電源供應的狀況下,可以識別特定封包,並在收到此類封包時送出PME,讓MB上ACPI相關部份得知該起床辦事了,VM中的NIC既然是虛擬出來的,自然是沒有這些機私,雖然host理論上可以收到給特定guest的WOL封包,並依此對其執行WOL,但也要host有實作才有戲唱吧OrzOrz....

2
rogerweng
iT邦新手 4 級 ‧ 2013-08-26 08:58:57
  1. 不安裝 vsphere client, vsphere 5.1另外提供了webclient,直接透過webclient
    一樣可進行 vcenter操作,無須安裝軟體
  2. 若是一般user,用的是一般client OS (如windows xp),則可使用VMWare View,
    該軟體本身就支援user使用時才進行開機.透過web access一樣可以進行開機.

我要發表回答

立即登入回答