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.

Advertisements

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:

Advertisements
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.

Advertisements
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.

root@localhost:~# netplan generate

Finally, apply the configuration by using netplan apply command.

Advertisements
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

21 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
  5. Hello,
    I get an error saying: [ Error writing /etc/netplan/01-netcfg.yaml: permission denied ] after following the above steps. I just installed Ubuntu and am unable to get any internet connection.

    Thanks.

    Reply
      • Hello,

        How would I check for such permission? I am brand new to Linux, so I'm a tad bit confused as to why I wouldn't have full permission to run the command.

        Thank you.

        Reply
          • Good Morning,

            A Co-worker of mine looked at my system while I was out of town on a business trip. After a while of messing with the system, it turns out the Ethernet Ports had been given a last priority protocol in the BIOS to where they were disabled. After changing their priority, Ubuntu now recognizes the ethernet port just fine. Figured I would provide an update since other users may run into the same problem when buying a second-hand server motherboard.

            Thank you for the help though!

  6. Hi
    I have same issue , filled up as the above values , but it is still failing saying as
    "ping google.com

    ping: google.com: Temporary failure in name resolution"

    Actually I have used openvPN support Bridge connection in side the virtual box to provide the Network connection with QEMU. I can do TFTP from Virtual box to QEMU. but it is failing to connect with google.com , so I have restarted the
    "systemctl restart systemd-resolved.service" & have removed the files in /etc/qemu-ifup & /etc/qemu-ifdown files, still I have same issue
    can you please let me know how to resolve the issue.

    Reply

Leave a Comment