Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Virtualization and Cloud
User Name
Linux - Virtualization and Cloud This forum is for the discussion of all topics relating to Linux Virtualization and Linux Cloud platforms. Xen, KVM, OpenVZ, VirtualBox, VMware, Linux-VServer and all other Linux Virtualization platforms are welcome. OpenStack, CloudStack, ownCloud, Cloud Foundry, Eucalyptus, Nimbus, OpenNebula and all other Linux Cloud platforms are welcome. Note that questions relating solely to non-Linux OS's should be asked in the General forum.


  Search this Thread
Old 04-14-2018, 07:43 AM   #1
Registered: Oct 2004
Location: Norway
Distribution: Slackware, CentOS
Posts: 641

Rep: Reputation: 36
Connecting to a virtual machine running on a Centos KVM host from Mac


Recently bought a new server to virtualise a few servers, and have so much spare capacity that I also want to virtualise a home computer for my private stuff, leaving my work Macbook strictly for work.

Unfortunately, I have come across a real newbie problem, where dozens of web searches give some information, but I simply cannot find out how to connect to the virtual machine display from my laptop.

Right now I use VMware remote console to remote connect to an old server running an old virtualised desktop and then launch virt-manager there to connect to the new KVM-server on CentOS with the virtualised desktop. That's not very efficient. When I connect from virt-manager I am asked for both the ssh key and the IP of the virtualised host.

So the question is - how do I get the VNC client on OSX to connect directly to the virtualised desktop on the KVM machine?

The Centos KVM host running all the virtualised machines is on
The virtualised desktop I want to connect to is on

The MacBook is on but that's hardly relevant. However, it might be worth mentioning that the Centos KVM host has a bridge interface so all virtualised machines are accessible from the network.

On OSX VNC client, do I need to ssh to the Centos KVM host on .11, or the virtualised machine on .33? Which IPs do I type in where, in order to work remotely?

Thanks a bunch in advance!
Old 04-16-2018, 01:17 PM   #2
LQ Newbie
Registered: Jul 2017
Distribution: korora
Posts: 23

Rep: Reputation: Disabled
If you're opening straight VNC (no security, be warned!), it's probably in the 5000/tcp range. At some point on the destination system in question, check for listening sockets:
[code]netstat -tlpn/[code]
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name 
tcp        0      0   *               LISTEN      1/systemd        
tcp        0      0    *               LISTEN      1326/sshd        
tcp        0      0  *               LISTEN      1634/master
My output shows that system is listening on ports 111 (rpcbind, something with nfs), 22 (ssh), and locally to 25 (smtp). You should see Xvnc or something listening around port 5000 or even 5900 (5901 is X display :1, 5902 is :2, etc., depending on implementation).

Make sure the firewall is open, and that the vnc client system can reach the target port (I struggled with kvm network bridging and never really got the networks to be fully connected) on the target IP address.

You type into your vnc client the target hostname or IP address, along with either the port number or even the X display. Again, it might be implementation-specific.

  2. (disclaimer: my blog)

Now, when I've set up vms for virtual desktops, I set up a whole terminal service. If you're interested in a slightly different approach that uses RDP (and I know MacOS has a mstsc client for rdp), check out my blog post about it:
1 members found this post helpful.
Old 04-17-2018, 09:32 AM   #3
Registered: Dec 2012
Location: The Netherlands
Distribution: Fedora 27 & CentOS 7
Posts: 62

Rep: Reputation: 8
Depending on where you installed the VNC server is where you connect.
Whilst using KVM I suspect you added a "Display VNC" in virt-manager or similar when creating your VM, in that case you connect to the host. If you chose to run a VNC server in your VM itself then you would connect to the VM's ip.

Besides that there is not much I can share that bgstack15 didnt already except for my personal preference in running remote desktops.
Using KVM VM's I prefer to use Spice, it renders only what is needed and even allows USB sharing:


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Kernel-based Virtual Machine (KVM): Switching from KVM guest to host (e.g. Linux Mint) & maximize guest screen fanoflq Linux - Newbie 2 07-13-2016 06:10 PM
Keeping size of VM file down - QEMU/KVM guest running Centos 6, inside Centos 6 host rylan76 Linux - Virtualization and Cloud 2 01-24-2013 03:22 PM
[SOLVED] Issue with ssh connection between Centos host OS and Ubuntu 10.04 Running on Virtual sriramdas Linux - Virtualization and Cloud 2 01-16-2013 09:00 PM
connecting to kvm virtual machine sanaz Linux - Virtualization and Cloud 1 10-06-2012 10:02 AM
Running Fedora 14 as virtual machine on Windows 7 Host/can ping no internet JHuff15 Linux - Newbie 5 02-05-2011 04:57 PM > Forums > Linux Forums > Linux - Virtualization and Cloud

All times are GMT -5. The time now is 12:43 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration