Skip to main content
Switch network configuration from ifupdown to netplan
Last update:

Switch network configuration from ifupdown to netplan

In cloud servers created from pre-built images of Ubuntu 18.04, 20.04, and 22.04, ifupdown is used by default to configure the network.

You can switch network configuration from ifupdown to netplan — the procedure depends on whether the cloud-init agent is installed in the image.

If cloud-init is set

  1. Connect to server.

  2. Remove ifupdown and restart the server:

    apt purge ifupdown && reboot now
  3. The cloud-init agent will independently configure the network for netplan.

If cloud-init is not installed

  1. Connect to server.

  2. Create a configuration file for netplan (/etc/neplan/config.yaml). If necessary, you can add routes in the routes block:

    network:
    version: 2
    ethernets:
    eth0:
    dhcp4: true
    match:
    macaddress: <mac_address>
    mtu: 1500
    set-name: eth0

    Specify <mac_address> — MAC address of the interface.

  3. Check the syntax:

    sudo netplan try
  4. Apply the settings:

    sudo netplan apply