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.1and 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 eth0The 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 ?
3 Answers
You can find the network device logical name by the command:
sudo lshw -C networkIn 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 eth0iface 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 enp0s3iface enp0s3 inet static address 192.168.56.5 netmask 255.255.255.0 gateway 192.168.56.1
Just after the Debian 9 installation, I came to know that the name of network interface got changed to “ens33” from old type “eth0“. If you ever interested in changing interface name to old type “ethX“, then here is the tutorial for you.
Are you Interested in Debian upgrade,
READ: How To Upgrade Debian 8 Jessie to Debian 9 Stretch
As you can see in the output of “ip a” command, my Debian 9 system is having a network adapter called “ens33“.
$ ip a
1: lo: <loopback,up,lower_up> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever
2: </loopback,up,lower_up>ens33: <broadcast,multicast,up,lower_up> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 08:00:27:10:73:eb brd ff:ff:ff:ff:ff:ff </broadcast,multicast,up,lower_up>inet 192.168.1.6/24 brd 192.168.1.255 scope global dynamic ens33 valid_lft 86366sec preferred_lft 86366sec inet6 fd50:1d9:9fe3:1400:85b2:6a34:5c9d:f3e/64 scope global temporary dynamic valid_lft 7176sec preferred_lft 3576sec inet6 fd50:1d9:9fe3:1400:a00:27ff:fe10:73eb/64 scope global mngtmpaddr noprefixroute dynamic valid_lft 7176sec preferred_lft 3576sec inet6 fe80::a00:27ff:fe10:73eb/64 scope link valid_lft forever preferred_lft foreverYou can confirm that the Ethernet device got renamed during the system boot by using “dmesg” command.
$ sudo dmesg | grep -i eth
[ 1.510948] e1000 0000:00:03.0 eth0: (PCI:33MHz:32-bit) 08:00:27:10:73:eb
[ 1.510955] e1000 0000:00:03.0 eth0: Intel(R) PRO/1000 Network Connection
[ 1.514587] e1000 0000:00:03.0 ens33: renamed from eth0