1

I am using windows 7. I installed virtual box and created a ubuntu 16.04 vm. it has the ip of 192.168.0.10

But all my clones also have the same ip. I tried different ways to change the ip, but nothing seems to be working

The contents of the my /etc/network/interfaces file is as follows

auto lo
iface lo inet loopback

I added the following
auto eth0
iface eth0 inet static
address 192.168.0.5
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
dns-nameservers 192.168.0.1

After restarting the network using sudo service network-manager restart, there is no change, my ip shows up as 192.168.0.10

ip addr show - shows the following

$ ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group    default qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
   valid_lft forever preferred_lft forever
inet6 ::1/128 scope host 
   valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 08:00:27:8c:7a:3c brd ff:ff:ff:ff:ff:ff
inet 192.168.225.194/24 brd 192.168.225.255 scope global dynamic enp0s3
   valid_lft 42984sec preferred_lft 42984sec
inet6 fe80::aad4:1c86:ded3:1636/64 scope link 
   valid_lft forever preferred_lft forever
4
  • Is your interface actually named eth0? What does ip addr show say? And why do you call it eth0 on the 1st line and etho0 on the second?
    – AlexP
    Dec 19, 2016 at 12:12
  • etho0 was a typo in the message. I copied the contents from googling so it may not apply to me. I have pasted the contents of ip addr show
    – Merchant
    Dec 19, 2016 at 12:56
  • 1
    network is bridge mode or NAT? Dec 19, 2016 at 12:57
  • when cloning, you should have changed the mac address, so that dhcp gives you antoher IP. what are complaining about ? enp3s0 has 192.168.225.194 address. there is no eth0 in VM
    – solsTiCe
    Dec 19, 2016 at 14:16

2 Answers 2

0

First, you have to decide about the network topology. You have at least the options

  • NAT: each of your virtual machines is connected to a separate network card (at least the virtual machine thinks it is so) and with a help of the Network Address Translation (NAT) goes in the real network using the external IP address of the host. The virtual machines cannot see each other.

  • Bridged adapter: your physical host adapter gets an additional Ethernet (MAC) address for each virtual machine and acts as two (or more) independent adapters simultaneously. This way, each virtual machine is connected parallel to the host to the network, getting an IP address from the main DHCP server. This way, the machines get different IP addresses (of cause MAC addresses must be different) and can see each other.

  • NAT Network: introduced in VirtualBox lately (I think Version 5) and in my case did not work. It should be kind of internal network, where virtual machines can communicate with each other but are not accessible from the real network.

  • Internal networking: virtual machines see each other but not the host and not the real network.

  • Host only adapter: virtual machines see each other (and probably host) but not the real network. The host should be able to communicate with virtual machines.

Next, make sure you have different MAC addresses of the network cards in virtual machines. Take "Bridged adapter" or "Host only adapter" and make sure your DHCP server is agree to serve some more participants in the network. This did work for me.

Don't forget to set "cable connected" option.

For "Host only adapter" and "NAT Network" you should create these networks first under File -> Preferences -> Network.

0

I recently faced this and the way to securely create a VM network is to create a NAT Network and assign that to the VMs. Using Mac OS X and VirtualBox (Version 5.2.24 r128163 (Qt5.6.3)), one can create a NAT Network by:

  1. Press ⌘, to open preferences dialog
  2. Select the Network icon
  3. Select "Adds new NAT Network" icon

Then for each VM:

  1. Select the VM
  2. Press ⌘s to open its settings dialog
  3. Select the Network icon
  4. On the Attached To: drop down, select NAT Network

The one you just created should be automatically selected. When you restart each VM they should all be in a network where they can speak to each other and the outside network but not vice-versa. This table expresses that pretty well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.