Ubuntu – cannot find device eth0


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    

and reboot the server

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

lo Link encap:Local Loopback      
  inet addr: Mask:      
  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 ?

Best Answer

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.

Related Question