Yandex
Update cookies preferences

How to move from Netplan to network interfaces

Since Ubuntu Server 18.04, the network on the server is managed using Netplan, instead of the usual network interfaces that everyone is familiar with (/etc/network/interfaces).
Netplan is a new network management software for the Ubuntu operating system, the difference being the use of the YAML programming language. The most common cause of network configuration errors in YAML is its sensitivity to spaces. Many people do not immediately realize it because of what creates a prolonged unavailability of the server. And to avoid downtime due to lack of skills in working with Netplan, some people decide to switch to their usual network management with the help of network interfaces, the configuration file of which is located at /etc/network/interfaces.

Netpan configuration file

The Netplan network configuration file is located in the /etc/netplan directory, and the file itself may have a different name, depending on the system configuration. The file extension is .yaml. Before you go to network/interfaces you need to study a little Before you go back to the old method, you need to read the existing network configuration. To do this, use the command:
cat /etc/netplan/*.yaml20240923_es3EivfG

Installing the ifupdown package

The ifupdown package is required to install the required network interface management software in the /etc/network/interfaces file. It can be installed using the command:
apt install ifupdown

Disabling Netplan

Now we need to disable netplan so that it can be managed exclusively by ifupdown. To do this, rename or delete the /etc/netplan directory, e.g. with the following command:
mv /etc/netplan /etc/netplan_backup/20240923_kmaIpsLH

Configuring network interfaces

Next, you need to configure the network in the /etc/network/interfaces file. The file can be edited, for example, with the nano editor.
nano /etc/network/interfacesEnter the network data based on the previously obtained data from the Netplan configuration.
20240923_ByPdTL8j

Starting the service:
systemctl restart networkingYou can check the network by using the command:
ip a

Removing Netplan

This action is not mandatory, but if you are determined to migrate and stay with ifupdown network configuration software, then it is better to remove netplan from the system:
apt remove netplan.io

Going back to netplan

If you decide in the future to go back to managing your network using the netplan tool, the steps below will help you do so.

Restoring the netplan configuration

Execute command:
mv /etc/netplan_backup /etc/netplan20240923_fWjwjMIl

Installing the netplan package

Reinstall the previously removed netplan package. If the package was not removed, skip the action.
apt install netplan.ioAfter restoring the Netplan configuration, you must apply it using the following command:
netplan applyYou can verify that the network is correct again using the same command used previously:
ip a20240923_mb18Jx1D

Removing the ifupdown package

If the network works and netplan gives no errors, then execute:
apt remove ifupdown
23 Sep 2024, 15:32:36

Dedicated Servers, NL

Browse Configurations