Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to create kvm machine on remote host.

The host is running debian testing.

Did use this command:

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

But when it is created, it listens on:

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

When I had port=40001 in creation, it was listening on port 34101, so it looks like the port is treated as some kind of offset?! In any way - listen is not being used at all, and being able to connect from localhost is not what I want right now.

What am I doing wrong?

share|improve this question
    
Interesting that 20001-14101=5900, the default VNC port. –  sciurus Jan 16 at 18:07

1 Answer 1

up vote 1 down vote accepted

You aren't doing anything wrong. The VNC protocol specifies that the "port" isn't actually a port, but an offset from 5900, the default VNC port.

Thus localhost:0 would connect to port 5900, localhost:1 would connect to port 5901, etc.


By default, libvirt only binds VNC listeners to localhost, regardless of what you specify on the command line. To change this, you need to edit the appropriate option in /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"

Make sure to reload or restart libvirtd after making this change.

share|improve this answer
    
OK, but why "localhost"? I mean - I want it to listen on all interfaces/addresses, and not only 127.0.0.1 –  user195086 Jan 16 at 18:08
    
Oops, missed that part. See the edit. –  Michael Hampton Jan 16 at 18:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.