I'm new to ubuntu and need to install the ubuntu xenial server (16.04) edition to install MongoDB into a VirtualBox. After installation I tried to change from dhcp to a static ipv4 address. So I changed the /etc/network/interfaces :

auto lo    

iface lo inet loopback    

allow-hotplug eth0    
iface eth0 inet static    
  address 192.168.56.5   
  netmask 255.255.255.0   
  gateway 192.168.56.1

and reboot the server

# but ifconfig -a shows only an enp0s3 interface without any IP address
and 

lo Link encap:Local Loopback      
  inet addr:127.0.0.1 Mask:255.0.0.0      
  inet6 addr: ::1/128 Scope:Host

  up loopback running MTU: ...

(sorry copy and paste will not work so I have to type it all)

did a reboot once more and tried sudo ifdown and afterwards ifup eth0 
# but it gives allways :
Cannot find device "eth0"

Failed to bring up eth0

The VirtualBox Network Adapter is set to Host-only Adapter and I have already running another VirtualBox with Debian8 on 192,168.56.4.

Has anyone any help for me ?


You can find the network device logical name by the command:

sudo lshw -C network

In my case, my logical network device name is enp3s0. So I replaced the device name from eth0 to enp3s0 and it works.


Your network interface is enp0s3. Replace the eth0 entries with this interface.

Change from:

auto lo
iface lo inet loopback

allow-hotplug eth0
iface eth0 inet static
  address 192.168.56.5
  netmask 255.255.255.0
  gateway 192.168.56.1

Change to:

auto lo
iface lo inet loopback

allow-hotplug enp0s3
iface enp0s3 inet static
  address 192.168.56.5
  netmask 255.255.255.0
  gateway 192.168.56.1