[Vmdebootstrap-devel] Two different Stretch vagrant boxes getting same IP address

Mariappan Ramasamy rmariappan at outlook.com
Sat Jul 15 13:33:51 UTC 2017


Hi all,


I was trying to create a network of two debian stretch hosts using vagrant. Please find the Vagrantfile at the end of this mail.


Vagrant does not come up properly and only one of the boxes comes up properly.

After some analysis found both boxes are getting same IP address due to the Client Identifier(DHCP Option 61) used.


Systemd DHCP uses DUID as vendor type and using /etc/machineid as key for generating ClientId.

Since two vagrant boxes are created from same base box, both boxes contains same machineid and hence the same Clientid.


The solution is to add the following in "/etc/systemd/network/99-dhcp.network"

[DHCP]
ClientIdentifier=mac
The above changes causes systemd to use the mac address as the client identifier instead of the DUID which solves the problem for me.


<https://www.freedesktop.org/software/systemd/man/systemd.network.html#ClientIdentifier=>

Debian vagrant boxes uses vmdebootstrap script to generate base-box and --enable-dhcp option adds the above configuration.

Hence mailing to this list.


Can you please share your views on this ?

If this changes are fine, can you please merge this or point me on how to create a patch and submit?


Thanks

Mari


Reference:

Systemd uses machineid to generate DUID

https://www.freedesktop.org/software/systemd/man/networkd.conf.html#vendor%20

https://www.freedesktop.org/software/systemd/man/systemd.network.html#ClientIdentifier=


Vagrantfile:

Vagrant.configure(2) do |config|

  config.vm.define "stretch1" do |stretch1|
    stretch1.vm.box = "debian/stretch64"
    stretch1.vm.hostname = "stretch1"

    stretch1.vm.network "private_network",
        :libvirt__tunnel_type => 'udp',
        :libvirt__tunnel_port => '11111',
        :libvirt__tunnel_local_port => '11121',
        :libvirt__iface_name => 'swp1'
  end

  config.vm.define "stretch2" do |stretch2|
    stretch2.vm.box = "debian/stretch64"
    stretch2.vm.hostname = "stretch2"

    stretch2.vm.network "private_network",
        :libvirt__tunnel_type => 'udp',
        :libvirt__tunnel_port => '11121',
        :libvirt__tunnel_local_port => '11111',
        :libvirt__iface_name => 'swp1'
  end
end


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/vmdebootstrap-devel/attachments/20170715/47beb599/attachment.html>


More information about the Vmdebootstrap-devel mailing list