Recently, I get into strange problem, none of the browser I have on my ubuntu system: – firefox, chrome, internet explorer loading any of the web page, not even google.com get loaded. I tried to ping google from terminal but still no result. This problem generally occur if your internet conection is down. But my internet is up as I can see the connection icon up there on Right hand side of my system, Infact I can login to skype and chat with my friends. So, No doubt the problem is not with the Internet connection. Then what the hell going on here…..???
I uninstalled and installed back firefox, but issue remain same. Looking back, I realised that, everything is working when I left the office in night, so it must have to do something with VPN connection I was using last night, may be it is the culprit. Finally, I got the solution by googling for hours
SOLUTION: delete etc/resolv.conf file and create it back. restarting the browser will solve the problem
You better backup the file before deleting it as you may need to see it back if someone has made some custom change to this and want you to restore the things back.
arun@arun-yadav:~$ sudo su – # you need to be root user to edit file in etc
[sudo] password for arun: #your password
root@arun-yadav:~# cd /etc/ # moved to etc folder
root@arun-yadav:/etc# cat resolv.conf # let us see the content of this file
root@arun-yadav:/etc# rm resolv.conf # delete the file
root@arun-yadav:/etc# touch resolv.conf # create the file again
root@arun-yadav:/etc# cat resolv.conf # try to see the content after running the browser, it is empty.
Recently, I am on a system with Ubuntu 15.1 . Here resolv.conf is not a normal file but a symlink file pointing to /run/resolvconf/resolv.conf , so unlike older version, here after deleting the /etc/resolv.conf file we need to recreate as symlink pointing to /run/resolvconf/resolv.conf .
root@arun-yadav:/etc# ln -s /run/resolvconf/resolv.conf resolv.conf
If the problem still exist, check the content of /etc/hosts file. In my case, it look as below.
# BEGIN hosts added by Network Connect
# END hosts added by Network Connect
You can see at top that, sportal.thirdpillar.com added by Network connect. It get deleted automatically when you logout of VPN, since you didn’t logged out and shut down the system or the VPN crashed, the above line failed to delete. So delete them, so that it look as below
Now restart the network with below command.
sudo /etc/init.d/networking restart
close the browser and start it again. It will work now .
EXPLAINATION OF PROBLEM
PROBLEM : Internet up skype working but browser not laoding any wab page
The content of resolv.conf file is getting added by juniper, which provide VPN(virtual private network) for the financial website Iam working on. When I started juniper and again see the file, I see the both entry again.
root@arun-yadav:/etc# cat resolv.conf
Now, I logout of the juniper and try to see this file again
root@arun-yadav:/etc# cat resolv.conf #it print nothing
I read about resolv.conf file here and try to make some sense of the problem with which I was pulling my hair.I do not know exactly, but can make out below explanation:
when you request a page say google.com,Then name server (often known as DNS) on your system will resolve google.com to its IP address. generally, if nothing specified in resolv.conf file, the nameserver will be assumed to be that of localhost running at port 53. But, if you define it in resolv.conf file,it will be regarded as nameserver for your system, Infact If you give multiple nameserver in resolv.conf file, they will be tried in that order i,e If first nameserver not able to resolve the url into IP, the next nameserver in the list will try. So, you should mention the most reliable nameserver at top.
Below, is my system nameserver before loging in to juniper VPN and after login to it
arun@arun-yadav:~/Projects/third-pillar$ nslookup localhost # not logedin to VPN, so my DNS is at my localhost port 53 i,e 127.0.0.1#53
arun@arun-yadav:~/Projects/third-pillar$ nslookup localhost # loged in to VPN and so DNS get changed
Now above we have seen that, when we start juniper it introduce a nameserver in resolv.conf file and when we logout of it, the entry also get removed. But, last night I switched off the system without loging out of juniper, so the entry get remained there. Now, in morning, when I start to access any web page, it is trying to use DNS of juniper, which will obviously not work as Iam not connected to it, Nor I can connect as juniper url https://my_finance.com/dana/home/index.cgi will itself not get resolved. It resulted in deadlock which get removed only by deleting the etc/resolv.conf file and recreating it.
Anyway….Thank God it get sorted out🙂