vnc老是鏈接不了kvm虛擬機問題解決報The connection closed unexpectedly.windows
沒有爲這個kvm虛擬機配置vnc端口,能夠本身在*.xml文件中添加
A.virsh edit centos7.0
<graphics type='vnc' port='-1' autoport='yes' listen='0.0.0.0'>
<listen type='address' address='0.0.0.0'/>
</graphics>centos
B.重啓kvm虛擬機,因爲是autoport自動分配的端口,因此須要查詢下
virsh vncdisplay centos7.0
:0
因爲是5900起步的,因此這裏是顯示0,對應着5900,也能夠直接用virsh dumpxml centos7.0這樣查更加直觀一些。服務器
C.查到端口以後能夠用vncviewer去鏈接,(若是在服務器上已經開了個鏈接,那麼在windows上去用這個vncviewer去鏈接會失敗,這個問題查了一段時間)ide