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.