How to switch back networking to /etc/network/interfaces on Ubuntu 22.04 Jammy Jellyfish Linux

This tutorial will explain how to switch back networking from NetPlan/CloudInit on Ubuntu 22.04 Jammy Jellyfish Linux to the – now already obsolete – networking managed via /etc/network/interfaces.

In this tutorial you will learn:

  • How to revert to eth0..n network naming convention
  • How to install ifupdown
  • How to remove CloudInit
  • How to enable networking daemon
WARNING
Switching back from NetPlan/CloudInit to the now obsolete networking daemon is not supported nor recommended as you might end up with a broken system. It has been obsolete now for multiple Ubuntu versions.
How to switch back networking to /etc/network/interfaces on Ubuntu 22.04 Jammy Jellyfish Linux
How to switch back networking to /etc/network/interfaces on Ubuntu 22.04 Jammy Jellyfish Linux
Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Ubuntu 22.04 Jammy Jellyfish
Software N/A
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

How to switch back networking to /etc/network/interfaces on Ubuntu 22.04 step by step instructions



Twitter icon Follow LinuxConfig.org on Twitter for the latest tips and tricks about Linux!

  1. The first thing we need to do is open a command line terminal and execute the following commands to install the appropriate tools to configure network interfaces.
    $ sudo apt update
    $ sudo apt install ifupdown net-tools
    
  2. Next, change from current enp0s3 to old network interfaces naming convention eth0. To do so, with root permissions open the /etc/default/grub configuration file.
    $ sudo nano /etc/default/grub
    
  3. Inside of this file, change the following line.
    FROM:
    GRUB_CMDLINE_LINUX=""
    TO:
    GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0"
    
    Edit Grub boot to change to old network interfaces naming convention eg. eth0
    Edit Grub boot to change to old network interfaces naming convention eg. eth0
  4. Save your changes and exit the file. Once ready update Grub with this command:
    $ sudo update-grub
    
  5. Reboot your system for the new changes to take effect:
    $ sudo reboot
    
  6. As root or any administrative user edit the /etc/network/interfaces file and set eth0 network interface to obtain the IP address from DHCP:
    source /etc/network/interfaces.d/*
    
    # The loopback network interface
    auto lo
    iface lo inet loopback
    
    # The primary network interface
    allow-hotplug eth0
    iface eth0 inet dhcp

    Check this article if you need to set your network interface to a static IP address.

  7. Restart eth0 interface:
    $ sudo ifdown --force eth0
    $ sudo ifup eth0
    
    NOTE
    Network restart via /etc/init.d/networking is not functional. To restart your network use the ifdown and ifup commands as shown above.
  8. At this stage you should have your eth0 configured. Use ifconfig command to check the networking interface configuration:
    $ ifconfig
    
  9. First disable and stop Configure DNS resolution to eg. 8.8.8.8 (Google’s DNS server) nameserver:


    $ sudo unlink /etc/resolv.conf
    $ sudo echo nameserver 8.8.8.8 >> /etc/resolv.conf
    
  10. Let’s perform some cleanup. Remove cloud init package:
    $ sudo dpkg -P cloud-init
    $ sudo rm -fr /etc/cloud/
    
  11. Disable and stop systemd-resolved service:
    $ sudo systemctl disable --now systemd-resolved
    

Closing Thoughts

In this tutorial, we saw how to switch back to the old networking from NetPlan/CloudInit on Ubuntu 22.04 Jammy Jellyfish Linux. This was the old way to manage networking on Linux systems, but has since become obsolete. This is a nice way to bring back the simplicity of networking to your modern Ubuntu 22.04 system.