When the internet is not working on Ubuntu 16.04
I had just downloaded Ubuntu 16.04 to dual boot with my windows 10 on my PC. After all the updates were complete and I had setup everything for use while coding, yes I am a developer, I decided to switch the operating system as I needed to transfer some files from Windows that I would need in Linux. When I had gotten all the files I restarted the machine to now access Ubuntu.
Sigh, everything was a mess. The resolution on the OS was abnormal and worse my internet was not working. The computer could neither detect any Wi-Fi network nor connect to the internet via USB tethering.
After hours of searching the internet for a solution I found one that worked for me. The problem was that the OS had somehow disabled my IPV6 address.
This code worked for me.
sudo sh -c "echo 'net.ipv6.conf.all.disable_ipv6 = 1' >> /etc/sysctl.conf"
sudo sh -c "echo 'net.ipv6.conf.default.disable_ipv6 = 1' >> /etc/sysctl.conf"
sudo sh -c "echo 'net.ipv6.conf.lo.disable_ipv6 = 1' >> /etc/sysctl.conf"
sudo sysctl -p
sudo sed -i 's/false/true/g' /etc/NetworkManager/NetworkManager.conf
sudo reboot -i NOW
After rebooting everything went back to normal. My resolution was fine and my internet was working very well.
I hope it helps you out too. All the best!