Connect VMs directly from host using Qemu-monitor

Source: Internet
Author: User

There are many aspects of connecting a virtual machine directly from a physical machine, such as a bridge, Iptables way

An interesting way to see it recently is to access the VM through the settings of QEMU Monitor, and libvirt the control of monitor scoket, so it can be manipulated by the Virsh command.


# Virsh Qemu-monitor-command--hmp instance-00000186 ' help Hostfwd_add '
hostfwd_add [vlan_id name] [tcp|udp]:[ Hostaddr]:hostport-[guestaddr]:guestport--redirect TCP or UDP connections from host to guest (requires-net user)


Finally, let's look at the results:


# Virsh Qemu-monitor-command--hmp instance-0000018 ' hostfwd_add:: 2222-:22 '
# ssh-p 2222 localhost
password:< C3/>last login:tue 10:28:38 from 192.168.5.73
linux-wllabs:~ #



 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.