Why are my cloned linux VMs fighting for the same IP

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
2
down vote

favorite
1












I've cloned two vSphere VMs off of an Ubuntu 17.10 template. After boot, they both claim the same IP and fight for it (ssh connections break off as the IP switches between them).



The hostnames and MAC addresses are different between the two machines. dhclient correctly claims two separate IPs, but the resolver in use is systemd-networkd.







share|improve this question
























    up vote
    2
    down vote

    favorite
    1












    I've cloned two vSphere VMs off of an Ubuntu 17.10 template. After boot, they both claim the same IP and fight for it (ssh connections break off as the IP switches between them).



    The hostnames and MAC addresses are different between the two machines. dhclient correctly claims two separate IPs, but the resolver in use is systemd-networkd.







    share|improve this question






















      up vote
      2
      down vote

      favorite
      1









      up vote
      2
      down vote

      favorite
      1






      1





      I've cloned two vSphere VMs off of an Ubuntu 17.10 template. After boot, they both claim the same IP and fight for it (ssh connections break off as the IP switches between them).



      The hostnames and MAC addresses are different between the two machines. dhclient correctly claims two separate IPs, but the resolver in use is systemd-networkd.







      share|improve this question












      I've cloned two vSphere VMs off of an Ubuntu 17.10 template. After boot, they both claim the same IP and fight for it (ssh connections break off as the IP switches between them).



      The hostnames and MAC addresses are different between the two machines. dhclient correctly claims two separate IPs, but the resolver in use is systemd-networkd.









      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 24 at 11:40









      wickedchicken

      1814




      1814




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          6
          down vote













          systemd-networkd uses a different method to generate the DUID than dhclient. dhclient by default uses the link-layer address while systemd-networkd uses the contents of /etc/machine-id. Since the VMs were cloned, they have the same machine-id and the DHCP server returns the same IP for both.



          To fix, replace the contents of one or both of /etc/machine-id. This can be anything, but deleting the file and running systemd-machine-id-setup will create a random machine-id in the same way done on machine setup.






          share|improve this answer
















          • 2




            See unix.stackexchange.com/questions/402999 for why that does not work, what one actually has to do, and what state the machine has to be in to do it.
            – JdeBP
            Jan 24 at 13:13










          • Interesting. Good catch. +1
            – Rui F Ribeiro
            Jan 24 at 19:01










          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );








           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f419321%2fwhy-are-my-cloned-linux-vms-fighting-for-the-same-ip%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          6
          down vote













          systemd-networkd uses a different method to generate the DUID than dhclient. dhclient by default uses the link-layer address while systemd-networkd uses the contents of /etc/machine-id. Since the VMs were cloned, they have the same machine-id and the DHCP server returns the same IP for both.



          To fix, replace the contents of one or both of /etc/machine-id. This can be anything, but deleting the file and running systemd-machine-id-setup will create a random machine-id in the same way done on machine setup.






          share|improve this answer
















          • 2




            See unix.stackexchange.com/questions/402999 for why that does not work, what one actually has to do, and what state the machine has to be in to do it.
            – JdeBP
            Jan 24 at 13:13










          • Interesting. Good catch. +1
            – Rui F Ribeiro
            Jan 24 at 19:01














          up vote
          6
          down vote













          systemd-networkd uses a different method to generate the DUID than dhclient. dhclient by default uses the link-layer address while systemd-networkd uses the contents of /etc/machine-id. Since the VMs were cloned, they have the same machine-id and the DHCP server returns the same IP for both.



          To fix, replace the contents of one or both of /etc/machine-id. This can be anything, but deleting the file and running systemd-machine-id-setup will create a random machine-id in the same way done on machine setup.






          share|improve this answer
















          • 2




            See unix.stackexchange.com/questions/402999 for why that does not work, what one actually has to do, and what state the machine has to be in to do it.
            – JdeBP
            Jan 24 at 13:13










          • Interesting. Good catch. +1
            – Rui F Ribeiro
            Jan 24 at 19:01












          up vote
          6
          down vote










          up vote
          6
          down vote









          systemd-networkd uses a different method to generate the DUID than dhclient. dhclient by default uses the link-layer address while systemd-networkd uses the contents of /etc/machine-id. Since the VMs were cloned, they have the same machine-id and the DHCP server returns the same IP for both.



          To fix, replace the contents of one or both of /etc/machine-id. This can be anything, but deleting the file and running systemd-machine-id-setup will create a random machine-id in the same way done on machine setup.






          share|improve this answer












          systemd-networkd uses a different method to generate the DUID than dhclient. dhclient by default uses the link-layer address while systemd-networkd uses the contents of /etc/machine-id. Since the VMs were cloned, they have the same machine-id and the DHCP server returns the same IP for both.



          To fix, replace the contents of one or both of /etc/machine-id. This can be anything, but deleting the file and running systemd-machine-id-setup will create a random machine-id in the same way done on machine setup.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 24 at 11:40









          wickedchicken

          1814




          1814







          • 2




            See unix.stackexchange.com/questions/402999 for why that does not work, what one actually has to do, and what state the machine has to be in to do it.
            – JdeBP
            Jan 24 at 13:13










          • Interesting. Good catch. +1
            – Rui F Ribeiro
            Jan 24 at 19:01












          • 2




            See unix.stackexchange.com/questions/402999 for why that does not work, what one actually has to do, and what state the machine has to be in to do it.
            – JdeBP
            Jan 24 at 13:13










          • Interesting. Good catch. +1
            – Rui F Ribeiro
            Jan 24 at 19:01







          2




          2




          See unix.stackexchange.com/questions/402999 for why that does not work, what one actually has to do, and what state the machine has to be in to do it.
          – JdeBP
          Jan 24 at 13:13




          See unix.stackexchange.com/questions/402999 for why that does not work, what one actually has to do, and what state the machine has to be in to do it.
          – JdeBP
          Jan 24 at 13:13












          Interesting. Good catch. +1
          – Rui F Ribeiro
          Jan 24 at 19:01




          Interesting. Good catch. +1
          – Rui F Ribeiro
          Jan 24 at 19:01












           

          draft saved


          draft discarded


























           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f419321%2fwhy-are-my-cloned-linux-vms-fighting-for-the-same-ip%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          Peggy Mitchell

          Palaiologos

          The Forum (Inglewood, California)