vagrant icon indicating copy to clipboard operation
vagrant copied to clipboard

mutiple static IP addresses to one interface eg. IPv4 and IPv6 dual stack not possible

Open godfryd opened this issue 5 years ago • 6 comments

It seems that it is not possible to configure two IP addresses on one network interface. I wanted to have 1 IPv4 and 1 IPv6 address assigned to one interface like this

enp0s9: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.50.252  netmask 255.255.255.0  broadcast 192.168.50.255
        inet6 fe80::a00:27ff:fed0:c918  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:d0:c9:18  txqueuelen 1000  (Ethernet)
        RX packets 422  bytes 50343 (50.3 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 300  bytes 34995 (34.9 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

inet 192.168.50.252 and inet6 fe80::a00:27ff:fed0:c918

godfryd avatar Mar 11 '19 16:03 godfryd

Hi there,

Thank you for opening an issue. However, there is not enough information here to reproduce or provide a recommendation. When you first open an issue, a template is pre-filled in the box. That template provides instructions for getting your host and guest information, the version of Vagrant, and the debug output. Without that information, it is very challenging for us to assist you.

Please supply that information either by updating this ticket or by closing this ticket and opening a new one. Thank you!

briancain avatar Mar 11 '19 16:03 briancain

I do not understand the question. Reported issue is simple. What do you need more? Please, be more specific. There is no way to configure 2 different IP addresses on 1 network interface. It would be good to be able to do that.

godfryd avatar Mar 12 '19 06:03 godfryd

@godfryd You did not specify:

  • What Vagrant guest (and operating system) you are trying this is on
  • How you are trying to configure it through Vagrant inside a Vagrantfile
  • What provider you are using to configure your networks
  • A debug log showing the behavior you are experiencing
  • Version of Vagrant (network fixes/implementations change between versions)

This is all covered in the issue template which is provided when you open a new issue.

Without this information, it could be a lot of things. Providing that information helps us narrow down what could be going wrong with Vagrant.

briancain avatar Mar 12 '19 15:03 briancain

What Vagrant guest (and operating system) you are trying this is on

Ubuntu 18.04

How you are trying to configure it through Vagrant inside a Vagrantfile

This is the question. It is not possible currently.

What provider you are using to configure your networks

virtualbox

A debug log showing the behavior you are experiencing

None

Version of Vagrant (network fixes/implementations change between versions)

2.2.3

godfryd avatar Mar 12 '19 16:03 godfryd

This could easily be accomplished by using the auto_config: false flag for the network config option. You can then use a provisioner or trigger to run after the guest is up to add your second ip to the configured interface using the /sbin/ip tool.

https://askubuntu.com/questions/547289/how-can-i-from-cli-assign-multiple-ip-addresses-to-one-interface

Because this option is very provider and platform specific, there's no one solution here. Happy to leave this open in case someone feels motivated to pick it up and make a pull request. Thanks!

briancain avatar Mar 12 '19 18:03 briancain

Yes, I did this that way but this is fragile as I had to assume interface names. What if they change in the future? I do not have that guarantee. So I would prefer to have such ability on Vagrantfile network level.

godfryd avatar Mar 13 '19 05:03 godfryd