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..
- What is Virtualization in Linux way?
- Types of Virtualization available in Linux/Unix
- Advantages of Virtualization
- What is KVM virtualization in Linux?
- KVM Virtualization: Find Hardware support KVM/VMware ESXi or not?
- KVM virtualization: Install KVM hypervisor in Redhat/CentOS/Fedora Linux?
- KVM virtualization: Install KVM hypervisor in Ubuntu/Debian Linux?
- KVM virtualization: Install Ubuntu Linux as Guest OS in KVM hypervisor?
- KVM virtualization: Install Redhat/CentOS/Fedora as Guest OS in KVM hypervisor?
- KVM virtualization: Network(NAT) configuration in KVM hypervisor?
As mention above we can connect to a guest VM using many techniques available. These are divided in two types
- Local connection
- 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
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
virt-manager
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
or
virsh vncdisplay Clusterbase
Output:
vnc://127.0.0.1:0
Now connect to this IP and port
vncviewer 127.0.0.1:1
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 surendra@192.168.100.129
Output:
ssh surendra@192.168.100.129
surendra@192.168.100.129’s password:
Last login: Mon Feb 25 08:47:02 2013 from 192.168.100.1
[surendra@www ~]$ ifconfig
eth0 Link encap:Ethernet HWaddr 52:54:00:EC:35:BF
inet addr:192.168.100.129 Bcast:192.168.100.255 Mask:255.255.255.0
inet6 addr: fe80::5054:ff:feec:35bf/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
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)
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
Latest posts by Surendra Anne (see all)
- Docker: How to copy files to/from docker container - June 30, 2020
- Anisble: ERROR! unexpected parameter type in action:
Fix - June 29, 2020 - FREE: JOIN OUR DEVOPS TELEGRAM GROUPS - August 2, 2019
- Review: Whizlabs Practice Tests for AWS Certified Solutions Architect Professional (CSAP) - August 27, 2018
- How to use ohai/chef-shell to get node attributes - July 19, 2018