# ipv6 and radvd

## paradigm-X

I have a system configured not to use ipv6, i.e., with '-ipv6' USE flag setting in 'make.conf'. Yet, when I want to re-emerge libvirt using either firewalld or virt-network flags, I can see that the radvd package would be pulled in. From what I see of radvd-related information, it is a package with the sole purpose to manage ipv6 routing. So, I am failing to understand why it would be brought in to the equation when I have specified not to make use of ipv6. In fact, even when I manually specified not to use it by doing USE="-ipv6 virt-network ...etc" emerge -av libvirt, I still see the procedure want to include it. Why is that happening?

----------

## miket

Your problem is that net-misc/radvd is unconditionally pulled in as a dependency of libvirt when you specify USE=virt-network, and enabling firewalld gets you virt-network whether you specify it or not.

I get along quite happily running VM's without libvirt.  In my setup, even though I do have IPv6 with stateless autoconfiguration (the service that radvd is--router advertisment daemon), it's already in place at the router on my network.  Since I use bridged networking, I too would be unhappy if my virtualization setup pulled in radvd.  Since I don't have libvirt, that's another issue I don't have to bother with!  :)

----------

## miket

Your problem is that net-misc/radvd is unconditionally pulled in as a dependency of libvirt, and enabling firewalld gets you libvirt whether you specify it or not.

I get along quite happily running VM's without libvirt.  In my setup, even though I do have IPv6 with stateless autoconfiguration (the service that radvd is--router advertisment daemon), it's already in place at the router on my network.  Since I use bridged networking, I too would be unhappy if my virtualization setup pulled in radvd.  Since I don't have libvirt, that's another issue I don't have to bother with!  :)

----------

## paradigm-X

I don't believe you're right about this point: "Your problem is that net-misc/radvd is unconditionally pulled in as a dependency of libvirt, and enabling firewalld gets you libvirt whether you specify it or not."

Libvirt, which I have installed, does not depend on radvd, which I do not have currently and would like to avoid if at all possible. 

> "I get along quite happily running VM's without libvirt"

I think we have different goals in mind for using KVM. For one thing, I want to accelerate the VM with virtio drivers.

----------

## miket

Wow!  Something screwy happened in the forum software or my use of it, and you got the wrong version.

When I make my response to you, I had an interruption and then clicked the Submit button.  Attention back on screen, I looked at the message as posted to the forum, and to my annoyance, I saw what was up there was the incomplete version I had written before I had taken a more careful look at the ebuild.  Seconds later I made my correction.  I had the distinct memory that the timestamp on the message was 9:00 pm.

Now I see that for some perverse reason there are two message from me.  The corrected one has the timestamp of 9:00 pm, but the original, incorrect one is there with the timestamp of 9:23 pm.  Unfortunately, that was the one you noticed.  I can well imagine that you'd make the natural conclusion that the later version might be the correct one, so unfortunately you got the wrong message.  Sorry about that!

As you can read from the 9:00 pm message, this is what I meant: *Quote:*   

> Your problem is that net-misc/radvd is unconditionally pulled in as a dependency of libvirt when you specify USE=virt-network, and enabling firewalld gets you virt-network whether you specify it or not.

 

This is from the ebuild:

```
firewalld? ( virt-network )
```

and importantly,

```
virt-network? ( net-dns/dnsmasq

      >=net-firewall/iptables-1.4.10

      net-misc/radvd

      net-firewall/ebtables

      sys-apps/iproute2[-minimal]

      firewalld? ( net-firewall/firewalld )

   )
```

By the way, *paradigm-X wrote:*   

> I think we have different goals in mind for using KVM. For one thing, I want to accelerate the VM with virtio drivers..

 

Ah, but I do use virtio.

----------

## paradigm-X

You know, I am something of a noob with Gentoo, and I am certainly no expert yet in the area of virtualization, much less so with Linux KVM virtualization technology, which is a rich, powerful and complicated space, both user space and kernel space. But I do learn pretty quickly, especially when I find something that fascinates me as much as this does. So I am delighted as can be in having gotten this working now. I have managed to boot a live CD of a Linux OS with a graphical interface by fiddling around with the settings in Qemu, Libvirt and Virt-Manager. Not only did it end up working more easily than I expected it to do, but I was also able to avoid having to configure a bunch of ipv6 firewall settings in Radvd.

Since I do not have ipv6 enabled currently. like a slew of other persons, it made little sense to me that radvd should be a show-stopper under the circumstances, and reading more about firewalld made it clear enough to see that it serves an optional function. Consequently, I just left off the firewalld USE flag while keeping the virt-network flag. This allowed me to avoid any issues that radvd might cause together with it, at least that was my hope and I wanted to test it. Sure enough, I was then able to start up libvirtd without getting a bunch of error messages and failure. Then I fired up an X GUI and started virt-manager and started going through the steps for creating a VM from an existing ISO image file. Presto! After a little fiddling with it, I got past the points of previous failure from having no good network connection and whatnot.

I am sure that I still have a "lot" more manipulating of configurations to get it tweaked, but at least I know that I am on the right track and it "is" running a Linux GUI, with awesome graphics I might add. As I am accessing the VM directly from the same physical machine, there is no noticeable drag on movement of cursor or other hesitation from what I have seen so far. It's snappy.  Virt-manager is an impressive program and quite intuitive, I can see that already. I really appreciate the tight integration between guest features and functionality provided by paravirtualization drivers, i.e, Virtio. For example, I was even able to get shared folders working in a snap by following this procedure: "http://www.linux-kvm.org/page/9p_virtio".

I do still get one error that I need to figure out and work through. While I am at the terminal before having started the X GUI with startx, when I type 'libvirtd' and hit Enter, it starts up and displays a number of lines of standard output, as is normal for a program like it, but one of these lines indicates a problem, I think, but it may not really be one at all. I have to test it out a bit to be sure. What I see essentially is this:

   warning: ebiptablesDriverInitCLITools:4244 : Could not find 'ip6tables' executable

   error: virCommandWait: 2348 : internal error: Child process (/bin/sh -c 'EBT="/sbin/ebtables"

   cmd='\''$EBT -t nat -L'\'' etc....(it goes on here showing a line full of arcane symbols in a command...)

    ebiptablesDriverTestCLITools:4274 : Testing of ebtables command failed: Failure to execute command '$EBT -t nat -L' : 'The kernel doesn't support the ebtables 'nat' table.'.

I know that I have activated ebtables support in the kernel, at least some part of the functionality, and I know that I can get NAT connectivity to the internet with my virtual machine on KVM. So it may just be a matter of "turning off" the test, or living with it while I wait to decide whether I want to make use of ipv6 later. It could be a consequence of my not having ipv6 enabled, and meanwhile the test being made in ebtables for nat on ipv6 continues to run anyway.

So, I do have one apparent error in my current configuration, and it would probably help me to learn how to track it down and solve it in any case. I may not have any choice anyway, judging from the lack of interest I am seeing generated by this topic here. I will probably join a list too, one more specifically pertaining to this topic, which does not seem to be Gentoo-specific from what I can tell.

> "..but I do use virtio."

Okay, but you still have said nothing about what VM management program you do use. If you do not use Virt-Manager and you do make use of virtio support, what are you doing to make and manage your VMs? I know there are some other GUI programs available to help, but since you said you are not using libvirt, which, from what I have seen so far in my research, appears to be the most prevalent program for doing so, not to mention an excellent solution, I cannot imagine how painful it would be to have to resort to using a purely command line interface for all that business, not to mention terribly inefficient.

One big reason I would like to know is that I am very interested in finding a solution to enable me to utilize a GUI in the way that Virt-Manager does while at the same time to provide me with a way to see the equivalent raw commands in Qemu for starting the program with all the bells-and-whistles I might want to employ. In other words, I would like to find a way to translate the final result of the visual procedure into the actual command and parameters that would have to be made on the command line. Moreover, what would be even sweeter still is if I could find such a program  me to take these raw commands from Qemu and auto-magically implement them in a GUI like virt-manager. In this way, I could learn the ins-and-outs more efficiently and I could utilize command line tweaks learned elsewhere within a GUI to some extent. This approach is an excellent heuristic for me.

----------

## miket

I've put together a a number of odd KVM setups, but I never did get something all put together in a nice way to package.  Most all of them I've done use nothing more than Bash, QEMU, and properly configured kernels.  I use AQEMU as a manager to good effect on my laptop, but that's mostly out of laziness.  Bash'll get you there.  AQEMU basically glorifies what I can do in Bash; it makes things graphical without bringing in the kitchen sink that is libvirt.

This one setup starts up an image pulled from a machine with a motherboard that died.  That image has an old installation of KDE 3.10 along with old everything else.  I can run that now as a KVM guest.  What I did was go into that image to recompile the kernel with virtio drivers and video and sound drivers for the emulated hardware, edit the guest's /etc/fstab, and then go to town.  I used the same version of the kernel and I didn't recompile anything else.

Yes, it took a while to work things up.  Basically, I got tired of entering the QEMU command line so many times.

This script below starts the guest and displays its full graphical glory via SDL (which is almost certainly how libvirt does things).  Note the parameters it sets at the top.  I've added comments to describe them.  You can take this is a starting point.  I apologize for the rough edges.

Note that I run the guest as a normal user.  Yes, this does require membership in the kvm group.  (You might have that already set up from libvirt.)

```
#!/bin/bash

# Start tommy on KVM

/* The SERVER_NAME shows up on the VM's titlebar and is intended to be useful

   for being able to address the particular running image. */

SERVER_NAME=tommy

/* Name of PID file for the instance; leave this commented out if you don't

   want one. */

#PIDFILE=/var/run/kvm/tommy.pid

/* Number of processor cores to make visible to the guest */

SMP='cores=2'

/* Kernel image to use to boot the guest.  The image file is stored in

   the host machine's file system, not the guest's. */

KERNEL=/var/kvm/tommy/boot/vmlinuz-2.6.29-gentoo-r5-virtio.02

/* Kernel command-line parameters */

KERNEL_PARMS='root=/dev/vda5 fbcon=scrollback:128k video=vesafb vga=0x317 res=1280x1024 clock=pit'

/* MAC address to expose to the guest. */

MACADDR=52:54:C0:A8:E0:10

/* An earlier version of the script had a parameter for the

   host-facing interface name for bridged networking, but because of

   QEMU's bridge-helper, it is no longer necessary to set this.

   This line below DOES set up bridged networking (it's the fastest

   and the the most flexible).  If you want some other mode of KVM

   networking, look through the documentation and experiment. */

NET=( "tap,model=virtio,macaddr=${MACADDR},helper=/usr/libexec/qemu-bridge-helper" )

/* Pathname of image file for virtual disk.  Note that the /etc/fstab

   within the guest will refer to the partitions on this image as

   /dev/vda1, /dev/vda2, etc.

   This parameter, as is the NET variable above, is a Bash array.

   If you need additional emulated drives or network adapters, add

   array entries as necessary. */

DRIVE=( 'if=virtio,file=/var/kvm/tommy/tommy.raw.img' )

/* Model of emulated video device. */

VGA=cirrus

/* Model of emulated sound device. */

SOUNDHW=hda

/* Useful if you plan to run the guest in non-graphical mode:  start

   guest with its console set up in a Screen session using the given

   name.  (Yes, the app-misc/screen package.)

   Comment out if not needed. */

#SCREEN_SESSION=tommy_console

/* Set up the QEMU monitor using something other than the default.

   Using the sample setting of

       MONITOR=telnet::60001,server,nowait

   the monitor is available by issuing this command:

       nc localhost 60001

*/

MONITOR=telnet::60001,server,nowait

/* Set to a nonzero value to display the qemu command line before

   executing it. */

ECHO_COMMAND=1

/* End of the configurable parameters */

KVM_EXEC=/usr/bin/qemu-kvm

SCREEN_EXEC=/usr/bin/screen

CMD="$KVM_EXEC -name $SERVER_NAME"

for i in $(seq 0 $((${#DRIVE[@]} - 1)))

do

        CMD="$CMD -drive ${DRIVE[$i]}"

done

for i in $(seq 0 $((${#NET[@]} - 1)))

do

        setup="${NET[$i]}"

        hw_side=nic,vlan=$i

        sw_side="${setup%%,*},vlan=$i"

        setup="${setup#*,}"

        while [ -n "$setup" ]; do

                pair="${setup%%,*}"

                setup="${setup:${#pair} + 1}"

                var="${pair%%=*}"

                if [ 'macaddr' = "$var" -o 'model' = "$var" \

                        -o 'name' = "$var" -o 'addr' = "$var" ]; then

                        hw_side="$hw_side,$pair"

                else

                        sw_side="$sw_side,$pair"

                fi

        done

        CMD="$CMD -net $hw_side -net $sw_side"

done

if [ -n "$KERNEL" ]; then

        CMD="$CMD -kernel $KERNEL"

        if [ -n "$KERNEL_PARMS" ]; then

                CMD="$CMD -append "'\"'${KERNEL_PARMS}'\"'

        fi

fi

if [ -n "$PIDFILE" ]; then

        CMD="$CMD -pidfile $PIDFILE"

        piddir=`dirname "$PIDFILE"`

        if [ ! -d "$piddir" ]; then

                mkdir -p "$piddir"

        fi

fi

if [ -n "$SMP" ]; then

        CMD="$CMD -smp $SMP"

fi

if [ -n "$SOUNDHW" ]; then

        CMD="$CMD -soundhw "'\"'${SOUNDHW}'\"'

fi

if [ -n "$VGA" ]; then

        CMD="$CMD -vga $VGA"

fi

if [ -n "$CONSOLE" ]; then

        CMD="$CMD $CONSOLE"

fi

if [ -n "$MONITOR" ]; then

        CMD="$CMD -monitor $MONITOR"

fi

if [ -n "$SCREEN_SESSION" ]; then

        CMD="$SCREEN_EXEC -d -m -S "$SCREEN_SESSION" $CMD"

fi

if [ "$ECHO_COMMAND" -ne 0 ]; then

        echo $CMD

fi

eval $(eval "echo $CMD")
```

----------

