Project

Profile

Help

Ipv6 configuration

Solution for docker

ipv6 already exist but docker daemon is not configured
restart docker with ipv6 support:

service docker stop
docker daemon --ipv6 &

then ssh with vagrant to machine and get ipv6

Solution for libvirt

We will need to change network setting for libvirt (for default network which is mapped to virbr0 interface on host)
We need to get current configuration and add ipv6 to that
before:

virsh net-dumpxml default
<network connections='1'>
  <name>default</name>
  <uuid>...</uuid>
  <forward mode='nat'>
    <nat>
      <port start='1024' end='65535'/>
    </nat>
  </forward>
  <bridge name='virbr0' stp='on' delay='0'/>
  <mac address='...'/>
  <ip address='192.168.122.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.122.2' end='192.168.122.254'/>
    </dhcp>
  </ip>
</network>

after we need to edit config with virsh net-edit default:

virsh net-dumpxml default
<network connections='1'>
  <name>default</name>
  <uuid>...</uuid>
  <forward mode='nat'>
    <nat>
      <port start='1024' end='65535'/>
    </nat>
  </forward>
  <bridge name='virbr0' stp='on' delay='0'/>
  <mac address='...'/>
  <ip address='192.168.122.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.122.2' end='192.168.122.254'/>
    </dhcp>
  </ip>
  <ip family='ipv6' address='2000:abcd:1:dead::1' prefix='64'>
  </ip>
</network>

then we need to restart network:

virsh net-destroy default
virsh net-start default
virsh net-autostart default

and you will see that ipv6 edded with command ifconfig (or ip address)

virbr0    Link encap:Ethernet  HWaddr 52:54:00:50:f4:f2
          inet addr:192.168.122.1  Bcast:192.168.122.255  Mask:255.255.255.0
          inet6 addr: 2000:abcd:1:dead::1/64 Scope:Global
          inet6 addr: fe80::5054:ff:fe50:f4f2/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:198 errors:0 dropped:0 overruns:0 frame:0
          TX packets:205 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:30930 (30.9 KB)  TX bytes:37576 (37.5 KB)

Add to Vagrantfile next lines:

NODE_NAME.vm.network :public_network, :dev => "virbr0", :mode => "bridge", :type => "bridge" 

Example

Vagrant.configure(2) do |config|
config.omnibus.chef_version = '12.9.38'
### Default (VBox, Libvirt, Docker) Provider config ###
#######################################################
# Network autoconfiguration
config.vm.network "private_network", type: "dhcp" 
config.vm.boot_timeout = 60
#  --> Begin definition for machine: node_000
config.vm.define "node_000" do |node_000|
        node_000.vm.network :public_network, :dev => "virbr0", :mode => "bridge", :type => "bridge" 
        node_000.vm.box = "centos/7" 
        node_000.vm.hostname = "node000" 
        node_000.vm.synced_folder "./", "/vagrant", type: "rsync" 
        node_000.vm.synced_folder "~/build-scripts/test-setup-scripts/cnf", "/home/vagrant/cnf_templates", type:"rsync" 
        node_000.vm.provider :libvirt do |qemu|
                qemu.driver = "kvm" 
                qemu.memory = 512
        end
        node_000.vm.provision 'shell', inline: 'curl -L https://omnitruck.chef.io/install.sh | sudo bash -s -- -v 12.9.38'      ##--- Chef binding ---
        node_000.vm.provision "chef_solo" do |chef|
                chef.cookbooks_path = "../recipes/cookbooks/" 
                chef.roles_path = "." 
                chef.add_role "node_000" 
        end
end #  <-- End of Qemu definition for machine: node_000
#
...

now we can get VM ipv6:

vagrant ssh -- ip -6 addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436
   inet6 ::1/128 scope host
      valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qlen 1000
   inet6 fe80::5054:ff:fe97:3627/64 scope link
      valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qlen 1000
   inet6 2000:abcd:1:dead:5054:ff:fe83:b7af/64 scope global dynamic
      valid_lft 3508sec preferred_lft 3508sec
   inet6 fe80::5054:ff:fe83:b7af/64 scope link
      valid_lft forever preferred_lft forever

We need address with global dynamic with interface eth1