Score:0

Can I blacklist a website from DNS cache Ubuntu 22.04

qa flag

I'm having trouble with a specific university related site on Ubuntu 22.04. I have to flush DNS cache every time I want to access it as it seems that the main link and the link with a path point to different places and the cache is getting it wrong. I'm not sure if I'm understanding this exactly right but flushing the cache appears to fix the issue though

e.g. if google.com and google.com/search pointed to different places

Is there any way to blacklist a certain site from being cached without disabling the cache altogether? Thanks!

tink avatar
aw flag
I'm curious - why did you delete [your question on Stackoverflow](https://stackoverflow.com/questions/76978701/formatting-git-log-shortstat-as-csv-how-do-i-get-changes-insertions-deletion)? It was valid, all people wanted was some sample input and desired output in a proper format. I had just started playing with solving it when the question disappeared.
Thrilla avatar
qa flag
@tink Thank you for helping me with it, I deleted it because I thought I didn't give enough information and I figured out a way to do it in C# anyway without sed so I didn't want to waste anyone's time. I don't think sed can do what I wanted to do anyway as it seems to just find and replace strings so I just decided to give up on it and try to implement in C#. Thank you for trying to help solve it and if you'd like to know my solution let me know. Thanks
tink avatar
aw flag
Fair enough, and I'm glad you got it sorted =}
Score:0
it flag

It would be common that when you're on the university's LAN, DNS resolves to the internal LAN IP. When you try to access the same site from the Internet, you get the public, Internet-routable IP. The problem is that the Time to Live (TTL) for the record is set too high. TTL is set by the administrator of the domain records, but having high TTL is pretty common. For example, many systems default TTLs to one hour (1hr), while others use five minutes (5m).

This isn't exactly what you're asking, though technically does bypass any caching, it should solve the problem pretty simply. You could add an entry for the domain in your /etc/hosts, pointing to the public IP you are given when off the local network. Technically it could not route correctly while on the LAN, but typically this will work and allow you to reach the website regardless of being on the university LAN or somewhere else on the Internet.

You can obtain the Internet IP address while off of the LAN:

sudo apt install dnsutils
dig domainname.tld

If you set up your own DNS server, which would be a bit more complicated, you could overwrite the TTL values of all or specific domains, but it seems like overkill unless you have other reasons to set up and manage your own DNS server.

Thrilla avatar
qa flag
Hi, thank you so much for your help with this. The weird thing is, I haven't actually tried to access it on the LAN, this is on my PC at home, so it should only be using the internet to access the site. It works absolutely fine on Windows, but when I boot to Ubuntu it gives DNS_PROBE_POSSIBLE on Chrome and doesn't load until I flush DNS. The hosts file will probably sort this out too though right? And is there anything else this could be?
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.