How to restore network connectivity after accidentally removing netplan.io on Ubuntu Cloud Servers

2023-08-24 By Nathan 4851 Views linux networking troubleshooting netplan
3 reviews

Accidentally removing essential components like Netplan.io from your Ubuntu cloud server can lead to the loss of network connectivity. Netplan.io is a Linux utility used for configuring and managing network settings on Ubuntu systems through YAML-based configuration files, simplifying the process of network setup and management. It helps users define network interfaces, IP addresses, and routing rules in a structured manner.


After encountering installation issues on Ubuntu, various attempts were made to rectify the problem using commands like apt purge, remove, autoclean, and autoremove. Unfortunately, these efforts may result in the removal of both netplan and network connectivity.


In this guide, we will walk you through the steps to recover network access and restore your server's connectivity.


  1. Utilize the ip a command to verify whether the server has an IP configuration.

    # ip a
    

    netplanio1


    In the screenshot provided above, it is apparent that the server does not have any IP configuration set.

  2. Command cat /etc/netplan/50-cloud-init.yaml is used to display the contents of the 50-cloud-init.yaml file located in the /etc/netplan/ directory.

    # cat /etc/netplan/50-cloud-init.yaml
    


    This file is part of the Netplan configuration system on Ubuntu Linux systems and is commonly used to define and manage network interfaces and settings.

    netplanio2


    From the screenshot above, it's evident that there are no problems with the netplan.io network configuration file.

  3. Utilize the networkctl command to inspect the network card status on the server.

    # networkctl
    

    netplanio3


    See that the ens3 is off in the server.

  4. Use the commands below to enable network for the server.

    # ip link set ens3 up 
    
    # ip address add <ip address="">/24 dev ens3
    
    # ip route add default via <gateway> dev ens3
    

    netplanio10


    In a network setup, if the IP address is chosen as 203.86.232.3, the gateway assigned is 203.86.232.1, adjusting the last segment of the IP address to 1 designates the gateway for LayerStack server.

  5. Run the update command on the server.

    # apt update
    

    netplanio5


    There is an error while running the update command.

  6. Add 2 DNS servers such as 8.8.8.8 and 8.8.4.4 in your /etc/resolve.conf.

    # vi /etc/resolve.conf
    
    nameserver 8.8.8.8
    nameserver 8.8.4.4
    

    netplanio6

    netplanio7

  7. Run update command on the server again.

    # apt update
    

    netplanio8


    The update is running fine now from the above screenshot.

  8. Install netplan.io.

    # apt install netplan.io
    

    netplanio9


    Once netplan.io is installed, make sure to reboot the server once. The network connection will be running smoothly.


Related Tutorials

What do you think about this article?

Rate this article
LayerStack Promotion
Need assistance?

Try this guide to receive free bundled services at signup on a new free account.

Sign Up

Your Feedback Is Important

We hope you’ll give the new products and updates a try. If you have an idea for improving our products or want to vote on other user ideas so they get prioritized, please submit your feedback on our Community platform. And if you have any questions, please feel free to ask in the Community or contact our Technical Support team.