Ipv6 on KVM guest

From CDOT Wiki
Jump to: navigation, search

KVM Guest

The default network on Fedora/CentOS/RHEL IPv4 by default. Even you create a new virtual network it still default to use IPv4. In order to switch to IPv6 on a virtual network called "rchan", you need to use the virsh command to make the switch.

Network options in virsh:

    net-autostart                  autostart a network
    net-create                     create a network from an XML file
    net-define                     define (but don't start) a network from an XML file
    net-destroy                    destroy (stop) a network
    net-dumpxml                    network information in XML
    net-edit                       edit XML configuration for a network
    net-info                       network information
    net-list                       list networks
    net-name                       convert a network UUID to network name
    net-start                      start a (previously defined) inactive network
    net-undefine                   undefine an inactive network
    net-update                     update parts of an existing network's configuration
    net-uuid                       convert a network name to network UUID

Method 1

By using the net-destroy and net-edit options:

  • list all active virtual network
    virsh net-list --all
[root@newlm networks]# virsh net-list --all
Name                 State      Autostart     Persistent
default              active     yes           yes
rchan                active     yes           yes
  • Stop (Destroy) the virtual network "rchan"
    virsh net-destroy rchan
  • Edit the virtual network to support IPv6
    virsh net-edit rchan
  • Add the following line:
    <ip family='ipv6' address='2000:1122:3344:1::1' prefix='64'>

Restart libvirtd and the virtual bridge interface on the host should get the IPv6 address assigned. Reboot your virtual guests and they should get an IPv6 ip address.

Method 2

You can also use the "virsh net-dumpxml rchan", edit the xml file with ipv6 support and use the "virsh net-define rchan" command to activate ipv6 support.