Cyberithub

Solved "No Internet Connection After Installation of Ubuntu 20.04"

Advertisements

In this article, we will discuss how to fix the No Internet Connection issue after you installed Ubuntu 20.04. It is very often observed that after installing Ubuntu 20.04 either on a Physical Server or on a virtual machine, if you try to connect Internet then it won't work. This usually happens when your network interface is not given properly due to which it is not able to fetch the IP from dhcp. I thought to put together all the steps which I followed to solve this issue.

What is Netplan

According to Netplan official website, it is a utility for easily configuring networking on a Linux system. You simply create a YAML description of the required network interfaces and what each should be configured to do. From this description Netplan will generate all the necessary configuration for your chosen renderer tool.

Solved "No Internet Connection After Installation of Ubuntu 20.04"

Solved "No Internet Connection After Installation of Ubuntu 20.04"

Network Connection in Ubuntu 20.04 is managed by the Netplan. So first you need to check the current settings of netplan from /etc/netplan/01-network-manager-all.yaml file. You can use utility like cat command to check the YAML configuration as shown below.

root@localhost:~# cat /etc/netplan/01-network-manager-all.yaml
# Let NetworkManager manage all devices on this system
network:
version: 2
renderer: NetworkManager

NOTE:

Please note that here I am running all the commands with root user. You can also use root user or any other user with sudo access to run all these commands.

If you check the above file carefully then you can see that it does have enough information to run the Internet Connection. So we need to generate a new configuration using YAML file. For that first you need to move all the old yaml file under /etc/netplan to some other file as shown below.

root@localhost:~# mv /etc/netplan/*.yaml /etc/netplan/01-network-manager-all.yaml
mv: '/etc/netplan/01-network-manager-all.yaml' and '/etc/netplan/01-network-manager-all.yaml' are the same file

After renaming the file, you now need to create a new file by using nano /etc/netplan/01-netcfg.yaml command. This YAML file will let the interface named enp0s3 get an address via DHCP.

root@localhost:~# nano /etc/netplan/01-netcfg.yaml
network:
  version: 2
  renderer: networkd
  ethernets:
    enp0s3:
      dhcp4: true

Press Ctrl+X to save and exit the file. Above file is space and indentation sensitive. Then run netplan generate command to generate the configuration.

Advertisements
root@localhost:~# netplan generate

Finally, apply the configuration by using netplan apply command.

root@localhost:~# netplan apply

Then check the Internet connection again by using ping google.com command. We are now getting the response which confirms that the issue of "No Internet Connection" is now solved. Hopefully, this will help you as well.

root@localhost:~# ping google.com
PING google.com (42.150.94.174) 56(84) bytes of data.
64 bytes from ced1s06-us-f14.1e100.org (42.150.94.174): icmp_seq=1 ttl=114 time=67.4 ms
64 bytes from ced1s06-us-f14.1e100.org (42.150.94.174): icmp_seq=2 ttl=114 time=134 ms
64 bytes from ced1s06-us-f14.1e100.org (42.150.94.174): icmp_seq=3 ttl=114 time=73.8 ms
64 bytes from ced1s06-us-f14.1e100.org (42.150.94.174): icmp_seq=4 ttl=114 time=70.4 ms
64 bytes from ced1s06-us-f14.1e100.org (42.150.94.174): icmp_seq=5 ttl=114 time=91.6 ms
64 bytes from ced1s06-us-f14.1e100.org (42.150.94.174): icmp_seq=6 ttl=114 time=107 ms

9 thoughts on “Solved "No Internet Connection After Installation of Ubuntu 20.04"”

  1. I followed the instructions but still have no internet access. Also, changing renderer from "Network Manager" to "networkd" disables wired network management in the Ubuntu desktop.

    Reply
    • Hi Greg,

      Thanks for your feedback.
      Actually, in my case changing renderer to networkd and adding ethernet interface with dhcp on solved the issue. You can keep the renderer same as Network Manager and only add the ethernet interface detail and check if it solves your issue.

      Reply
  2. Hi
    I install Ubuntu Server 20.04 on my system. Then I install Ubuntu Minimal Desktop for the GUI. But when I open the network icon is not there. But I can surf net. Problem is when I go settings to set up my Google Account, I cannot as it says ¨No Internet Connection - Connect to set up online accounts

    I follow your advise and the outputs as below. May I know what could be the problem

    jq@asus:~$ cat /etc/netplan/01-network-manager-all.yaml
    cat: /etc/netplan/01-network-manager-all.yaml: No such file or directory

    Thanks

    Reply
    • Hi JQ,

      If you don't have /etc/netplan/01-network-manager-all.yaml file in your system, then you can create this and proceed with the steps. Please try once and let me know if it works for you.

      Thanks & Regards
      CyberITHub

      Reply
  3. This worked for me. Did exactly, key by key what was suggested to type and presto, all good. I am on GCP with a nomachine RDP connection and all is working.

    Thank you.

    Reply
  4. Same issue here, did the steps as described and managed to get telegram work and connecting to Internet but all the rest still doesn't work. Any suggestions?

    Reply

Leave a Comment