0

I was trying to connect 2 Ubuntu vms on virtualbox. they had the same ip address: 10.0.2.15 with default gate: 10.0.2.2

I tried to change this manually, and here what I did: on the edit connection tab, I changed the IPv4 settings where I chose Manual and added the ip address:192.168.0.2....... then I used the following to manually configure eth0:

sudo nano /etc/network/interfaces

I had only these 2 lines in the file:

# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

SO I ADDED THE FOLLOWING

auto eth0
iface eth0 inet static
address 192.168.0.2
netmask 255.255.255.0
network 192.168.0.0
broadcast .....

did ifconfig and eth0 inetaddress is showing 192.168.0.2

Now I need to undo that, I want it the way it was assigned 10.0.2.15 but I'm not able to do that, I changed the ipv4 settings back to Automatic dhcp and erased the ip I added. I erased what I have added in the interface file too.

Nothing changed, eth0 still have 192.168.0.2

steeldriver
  • 136,215
  • 21
  • 243
  • 336

1 Answers1

1

You need to have the file changed with the address you want then run

sudo service networking restart
or
sudo /etc/init.d/network restart

MORE INFO

The reason that you don't see the new address when you update the file is that it is not dynamic. That file is read one time at startup with the addresses sent to the network controller and not updated until the networking service has been restarted again.

Additionally, if your system has NetworkManager installed (all new versions of ubuntu do by default) then you will need to use the graphical network setting editor. The files that appear when you do a manual configuration are not those used by NetworkManager. You also need to restart networking using the same interface. (usually just right click on the network icon in the task bar and hit turn off network)