45

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.

3

2 Answers 2

35

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.

2
  • At the same time you are talking about Kernel evolution and yet you talk about/link to Systemd. So which one made the change? Is the Kernel just offering these new naming schemes, and Systemd is actively choosing on utilizing one of these new naming schemes?
    – joonas.fi
    Jan 6, 2017 at 9:22
  • 1
    @joonas.fi Systemd made change. Kernel by default would name everything as eth0,eth1,eth2, and so forth. Systemd came along and said " thats cool but classic naming doesnt help to figure out which card is which and connected to what". Jan 19, 2017 at 13:01
20

If you need to set the static IP of the VM:

  1. Change the "Network Adapter" to bridged mode in Oracle's Ubuntu VM system settings.

  2. Start Ubuntu VM

  3. Type ifconfig

  4. ifconfig returns enp0s3 and lo, therefore,

  5. 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.

2
  • Why does the static IP need a 24-bit netmask if you are assigning a single address to the machine? Just wondering what the need for it is, not questioning it.
    – Anthony O
    Dec 30, 2019 at 5:23
  • @Anthony O , netmasks are used to know what pool of addresses the host pertains to. By setting the netmask 255.255.255.0 (equivalent to /24), with 192.168.0.111 as the host address, we're saying the local network is all clients from 192.168.0.0 to 192.168.0.255. Everything else is internet, and needs to be sent through a router (take a peek at ip route to view route paths)
    – mazunki
    Aug 14, 2021 at 23:12

Not the answer you're looking for? Browse other questions tagged or ask your own question.