Please don't flag this question as a duplicate because I really need your help. I once used OpenDNS in my router to block some websites & now I'm stuck with at whatever I do. I have already removed OpenDNS from my router & tried half of the commands suggested in other question but none of them work for me. Most of the websites which deal with a proxy, adult content etc. are all blocked & I'm requesting for a solution.
Ubuntu – How to clear DNS cache in 18.04
dnsnetworking
Related Solutions
For 18.04 and higher
Look at Mike Shultz' answer.
For 11.10 and below
Ubuntu doesn't cache dns records by default so unless you've installed a dns cache there isn't anything to clear.
DNS records are likely cached by your provider's DNS servers so if you want to check if the DNS changes you made were successful you can interrogate a DNS server from your domain hosting service with dig:
dig -t a ns1.myhostingcompany.com @domain_registrar_dns_server
It you want Ubuntu to start caching dns I recommend installing pdnsd
together with resolvconf
. nscd
is buggy and not advisable.
Part 1 - PPPoE connection not working
I would try disabling the Network Manager and configuring the network manually like explained in Ubuntu help ADSLPPPoE. Use the Config with pppoeconf
part first which is basically running sudo pppoeconf
and answering the questions. As you need to use a different DNS server than the one of your ISP, answer no
to the question about using the peer DNS server.
Optional if your internet connection is not restarted at boot:
You can edit nano /etc/rc.local
, add the following lines before the exit
line and reboot to test it.
killall pppd
ifconfig eth0 up
pon dsl-provider
Network manager won't be used when you use the manual config but you can disable it clicking on it and de-selecting the option enable network
(and enable wireless
if present). If disabling only doesnt work, you can also uninstall it with sudo apt-get remove network-manager
and after sudo apt-get autoremove
to clean the auto-installed packages.
Part 2 Changing default ISP DNS server to openDNS
I found here that the best way to use a static DNS with resolvconf
is to add the nameserver in /etc/network/interfaces
or to add it in /etc/resolvconf/resolv.conf.d/head
. As your interfaces are automatically configured (dhcp) you have to use the head
file:
sudo nano /etc/resolvconf/resolv.conf.d/head
and add at the end:
nameserver 208.67.222.222
nameserver 208.67.220.220
Limitations
- You cannot use Network-Manager to connect. However, this automatically gets you connected to the internet. Otherwise, you can connect by running
pon dsl-provider
. To disconnect, you need to be sudo, so runningsudo poff
disconnects. - [This issue is only with Ubuntu 12.04.] While Booting Ubuntu (with Modem turned off or while it is still trying to establish a link with the ISP) - Ubuntu waits for loading
Network-Configuration
for about 2 mins and thereafter boots without Network-Configuration. To get online you have to runpon dsl-provider
.
Fixes to remove the previous tests made (not needed in other cases):
As we deleted the resolv.conf
symlink before, we need to recreate it (not needed on new install):
cd /etc
sudo rm resolv.conf
sudo ln -s ../run/resolvconf/resolv.conf /etc/resolv.conf
If this works, you can revert the changes in /etc/dhcp/dhclient.conf
we made before.
Best Answer
This should clear it
You can check with
it should show 0 in Current cache size