at work, we may have access to a KVM virtual machine, and many of the company's applications will run on a KVM virtual machine. As a result, the use of KVM is one of the essential capabilities of operations. So in the practice of KVM, we will certainly often think about how to be more in-depth, more standard practice of good KVM. As a result, many use experiences (techniques) have been triggered.
Today, we'll show you how to use the KVM console interface feature.
Under normal circumstances, after installing KVM, you may be connected to the KVM virtual machine via VNC to set the corresponding IP and other information. But this, on the one hand, may be due to open too many ports to create security problems, on the other hand is not convenient. In this case, we can use the console interface function provided by KVM, which can be used to connect the Linux virtual machine console using the character interface. This way, the timely KVM virtual machine does not have an IP address, or the KVM virtual machine has a problem through the IP connection does not go in, can be very convenient to quickly into the KVM virtual machine inside to troubleshoot the problem.
The console interface of the KVM virtual machine connects the app as shown in the effect:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/56/BA/wKiom1SLAMji-3E1AAGbxXuhsB8961.jpg "title=" 291923478947564.png "alt=" Wkiom1slamji-3e1aagbxxuhsb8961.jpg "/>
Let's see how to use this feature!
as shown, you can use the command "Virsh console virtual machine name" in the form of a character interface to connect to the name of the KVM virtual machine you specified. The following prompt appears:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/56/B7/wKioL1SLAVaxEjZjAABhsFZ4_is488.jpg "title=" 291924049098164.png "alt=" Wkiol1slavaxejzjaabhsfz4_is488.jpg "/>
at this prompt, you need to enter the car, if after the carriage return, no response, it means that the KVM virtual machine you specified does not have the console function turned on.
You can use the console function directly if the following is the case.
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/56/B7/wKioL1SLAYPSQvEGAAC8dKf9eZw928.jpg "title=" 291924445503322.png "alt=" Wkiol1slaypsqvegaac8dkf9ezw928.jpg "/>
If you do not have an open console, you can open it manually by doing the following.
1. Modify the grub.conf file
allow the kernel to direct the output to ttyS0 by passing the parameter console=ttys0 for the kernel
# vim/etc/grub.conf
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/56/BA/wKiom1SLAP_TR8GWAAJ0-Dujw9A881.jpg "title=" 291925113155445.png "alt=" Wkiom1slap_tr8gwaaj0-dujw9a881.jpg "/>
2. Modify the/etc/inittab file
by adding a ttyS0 in Inittab to enable the system to generate a ttyS0 to receive data from the kernel when it is started
# echo "S0:12345:respawn:/sbin/agetty ttyS0 115200" >>/etc/inittab
S0:12345:respawn:/sbin/agetty ttyS0 115200
3. Modify the/etc/securetty file
Since the/etc/securetty file allows you to specify which TTY device the root user can log from, we need to add a ttyS0 security license to add ttyS0 to the file to allow our root user to log in.
# echo "TtyS0" >>/etc/securetty
4. Restart the KVM virtual machine
# reboot
5. Login Verification
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/56/BA/wKiom1SLAR7AbbDFAAGluFeedpk001.jpg "title=" 291925195655525.png "alt=" Wkiom1slar7abbdfaaglufeedpk001.jpg "/>
Ok!
The above is the content of this blog post!
This article is from the "not only Linux" blog, so be sure to keep this source http://nolinux.blog.51cto.com/4824967/1589488
Let the KVM virtual machine support the console feature