virt-install忽略vnc端口/ listen?

我试图在远程主机上创buildkvm机器。

主机正在运行debiantesting。

有没有使用这个命令:

virt-install --name debian-test \ --os-type=linux \ --os-variant=debianwheezy \ --cdrom /media/media/software/iso/debian-testing-amd64-netinst-2014-01-16.iso \ --graphics vnc,listen=0.0.0.0,port=20001 \ --disk pool=default,format=raw,size=20 \ --ram 2048 \ --vcpus=2 \ --network bridge=virbr0 \ --hvm \ --virt-type=kvm 

但是当它被创build时,它会监听:

 =# virsh domdisplay debian-test vnc://localhost:14101 

当我创buildport = 40001时,它正在监听端口34101,所以它看起来像端口被视为某种偏移?! 在任何方面 – 听没有被使用,能够从本地连接是不是我想要的。

我究竟做错了什么?

你没有做错什么。 VNC协议指定“端口”实际上不是一个端口,而是从默认的VNC端口5900的偏移量。

因此localhost:0将连接到端口5900, localhost:1将连接到端口5901等


默认情况下,无论您在命令行指定什么,libvirt都只将VNC监听器绑定到localhost。 要改变这个,你需要在/etc/libvirt/qemu.conf编辑相应的选项。

 # VNC is configured to listen on 127.0.0.1 by default. # To make it listen on all public interfaces, uncomment # this next option. # # NB, strong recommendation to enable TLS + x509 certificate # verification when allowing public access # #vnc_listen = "0.0.0.0" 

确保在进行此更改后重新加载或重新启动libvirtd。