In this post we will see on how to connect to a VM through number of ways such as remote connection SSH, VNC and console) and through locally in Hypervisor using tools like virt-viewer and virt-manager. Some of the posts which we already covered are..

As mention above we can connect to a guest VM using many techniques available. These are divided in two types

  1. Local connection
  2. Remote connection

Connect VM locally in KVM hypervisor: We can connect/view guest machine when we are on KVM hypervisor it’self. Some tools which we can use to connect through are virt-manager and virt-viewer

Related concept:   How to set password to a user account in Linux?

Example1 : Connect Guest Virtual machine through virt-manager. Execute below command in the terminal of a Hypervisor and you will see virt-manager GUI, from there you can manage different VM’s and view the VM’s as well




VM booting

vm login

Example2: We can connect using virt-viewer as well to a specific machine.

virt-viewer -c qemu:///system BaseMachine

-c is to connect to a specific emulator, here it is qemu is the connecting protocol. BaseMachine is my VM name.

Example3: Connect guest VM using vncviewer command. In order to connect through VNC we have to check where and on which port our VM is running by using virsh domdisplay command

virsh domdisplay BaseMachine
virsh vncdisplay Clusterbase



Now connect to this IP and port


or we can combine vncviewer and virsh vncdisplay command as show below.

vncviewer $(virsh vncdisplay Clusterbase)

Example5: We can even connect through SSH connection too.

ssh [email protected]


ssh [email protected]
[email protected]’s password:
Last login: Mon Feb 25 08:47:02 2013 from
[sur[email protected] ~]$ ifconfig
eth0 Link encap:Ethernet HWaddr 52:54:00:EC:35:BF
inet addr: Bcast: Mask:
inet6 addr: fe80::5054:ff:feec:35bf/64 Scope:Link
RX packets:1119 errors:0 dropped:0 overruns:0 frame:0
TX packets:66 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:75775 (73.9 KiB) TX bytes:9226 (9.0 KiB)

Related concept:   KVM virtualization: Install Redhat/CentOS/Fedora as Guest OS in KVM hypervisor?

Example6: We can even connect through console by editing ttyS0 terminal located in /etc/init/ttyS0 file.

In our next post we will see on how to connect to a virt-manager to manager VM’s