Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am running Ubuntu-Server 12 LTS inside a VM (using VirtualBox with Ubuntu 12 as the host). I have 2 nics set-up in VirtualBox, eth0 is NAT and is used to connect to the outside world and eth1 is Host-Only (with DHCP provided by VirtualBox) so I can access the VM from the host machine.

When I first log in, ifconfig does not display eth1 (as expected) and running sudo dhclient eth1 brings the interface up and gets an IP address as expected. All good so far.

So then I edited /etc/network/interfaces to include the following:

auto eth1
iface eth1 inet static
  address 192.168.56.105
  netmask 255.255.255.0
  gateway 192.168.56.1

After a reboot, eth1 appears in ifconfig as expected with its static ip but then apt-get update fails claiming 'temporary failure resolving '.

If I comment out the new interface definition and reboot again, it all works fine. If I just use dhclient to bring eth1 up, it all works fine but I'd quite like to not have to do that everytime I boot the VM.

I'm not sure where to start with this one, I'm not a native to Ubuntu-land. Any help would be greatly appreciated!

Edit: For clarity, once the system is up and either working or not, no amount of changing files and restarting the networking service seems to change it. It's either working or not until a complete reboot.

share|improve this question
    
Comment out gateway 192.168.56.1, reboot, then test apt-get and accessing VM from host machine. –  Eric Carvalho Jun 11 '13 at 17:07
    
That solved it! Thank-you! I guess I was trying to give it too much info. –  bugsduggan Jun 11 '13 at 17:12

1 Answer 1

up vote 1 down vote accepted

Just remove the gateway from eth1 config:

auto eth1
iface eth1 inet static
  address 192.168.56.105
  netmask 255.255.255.0
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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