Why are my two virtual machines getting the same IP address?

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











up vote
24
down vote

favorite
6












I have two virtual machines both running on a Linux host (Fedora 16). I set both adapters as attached to NAT. When I boot them up they both have their default gateway set to 10.0.2.2. They also both have the same IP address (10.0.2.15). They are both on the same adapter (adapter 1). I don't know why they are getting assigned the same IP address, and shouldn't the default gateway be 10.0.2.1 since the subnet address is 10.0.2.0 and the netmask is 255.255.255.0. Is there something I am missing, has this happened to anyone before? How do I get the VirtualBox DHCP working properly?










share|improve this question



















  • 2




    That is not necessary true, it is possible to create a "true" virtual NAT network in which the multiple VM have to be assigned different IP address based on it's virtualized MAC address, and the VM can see each other behind the NAT network, basically virtually an entire subnet behind the NAT interface. Depends on your choice in the network adapter configuration, if "NAT" is chosen, the NAT is a one on one host/vm relationship, if "NAT network" is chosen, then it's a host/subnet relationship in which each VM on the virtualized network will have to have different IP addresses.
    – user98773
    Jan 10 '15 at 16:30














up vote
24
down vote

favorite
6












I have two virtual machines both running on a Linux host (Fedora 16). I set both adapters as attached to NAT. When I boot them up they both have their default gateway set to 10.0.2.2. They also both have the same IP address (10.0.2.15). They are both on the same adapter (adapter 1). I don't know why they are getting assigned the same IP address, and shouldn't the default gateway be 10.0.2.1 since the subnet address is 10.0.2.0 and the netmask is 255.255.255.0. Is there something I am missing, has this happened to anyone before? How do I get the VirtualBox DHCP working properly?










share|improve this question



















  • 2




    That is not necessary true, it is possible to create a "true" virtual NAT network in which the multiple VM have to be assigned different IP address based on it's virtualized MAC address, and the VM can see each other behind the NAT network, basically virtually an entire subnet behind the NAT interface. Depends on your choice in the network adapter configuration, if "NAT" is chosen, the NAT is a one on one host/vm relationship, if "NAT network" is chosen, then it's a host/subnet relationship in which each VM on the virtualized network will have to have different IP addresses.
    – user98773
    Jan 10 '15 at 16:30












up vote
24
down vote

favorite
6









up vote
24
down vote

favorite
6






6





I have two virtual machines both running on a Linux host (Fedora 16). I set both adapters as attached to NAT. When I boot them up they both have their default gateway set to 10.0.2.2. They also both have the same IP address (10.0.2.15). They are both on the same adapter (adapter 1). I don't know why they are getting assigned the same IP address, and shouldn't the default gateway be 10.0.2.1 since the subnet address is 10.0.2.0 and the netmask is 255.255.255.0. Is there something I am missing, has this happened to anyone before? How do I get the VirtualBox DHCP working properly?










share|improve this question















I have two virtual machines both running on a Linux host (Fedora 16). I set both adapters as attached to NAT. When I boot them up they both have their default gateway set to 10.0.2.2. They also both have the same IP address (10.0.2.15). They are both on the same adapter (adapter 1). I don't know why they are getting assigned the same IP address, and shouldn't the default gateway be 10.0.2.1 since the subnet address is 10.0.2.0 and the netmask is 255.255.255.0. Is there something I am missing, has this happened to anyone before? How do I get the VirtualBox DHCP working properly?







virtualbox ip dhcp






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 25 '12 at 23:41









Gilles

511k12010141544




511k12010141544










asked Jan 25 '12 at 21:14









rubixibuc

7171823




7171823







  • 2




    That is not necessary true, it is possible to create a "true" virtual NAT network in which the multiple VM have to be assigned different IP address based on it's virtualized MAC address, and the VM can see each other behind the NAT network, basically virtually an entire subnet behind the NAT interface. Depends on your choice in the network adapter configuration, if "NAT" is chosen, the NAT is a one on one host/vm relationship, if "NAT network" is chosen, then it's a host/subnet relationship in which each VM on the virtualized network will have to have different IP addresses.
    – user98773
    Jan 10 '15 at 16:30












  • 2




    That is not necessary true, it is possible to create a "true" virtual NAT network in which the multiple VM have to be assigned different IP address based on it's virtualized MAC address, and the VM can see each other behind the NAT network, basically virtually an entire subnet behind the NAT interface. Depends on your choice in the network adapter configuration, if "NAT" is chosen, the NAT is a one on one host/vm relationship, if "NAT network" is chosen, then it's a host/subnet relationship in which each VM on the virtualized network will have to have different IP addresses.
    – user98773
    Jan 10 '15 at 16:30







2




2




That is not necessary true, it is possible to create a "true" virtual NAT network in which the multiple VM have to be assigned different IP address based on it's virtualized MAC address, and the VM can see each other behind the NAT network, basically virtually an entire subnet behind the NAT interface. Depends on your choice in the network adapter configuration, if "NAT" is chosen, the NAT is a one on one host/vm relationship, if "NAT network" is chosen, then it's a host/subnet relationship in which each VM on the virtualized network will have to have different IP addresses.
– user98773
Jan 10 '15 at 16:30




That is not necessary true, it is possible to create a "true" virtual NAT network in which the multiple VM have to be assigned different IP address based on it's virtualized MAC address, and the VM can see each other behind the NAT network, basically virtually an entire subnet behind the NAT interface. Depends on your choice in the network adapter configuration, if "NAT" is chosen, the NAT is a one on one host/vm relationship, if "NAT network" is chosen, then it's a host/subnet relationship in which each VM on the virtualized network will have to have different IP addresses.
– user98773
Jan 10 '15 at 16:30










5 Answers
5






active

oldest

votes

















up vote
20
down vote



accepted










VirtualBox DHCP is working properly.



There is nothing wrong with having all of your machines getting the same address in NAT configuration. All VMs are isolated from each other so there is no risk of conflict. They are also not on the same adapter. Each VM has its own virtualized hardware including NICs.



The default gateway also need not to be 10.0.2.1. Although it is a common practice to have it at the lower IP address, it can be any IP in the subnet range.



Also, there is no "real" dhcp service, everything is hardcoded in the VirtualBox code, although if you are not happy with the default IP addresses you can fine tune the NAT engine.






share|improve this answer





























    up vote
    6
    down vote













    Your virtual machines will get the same IP adress from any dhcp service as long as they have the same ethernet MAC address (a hardware address, unique like a fingerprint, set by the hardware manufacturer of your network device).



    Since you are running virtual machines, they have virtual hardware and therefore they "fake" the MAC address. You have to make sure not 2 machines have the same ethernet hardware address.



    You can set the ethernet MAC address of your virtual machine in VirtualBox in the hardware network section (it looks like this: 3c:08:51:05:24:8a)



    You can check it in your running VM:



    sudo ifconfig

    en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    options=2b<RXCSUM,TXCSUM,VLAN_HWTAGGING,TSO4>
    ether 3c:08:51:05:24:8a
    media: autoselect (none)
    status: inactive





    share|improve this answer
















    • 1




      The NAT dhcp server embedded with VirtualBox isn't a real one. In particular it doesn't care about MAC addresses. In any case, multiple VM might have the same MAC address, that doesn't matter as the virtual networks are fully isolated.
      – jlliagre
      Jan 27 '12 at 23:00

















    up vote
    2
    down vote













    They will get their default gateway from the dhcp server - so it will be whatever is set up in there. You will need to look at the dhcp server to see what it is delivering (generally just set it in the server config to be whatever you want it to be)



    With regard to the two adapters having the same address, this is most likely down to the configuration you have set in Virtualbox. If they are clones then you may need to explicitly give one a new MAC address.



    Check the network configurations for each and see if they think they are the same.



    If different, you could temporarily set a fixed IP for each one at the dhcp server (assigned by MAC address)



    Have a look at this section from the VirtualBox manual for more information.






    share|improve this answer
















    • 1




      The link you posted doesn't apply to NAT.
      – jlliagre
      Jan 27 '12 at 23:01

















    up vote
    0
    down vote













    In VirtualBox control panel go to File -> Preferences -> Network



    Select NAT Networks tab, create a new "NatNetwork" by clicking + button at side and press OK.



    Now select each VM go to Settings -> Network



    In Attached to: option choose NAT Network and select "NatNetwork" and press OK.



    Restart all the VMs.



    Now VMs have different network address.






    share|improve this answer



























      up vote
      -1
      down vote













      open network setting for each vm, click on advanced > click the refresh button beside the mac addr. Get a different one on both and you are all set






      share|improve this answer




















      • underrated answer
        – elsadek
        Nov 3 '17 at 18:05










      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%2f29999%2fwhy-are-my-two-virtual-machines-getting-the-same-ip-address%23new-answer', 'question_page');

      );

      Post as a guest






























      5 Answers
      5






      active

      oldest

      votes








      5 Answers
      5






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      20
      down vote



      accepted










      VirtualBox DHCP is working properly.



      There is nothing wrong with having all of your machines getting the same address in NAT configuration. All VMs are isolated from each other so there is no risk of conflict. They are also not on the same adapter. Each VM has its own virtualized hardware including NICs.



      The default gateway also need not to be 10.0.2.1. Although it is a common practice to have it at the lower IP address, it can be any IP in the subnet range.



      Also, there is no "real" dhcp service, everything is hardcoded in the VirtualBox code, although if you are not happy with the default IP addresses you can fine tune the NAT engine.






      share|improve this answer


























        up vote
        20
        down vote



        accepted










        VirtualBox DHCP is working properly.



        There is nothing wrong with having all of your machines getting the same address in NAT configuration. All VMs are isolated from each other so there is no risk of conflict. They are also not on the same adapter. Each VM has its own virtualized hardware including NICs.



        The default gateway also need not to be 10.0.2.1. Although it is a common practice to have it at the lower IP address, it can be any IP in the subnet range.



        Also, there is no "real" dhcp service, everything is hardcoded in the VirtualBox code, although if you are not happy with the default IP addresses you can fine tune the NAT engine.






        share|improve this answer
























          up vote
          20
          down vote



          accepted







          up vote
          20
          down vote



          accepted






          VirtualBox DHCP is working properly.



          There is nothing wrong with having all of your machines getting the same address in NAT configuration. All VMs are isolated from each other so there is no risk of conflict. They are also not on the same adapter. Each VM has its own virtualized hardware including NICs.



          The default gateway also need not to be 10.0.2.1. Although it is a common practice to have it at the lower IP address, it can be any IP in the subnet range.



          Also, there is no "real" dhcp service, everything is hardcoded in the VirtualBox code, although if you are not happy with the default IP addresses you can fine tune the NAT engine.






          share|improve this answer














          VirtualBox DHCP is working properly.



          There is nothing wrong with having all of your machines getting the same address in NAT configuration. All VMs are isolated from each other so there is no risk of conflict. They are also not on the same adapter. Each VM has its own virtualized hardware including NICs.



          The default gateway also need not to be 10.0.2.1. Although it is a common practice to have it at the lower IP address, it can be any IP in the subnet range.



          Also, there is no "real" dhcp service, everything is hardcoded in the VirtualBox code, although if you are not happy with the default IP addresses you can fine tune the NAT engine.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Jan 27 '12 at 21:46

























          answered Jan 26 '12 at 2:38









          jlliagre

          45.2k578125




          45.2k578125






















              up vote
              6
              down vote













              Your virtual machines will get the same IP adress from any dhcp service as long as they have the same ethernet MAC address (a hardware address, unique like a fingerprint, set by the hardware manufacturer of your network device).



              Since you are running virtual machines, they have virtual hardware and therefore they "fake" the MAC address. You have to make sure not 2 machines have the same ethernet hardware address.



              You can set the ethernet MAC address of your virtual machine in VirtualBox in the hardware network section (it looks like this: 3c:08:51:05:24:8a)



              You can check it in your running VM:



              sudo ifconfig

              en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
              options=2b<RXCSUM,TXCSUM,VLAN_HWTAGGING,TSO4>
              ether 3c:08:51:05:24:8a
              media: autoselect (none)
              status: inactive





              share|improve this answer
















              • 1




                The NAT dhcp server embedded with VirtualBox isn't a real one. In particular it doesn't care about MAC addresses. In any case, multiple VM might have the same MAC address, that doesn't matter as the virtual networks are fully isolated.
                – jlliagre
                Jan 27 '12 at 23:00














              up vote
              6
              down vote













              Your virtual machines will get the same IP adress from any dhcp service as long as they have the same ethernet MAC address (a hardware address, unique like a fingerprint, set by the hardware manufacturer of your network device).



              Since you are running virtual machines, they have virtual hardware and therefore they "fake" the MAC address. You have to make sure not 2 machines have the same ethernet hardware address.



              You can set the ethernet MAC address of your virtual machine in VirtualBox in the hardware network section (it looks like this: 3c:08:51:05:24:8a)



              You can check it in your running VM:



              sudo ifconfig

              en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
              options=2b<RXCSUM,TXCSUM,VLAN_HWTAGGING,TSO4>
              ether 3c:08:51:05:24:8a
              media: autoselect (none)
              status: inactive





              share|improve this answer
















              • 1




                The NAT dhcp server embedded with VirtualBox isn't a real one. In particular it doesn't care about MAC addresses. In any case, multiple VM might have the same MAC address, that doesn't matter as the virtual networks are fully isolated.
                – jlliagre
                Jan 27 '12 at 23:00












              up vote
              6
              down vote










              up vote
              6
              down vote









              Your virtual machines will get the same IP adress from any dhcp service as long as they have the same ethernet MAC address (a hardware address, unique like a fingerprint, set by the hardware manufacturer of your network device).



              Since you are running virtual machines, they have virtual hardware and therefore they "fake" the MAC address. You have to make sure not 2 machines have the same ethernet hardware address.



              You can set the ethernet MAC address of your virtual machine in VirtualBox in the hardware network section (it looks like this: 3c:08:51:05:24:8a)



              You can check it in your running VM:



              sudo ifconfig

              en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
              options=2b<RXCSUM,TXCSUM,VLAN_HWTAGGING,TSO4>
              ether 3c:08:51:05:24:8a
              media: autoselect (none)
              status: inactive





              share|improve this answer












              Your virtual machines will get the same IP adress from any dhcp service as long as they have the same ethernet MAC address (a hardware address, unique like a fingerprint, set by the hardware manufacturer of your network device).



              Since you are running virtual machines, they have virtual hardware and therefore they "fake" the MAC address. You have to make sure not 2 machines have the same ethernet hardware address.



              You can set the ethernet MAC address of your virtual machine in VirtualBox in the hardware network section (it looks like this: 3c:08:51:05:24:8a)



              You can check it in your running VM:



              sudo ifconfig

              en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
              options=2b<RXCSUM,TXCSUM,VLAN_HWTAGGING,TSO4>
              ether 3c:08:51:05:24:8a
              media: autoselect (none)
              status: inactive






              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Jan 26 '12 at 6:31









              snies

              1691




              1691







              • 1




                The NAT dhcp server embedded with VirtualBox isn't a real one. In particular it doesn't care about MAC addresses. In any case, multiple VM might have the same MAC address, that doesn't matter as the virtual networks are fully isolated.
                – jlliagre
                Jan 27 '12 at 23:00












              • 1




                The NAT dhcp server embedded with VirtualBox isn't a real one. In particular it doesn't care about MAC addresses. In any case, multiple VM might have the same MAC address, that doesn't matter as the virtual networks are fully isolated.
                – jlliagre
                Jan 27 '12 at 23:00







              1




              1




              The NAT dhcp server embedded with VirtualBox isn't a real one. In particular it doesn't care about MAC addresses. In any case, multiple VM might have the same MAC address, that doesn't matter as the virtual networks are fully isolated.
              – jlliagre
              Jan 27 '12 at 23:00




              The NAT dhcp server embedded with VirtualBox isn't a real one. In particular it doesn't care about MAC addresses. In any case, multiple VM might have the same MAC address, that doesn't matter as the virtual networks are fully isolated.
              – jlliagre
              Jan 27 '12 at 23:00










              up vote
              2
              down vote













              They will get their default gateway from the dhcp server - so it will be whatever is set up in there. You will need to look at the dhcp server to see what it is delivering (generally just set it in the server config to be whatever you want it to be)



              With regard to the two adapters having the same address, this is most likely down to the configuration you have set in Virtualbox. If they are clones then you may need to explicitly give one a new MAC address.



              Check the network configurations for each and see if they think they are the same.



              If different, you could temporarily set a fixed IP for each one at the dhcp server (assigned by MAC address)



              Have a look at this section from the VirtualBox manual for more information.






              share|improve this answer
















              • 1




                The link you posted doesn't apply to NAT.
                – jlliagre
                Jan 27 '12 at 23:01














              up vote
              2
              down vote













              They will get their default gateway from the dhcp server - so it will be whatever is set up in there. You will need to look at the dhcp server to see what it is delivering (generally just set it in the server config to be whatever you want it to be)



              With regard to the two adapters having the same address, this is most likely down to the configuration you have set in Virtualbox. If they are clones then you may need to explicitly give one a new MAC address.



              Check the network configurations for each and see if they think they are the same.



              If different, you could temporarily set a fixed IP for each one at the dhcp server (assigned by MAC address)



              Have a look at this section from the VirtualBox manual for more information.






              share|improve this answer
















              • 1




                The link you posted doesn't apply to NAT.
                – jlliagre
                Jan 27 '12 at 23:01












              up vote
              2
              down vote










              up vote
              2
              down vote









              They will get their default gateway from the dhcp server - so it will be whatever is set up in there. You will need to look at the dhcp server to see what it is delivering (generally just set it in the server config to be whatever you want it to be)



              With regard to the two adapters having the same address, this is most likely down to the configuration you have set in Virtualbox. If they are clones then you may need to explicitly give one a new MAC address.



              Check the network configurations for each and see if they think they are the same.



              If different, you could temporarily set a fixed IP for each one at the dhcp server (assigned by MAC address)



              Have a look at this section from the VirtualBox manual for more information.






              share|improve this answer












              They will get their default gateway from the dhcp server - so it will be whatever is set up in there. You will need to look at the dhcp server to see what it is delivering (generally just set it in the server config to be whatever you want it to be)



              With regard to the two adapters having the same address, this is most likely down to the configuration you have set in Virtualbox. If they are clones then you may need to explicitly give one a new MAC address.



              Check the network configurations for each and see if they think they are the same.



              If different, you could temporarily set a fixed IP for each one at the dhcp server (assigned by MAC address)



              Have a look at this section from the VirtualBox manual for more information.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Jan 25 '12 at 23:49









              Rory Alsop

              1,8761022




              1,8761022







              • 1




                The link you posted doesn't apply to NAT.
                – jlliagre
                Jan 27 '12 at 23:01












              • 1




                The link you posted doesn't apply to NAT.
                – jlliagre
                Jan 27 '12 at 23:01







              1




              1




              The link you posted doesn't apply to NAT.
              – jlliagre
              Jan 27 '12 at 23:01




              The link you posted doesn't apply to NAT.
              – jlliagre
              Jan 27 '12 at 23:01










              up vote
              0
              down vote













              In VirtualBox control panel go to File -> Preferences -> Network



              Select NAT Networks tab, create a new "NatNetwork" by clicking + button at side and press OK.



              Now select each VM go to Settings -> Network



              In Attached to: option choose NAT Network and select "NatNetwork" and press OK.



              Restart all the VMs.



              Now VMs have different network address.






              share|improve this answer
























                up vote
                0
                down vote













                In VirtualBox control panel go to File -> Preferences -> Network



                Select NAT Networks tab, create a new "NatNetwork" by clicking + button at side and press OK.



                Now select each VM go to Settings -> Network



                In Attached to: option choose NAT Network and select "NatNetwork" and press OK.



                Restart all the VMs.



                Now VMs have different network address.






                share|improve this answer






















                  up vote
                  0
                  down vote










                  up vote
                  0
                  down vote









                  In VirtualBox control panel go to File -> Preferences -> Network



                  Select NAT Networks tab, create a new "NatNetwork" by clicking + button at side and press OK.



                  Now select each VM go to Settings -> Network



                  In Attached to: option choose NAT Network and select "NatNetwork" and press OK.



                  Restart all the VMs.



                  Now VMs have different network address.






                  share|improve this answer












                  In VirtualBox control panel go to File -> Preferences -> Network



                  Select NAT Networks tab, create a new "NatNetwork" by clicking + button at side and press OK.



                  Now select each VM go to Settings -> Network



                  In Attached to: option choose NAT Network and select "NatNetwork" and press OK.



                  Restart all the VMs.



                  Now VMs have different network address.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 1 '17 at 9:33









                  Suman Bhowmik

                  1




                  1




















                      up vote
                      -1
                      down vote













                      open network setting for each vm, click on advanced > click the refresh button beside the mac addr. Get a different one on both and you are all set






                      share|improve this answer




















                      • underrated answer
                        – elsadek
                        Nov 3 '17 at 18:05














                      up vote
                      -1
                      down vote













                      open network setting for each vm, click on advanced > click the refresh button beside the mac addr. Get a different one on both and you are all set






                      share|improve this answer




















                      • underrated answer
                        – elsadek
                        Nov 3 '17 at 18:05












                      up vote
                      -1
                      down vote










                      up vote
                      -1
                      down vote









                      open network setting for each vm, click on advanced > click the refresh button beside the mac addr. Get a different one on both and you are all set






                      share|improve this answer












                      open network setting for each vm, click on advanced > click the refresh button beside the mac addr. Get a different one on both and you are all set







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Sep 18 '17 at 20:52









                      sam

                      11




                      11











                      • underrated answer
                        – elsadek
                        Nov 3 '17 at 18:05
















                      • underrated answer
                        – elsadek
                        Nov 3 '17 at 18:05















                      underrated answer
                      – elsadek
                      Nov 3 '17 at 18:05




                      underrated answer
                      – elsadek
                      Nov 3 '17 at 18:05

















                       

                      draft saved


                      draft discarded















































                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f29999%2fwhy-are-my-two-virtual-machines-getting-the-same-ip-address%23new-answer', 'question_page');

                      );

                      Post as a guest













































































                      Popular posts from this blog

                      How to check contact read email or not when send email to Individual?

                      Displaying single band from multi-band raster using QGIS

                      How many registers does an x86_64 CPU actually have?