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.