How to configure Ubuntu 18 to use eth0 and switch back to /etc/network/interfaces file?

Have more questions? Submit a request

Applicable to:

  • SolusVM

Question

During creating of custom Ubuntu KVM template you may want to deploy Ubuntu 18 virtual server using ISO image. In the case network interface will have new name type like ens0p1.

However, SolusVM uses old names for network interface when it configures network inside of the KVM virtual servers. How to configure Ubuntu 18 to use eth0 and switch back to /etc/network/interfaces file?

Answer

Ubuntu 18 uses netplan and networkd-dispatcher as a default. The steps below describes how to switch back to networking service and /etc/network/interface file

  1. Connect to the server via SSH

  2. Install system updates and ifupdown package

    # apt-get update
    # apt-get install ifupdown

  3. Configure /etc/network/interfaces file according to your requirements. Here is an example of minimal configuration:

    # cat /etc/network/interfaces
    # ifupdown has been replaced by netplan(5) on this system. See
    # /etc/netplan for current configuration.
    # To re-enable ifupdown on this system, you can run:
    # sudo apt install ifupdown
    auto lo
    iface lo inet loopback
    auto eth0
    iface eth0 inet static
    address 10.10.10.10
    netmask 255.255.0.0
    gateway 10.10.1.1
    dns-nameservers 8.8.8.8 8.8.4.4

    Note: Interface name is eth0. Make sure that you replaced IP address, netmask and other parameters with actual values for your network

  4. Apply the configuration:

    # ifdown --force ens3 lo && ifup -a

  5. Disable and remove unnecessary services:

    # systemctl stop networkd-dispatcher
    # systemctl disable networkd-dispatcher
    # systemctl mask networkd-dispatcher
    # apt-get purge nplan netplan.io

Then

  1. Connect to the server via SSH

  2. Edit grub file:

    # nano /etc/default/grub

    Before

    CONFIG_TEXT: GRUB_CMDLINE_LINUX=""

    After

    CONFIG_TEXT: GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0"

  3. Generate a new grub file:

    # grub-mkconfig -o /boot/grub/grub.cfg

  4. Reboot the server

Articles in this section

Was this article helpful?
0 out of 0 found this helpful
Share

Comments

0 comments

Please sign in to leave a comment.