• Digital accessories
  • Server
  • Digital life
  • Privacy policy
  • Contact us
  1. Home
  2. Article
  3. Why are my two virtual machines getting the same IP address?

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

Rsdaa 30/12/2021 1222

Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.

Sign up to join this community


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 They also both have the same IP address ( 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 since the subnet address is and the netmask is Is there something I am missing, has this happened to anyone before? How do I get the VirtualBox DHCP working properly?

asked Jan 25 '12 at 21:14

rubixibuc rubixibuc

1,587 2 2 gold badges 18 18 silver badges 25 25 bronze badges


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


I had the same issue. Assigned Adapter2 to the 2nd guest OS. Unique Mac and Ip address assigned for the guests.

I encountered the same problem on KVM. The two virtual machines are having the same ip address, and one of them can't access the external network.

The problem lies in the DHCP services. Basically there are two solutions for that:

Configure the ip address with dhcp explictily, which is to run dhclient enp1s0 in your virtual machines (enp1s0 is the interface). Then you find the ip addresses are changed and configured correctly.

The 2nd solution is to assign fixed ip addresses for the virtual machines as below:

Go to /etc/netplan (for Ubuntu)Edit the .yaml file in the directory (there should be only one file there and you may want to backup it first)Give it a fixed ip address (in this case I set it to The whole file is like thisnetwork: version: 2 renderer: networkd ethernets: enp1s0: dhcp4: no addresses: [] gateway4: nameservers: addresses: [,] netplan apply to active the setting.Then you can ifconfig to see the ip changes.

Hope this solves your problem.

Two settings need to be changed.

1) In VM box side - Console VMware client software change the network settings (ie) add a new nat on network settings. 2) In VM machine side - Refresh the Mac address for each VM.

Faced same problem and case for me is because I have same MAC address for both machine. when adding the nat network into the VM, you can use the refresh button to get an new MAC address. once I set my machine into different MAC address. they are automatically assgined to different IP

This is a late answer for any future person who get this question!

The VM must be powered off

In VirtualBox

Select the Machine (i.e. 'Windows 7')MAC AddressRefresh

Boot the selected machine

In "Adapter properties", change IP Address to static, for example (change to adapt to your needs):

IP = Netmask = Default Gateway = DNS =

Now I have for 'Windows 7', and for other machine ( i.e. 'Win10').

For linux guests follow specific "How to set static IP address" for that network device.

Just like @jlliagre said, VirtualBox's networking mode 'NAT' is different from 'Network Address Translation Service' mode.

In Oracle VM VirtualBox this router is placed between each virtual machine and the host. This separation maximizes security since by default virtual machines cannot talk to each other.

ref: Network Address Translation (NAT)

In other words:


Highly active question. Earn 10 reputation (not counting the association bonus) in order to answer this question. The reputation requirement helps protect this question from spam and non-answer activity.

Unix & Linux Stack Exchange works best with JavaScript enabled

PREV: 15 Advantages and Disadvantages of Virtualization

NEXT: 14 Advantages and Disadvantages of Virtualization – Vittana.org

Popular Articles

Hot Articles
Back to Top