You are not logged in.

#1 2015-09-16 16:13:24

giuscri
Member
From: Milan, Italy
Registered: 2013-08-19
Posts: 21

[SOLVED] [QEMU] Connect to the guest from the host.

I'd like to establish a connection to the guest (powered by QEMU) from the host. I've read that for doing so I need a tap interface, but I don't understand the topic so much.

What are the things I should setup for telnet'ing (as an example) the guest from the host?

Thanks in advance,
Giuseppe

Last edited by giuscri (2015-09-17 11:36:22)

Offline

#2 2015-09-16 16:20:35

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,810

Re: [SOLVED] [QEMU] Connect to the guest from the host.

If you use libvirt, adding an interface using the 'default' Virtual Network should be enough.


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

#3 2015-09-17 11:14:55

giuscri
Member
From: Milan, Italy
Registered: 2013-08-19
Posts: 21

Re: [SOLVED] [QEMU] Connect to the guest from the host.

EDIT: Whoops, I did test connection from the guest to the host via pinging it. But as stated in any QEMU manual, if the default networking configuration is used ICMP protocol is not working. Instead, trying to establish a plain TCP connection via netcat, it does work.

For future readers, as alphaniner suggests, just running the libvirt daemon sufficies. Running

$ qemu-system-x86_64 -enable-kvm <live-image>

then

# From the host, 192.168.1.42
$ nc -l -p 8080 192.168.1.42
# and from the client/QEMU
$ nc 192.168.1.42 8080

establishes a TCP connection.

Thanks. smile

Old post:

alphaniner wrote:

If you use libvirt, adding an interface using the 'default' Virtual Network should be enough.

Uhm. Could you be more specific? As libvirtd is running without logged errors

● libvirtd.service - Virtualization daemon
   Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; enabled; vendor preset: disabled)
   Active: active (running) since Thu 2015-09-17 13:10:36 CEST; 2min 8s ago
     Docs: man:libvirtd(8)
           http://libvirt.org
 Main PID: 4450 (libvirtd)
   CGroup: /system.slice/libvirtd.service
           ├─4297 /sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/lib/libvirt/libvirt_leaseshelper
           ├─4298 /sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/lib/libvirt/libvirt_leaseshelper
           └─4450 /usr/bin/libvirtd

Sep 17 13:10:36 feross systemd[1]: Starting Virtualization daemon...
Sep 17 13:10:36 feross systemd[1]: Started Virtualization daemon.
Sep 17 13:10:36 feross dnsmasq[4297]: read /etc/hosts - 2 addresses
Sep 17 13:10:36 feross dnsmasq[4297]: read /var/lib/libvirt/dnsmasq/default.addnhosts - 0 addresses
Sep 17 13:10:36 feross dnsmasq-dhcp[4297]: read /var/lib/libvirt/dnsmasq/default.hostsfile

two new interfaces are added to the host

$ ip link
...
10: virbr0@NONE: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state LOWERLAYERDOWN mode DEFAULT group default 
    link/ether 52:54:00:5e:cd:d4 brd ff:ff:ff:ff:ff:ff
11: virbr0-nic@NONE: <BROADCAST,MULTICAST> mtu 1500 qdisc fq_codel master virbr0 state DOWN mode DEFAULT group default qlen 500
    link/ether 52:54:00:5e:cd:d4 brd ff:ff:ff:ff:ff:ff

But now what am I supposed to do?

Last edited by giuscri (2015-09-17 11:27:00)

Offline

#4 2015-09-17 12:03:10

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,333
Website

Re: [SOLVED] [QEMU] Connect to the guest from the host.

giuscri wrote:

Could you be more specific? ... now what am I supposed to do?

Have you followed the instructions in the wiki?  I have no experience with this myself, but those instructions seem fairly detailed.  If you have followed them, you should be able to elaborate which steps worked, and at which step you are stuck.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

Board footer

Powered by FluxBB