Strange behaviour of ineternet

I have the strange problem of my internet not allowing me to open certian websites sometimes, and restarting my modem usually fix this, but yesterday, it started acting strange. my facebook page wont open , so I tried to ping the website and received nothing, but at the same time, youtube and other sites were working good.... and I tried to open browser on my mobile with wifi and it says check your internet connection, strange thing is, it gets fixed itself sometimes and again go bad itself after few hours. I thought its problem of my operating system and reinstalled it,but realised I still have the same problem. :'(:'( I tried resetting modem yesterday and its still the same , is there any solution to it :'(
 
Most likely this is a DNS issue.

Remember, that a website name (the url) gets translated into an IP address for access
eg: www.techspot.com has the ipaddress of 198.105.254.228​
How do you find that?
  • get a command prompt
  • enter NSLOOKUP www.techspot.com
  • obviously any name can be translated with this interface to DNS
SO; your ISP sends a DNS setting to your modem and that gets inherited by your router (if any).

*IF* your DNS addresses get hacked, then your access to any site can be redirected or even rejected.

Recommendations:
  1. find and update the firmware in your modem and/or your router
  2. if it still persists, manually set dns addresses in your router to more reliable
    1. 8.8.8.8 and 8.8.4.4
Your host file at \windows\system32\drivers\etc\hosts could be corrupt or subject to hacking
if you see tons of entries in that file:
edit it
leave only this line in the file localhost 127.0.0.1
save
set Readonly on the file
 
Back