Friday, February 05, 2010

Proxmox KVM - Reach VNC in IPv6

These days, I am playing with Proxmox, a free and open-source Linux distribution which provides an easy solution for virtualization. In fact, they include:
  • a linux kernel with KVM (full virtualization) and OpenVZ (containers)
  • an interface to manage kvm, openvz, storage, backups and also monitoring

You can create, start, stop your virtual machines or containers via the web interface. For a KVM, they even provide a VNC java applet to see the screen of your virtual machine. This is amazing!

However, there is a small issue with this VNC java applet and IPv6...
As you can see in your daemon.log file, pvedaemon creates a socket with nc (netcat):
Feb  5 18:20:17 proxmox pvedaemon[6885]: CMD: /bin/nc -l -p <port>
  -w 30 -c /usr/sbin/qm vncproxy <VM id> <random string used as a key> 2>/dev/null
The problem is that netcat is not IPv6-compliant. Not surprising: GNU Netcat latest version 0.7.1 was released on 11 Jan 2004, six years ago!

An IPv6-compliant port of netcat exists, it's netcat6.
A very powerful alternative to netcat is socat, also called "netcat++" because it offers so many features, including IPv6.

However, Proxmox does not use either netcat6 nor socat. In the meantime we could still use socat to listen exclusively on IPv6 TCP socket and forward trafic to the IPv4 TCP socket.
$ socat TCP6-LISTEN:5900,ipv6only=1,fork TCP:localhost:5900
Notes:
  • this command will never exit (it forks on every connection)
  • you may have to start similar socat on ports 5901 and above (pvedaemon starts netcat listening on first available port above 5900)

Now you can view your virtual machine screen in IPv6. ;)

3 comments:

  1. Do you know how to configure the proxmox web interface so that it works on IPV6? (https://[ipv6Address]:8006) saw your comment on the forum, said you had this working?

    Thanks..

    ReplyDelete
  2. If I recall correctly you just need IPv6 working on the proxmox node. The web interface is run by Apache which listens on both IPv4 and IPv6.
    That said, it's been a while I haven't used proxmox, I hope it still works like this. Good luck!

    ReplyDelete
  3. Yup seems to work fine for V2.3 and under, but starting V3 and up I think they started using pveproxy in place of apache so no luck yet.. oh well v2.3 will suffice, thanks again for your input

    ReplyDelete