No "eth0" listed in ifconfig -a, only enp0s3 and lo
So, I setup my Ubuntu box with VirtualBox, default settings - simple ISO image launch. After installing Ubuntu, I proceeded to test multiple programs, and everything was working fine. I have full access to the Internet on my host & inside the virtualbox, HOWEVER, I noticed even with my Ethernet connection I still do not have eth0 - instead I have enp0s3, which is weird.
Here is a result from the 'ifconfig -a' command:
enp0s3 Link encap:Ethernet HWaddr 08:00:27:36:5f:f2
inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe36:5ff2/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:484 errors:0 dropped:0 overruns:0 frame:0
TX packets:370 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:294211 (294.2 KB) TX bytes:44269 (44.2 KB)
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:65536 Metric:1
RX packets:274 errors:0 dropped:0 overruns:0 frame:0
TX packets:274 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:24496 (24.4 KB) TX bytes:24496 (24.4 KB)
Any reason why this might be happening?? How can I replace enp0s3 with eth0 and not have "10.0.2.15" as the inet addr, as clearly it shouldn't be that.
Solution 1:
With v197 we introduced predictable network interface names in systemd/udev that includes hardware information rather than a reference to the driver used. The following names are supported:
- Names incorporating Firmware/BIOS provided index numbers for on-board devices (example:
eno1
)- Names incorporating Firmware/BIOS provided PCI Express hotplug slot index numbers (example:
ens1
)- Names incorporating physical/geographical location of the connector of the hardware (example:
enp2s0
)- Names incorporating the interfaces's MAC address (example:
enx78e7d1ea46da
)- Classic, unpredictable kernel-native ethX naming (example:
eth0
)
So what you observe on installing 15.10 is a consequence of Ubuntu evolution.
Solution 2:
If you need to set the static IP of the VM:
Change the "Network Adapter" to bridged mode in Oracle's Ubuntu VM system settings.
Start Ubuntu VM
Type
ifconfig
ifconfig returns
enp0s3
andlo
, therefore,Type
sudo ifconfig enp0s3 192.168.0.111 netmask 255.255.255.0
and you will set the static IP of the VM to 192.168.0.111.