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"
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
rootuser. 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.
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 (18.104.22.168) 56(84) bytes of data. 64 bytes from ced1s06-us-f14.1e100.org (22.214.171.124): icmp_seq=1 ttl=114 time=67.4 ms 64 bytes from ced1s06-us-f14.1e100.org (126.96.36.199): icmp_seq=2 ttl=114 time=134 ms 64 bytes from ced1s06-us-f14.1e100.org (188.8.131.52): icmp_seq=3 ttl=114 time=73.8 ms 64 bytes from ced1s06-us-f14.1e100.org (184.108.40.206): icmp_seq=4 ttl=114 time=70.4 ms 64 bytes from ced1s06-us-f14.1e100.org (220.127.116.11): icmp_seq=5 ttl=114 time=91.6 ms 64 bytes from ced1s06-us-f14.1e100.org (18.104.22.168): icmp_seq=6 ttl=114 time=107 ms