Networking stopped working for my Ubuntu VirtualBox Server (running on Mac OS X) and it couldn’t seem to get it working again. Tried running:

sudo /etc/init.d/networking restart

only to get errors about “Failed to bring up eth0…” until I found a workaround on, which worked to solve my issues like a charm!  Thanks How-To-Geek

Quick Summary:

Run this command to edit the interfaces file, and then change eth0 to eth1.

sudo vi /etc/network/interfaces

Run this command to restart networking and everything should likely start working again:

sudo /etc/init.d/networking restart

You should be able to run a ping command and validate the connection is working. One thing to note… this worked the first time the Virtual Machine was moved, but then I exported it again to another Mac and had to modify what I did slightly. I ran:

ifconfig -a

and noticed that the system now labeled the ethernet connection I needed to use as eth2, so I edited /etc/network/interfaces file one more time using eth2 as the interface.