3

I am trying to configure IPv4 and IPv6 address on Internal network Vagrant interface but I am unable to do so.

Here is the configuration:

  config.vm.network "private_network", 
      ip: "192.168.30.10",
      ip: "fd::10",
      virtualbox__intnet: true,
      bridge: "eth1"
  config.vm.network "private_network",
      ip: "192.168.40.10",
      virtualbox__intnet: true,
      bridge: "eth2"

Ideally I would love to setup link-local address manually but I got error when booting up VM. For now I can work with private IPv6 addresses. Is the only way to turn off auto-config and set it up inside VM?

0

You can absolutely Disable Auto-Configuration using the auto_config property as shown below:

Vagrant.configure("2") do |config|
  config.vm.network "private_network", ip: "192.168.30.10",
    auto_config: false
end

Then you can just run some shell provisioners later on to configure them how you want them:

  # default router
  config.vm.provision "shell",
    run: "always",
    inline: "route add default gw 192.168.0.1"

  # default router ipv6
  config.vm.provision "shell",
    run: "always",
    inline: "route -A inet6 add default gw fc00::1 eth1"

  # delete default gw on eth0
  config.vm.provision "shell",
    run: "always",
    inline: "eval `route -n | awk '{ if ($8 ==\"eth0\" && $2 != \"0.0.0.0\") print \"route del default gw \" $2; }'`"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.