0

I cloned centos7 vm in virtualbox, but they ended up with same ip address. My network preferences are my created NAT network with: 10.0.2.0/24

Both vms uses this network i created, but they have same ip address: 10.0.2.15. Tried to run dhclient -r -v to release and renew, but still got same ip.

johnsnow
  • 171
  • 1
  • 4
  • have you tried by selecting option "Reinitialize the MAC address of all network cards" while creating clone of VM? – Sunil Bhoi Apr 30 '18 at 08:54
  • @SunilBhoi I missed that part. Can it be done still even after it is created? Did a lot of changes to it now and would not want to repeat the clone process. – johnsnow May 01 '18 at 11:04
  • I cloned another one with re-initialize mac but it didnt help – johnsnow May 01 '18 at 11:16

1 Answers1

0

Did you check that the DHCP is enabled ? In VirtualBox, go to Preferences -> Network, then edit the NAT Network you created. You should have this window :

VirtualBox edit network window

If "Supports DHCP" is checked, you can also set a static IP inside your VMs. Execute the command ip address and check your working interface (probably ens160). Edit the file /etc/sysconfig/network-scripts/ifcfg-<interface-name> (e.g. ifcfg-ens160) and change according to your network.

You should have something like this (some lines are omitted) :

TYPE=Ethernet
IPADDR=192.168.2.10
NETMASK=255.255.255.0
GATEWAY=192.168.2.254
DNS1=8.8.8.8
DNS2=8.8.8.4
DEFROUTE=yes
NAME=ens160
DEVICE=eth0
ONBOOT=yes

Then restart the network service with sudo systemctl restart network.