From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Craven Subject: [PATCH] doc: Add information related to network connectivity with qemu. Date: Wed, 28 Sep 2016 18:49:25 +0200 Message-ID: <20160928164925.16921-1-david@craven.ch> Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:56065) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpI3I-00053l-Ae for guix-devel@gnu.org; Wed, 28 Sep 2016 12:49:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bpI39-0006MG-F3 for guix-devel@gnu.org; Wed, 28 Sep 2016 12:49:47 -0400 Received: from so254-10.mailgun.net ([198.61.254.10]:42318) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpI38-0006LD-36 for guix-devel@gnu.org; Wed, 28 Sep 2016 12:49:39 -0400 List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: guix-devel@gnu.org * doc/guix.text: Add it. --- doc/guix.texi | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/doc/guix.texi b/doc/guix.texi index 785d6fb..5173ca7 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -11030,6 +11030,45 @@ which may be insufficient for some operations. The file name of the qcow2 image. @end table +The default @command{run-vm.sh} script that is returned by an invokation of +@command{guix system vm} does not add a @command{-net user} flag by default. +To get network access from within the vm add the @code{(dhcp-client-service)} +to your system definition and start the vm using +@command{$(guix system vm config.scm) -net user}. An important caveat of using +@command{-net user} for networking is that @command{ping} will not work, because +it uses the ICMP protocol. You'll have to use a different command to check for +network connectivity, I'll leave this as an exercise for the reader. + +@subsubsection Connecting through ssh + +To enable ssh inside a vm you need to add a ssh server like @code{(dropbear-service)} +or @code{(lsh-service)} to your vm. The @code{(lsh-service}) doesn't currently +boot unsupervised. It requires you to type some characters to initialize the +randomness generator. In addition you need to forward the ssh port, 22 by +default, to the host. You can do this with +@command{$(guix system vm config.scm) -net user,hostfwd=tcp::10022-:22}. To connect +to the vm you can run +@command{ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 10022}. +The @command{-p} tells @command{ssh} the port you want to connect to. +@command{-o UserKnownHostsFile=/dev/null} prevents @command{ssh} from complaining +every time you modify your @command{config.scm} file and the +@command{-o StrictHostKeyChecking=no} prevents you from having to allow a +connection to an unknown host every time you connect. + +@subsubsection Using virt-viewer with spice + +The default qemu graphical client isn't very nice. As an alternative you can +use the @command{remote-viewer} from the @command{virt-viewer} package. To +connect pass the @command{-spice port=5930,disable-ticketing} flag to +@command{qemu}. See previous section for further information on how to do this. + +Spice also allows you to do some nice stuff like share your clipboard with your +vm. To enable that you'll have to in addition pass the following flags to +@command{qemu}: @command{-device virtio-serial-pci,id=virtio-serial0,max_ports=16,bus=pci.0,addr=0x5} +@command{-chardev spicevmc,name=vdagent,id=vdagent} +@command{-device virtserialport,nr=1,bus=virtio-serial0.0,chardev=vdagent,name=com.redhat.spice.0}. +You'll also need to add the @code{(spice-vdagent-service)}. + @node Defining Services @subsection Defining Services -- 2.9.0