Problem
You want to update your dns resolution locally after some change in DNS.
You want to do this because your local dns cache still holds the old information about the domain. For example using your local dns and the google one returns two different results
BASH
x
host changed_domain.com
returns the old ip
host changed_domain.com 8.8.8.8
returns the new ip.
Solution
Check your systemd-resolved is active:
BASH
sudo systemctl is-active systemd-resolved
active
Get some statistics:
BASH
sudo systemd-resolve --statistics
Transactions
Current Transactions: 0
Total Transactions: 38818
Cache
Current Cache Size: 73
Cache Hits: 21120
Cache Misses: 19745
DNSSEC Verdicts
Secure: 0
Insecure: 0
Bogus: 0
Indeterminate: 0
Flush the cache (make the Current Cache Size above 0)
BASH
sudo systemd-resolve --flush-caches
Check the cache again (should be 0 now):
BASH
sudo systemd-resolve --statistics
ransactions
Current Transactions: 0
Total Transactions: 38818
Cache
Current Cache Size: 0
Cache Hits: 21120
Cache Misses: 19745
DNSSEC Verdicts
Secure: 0
Insecure: 0
Bogus: 0
Indeterminate: 0
Information taken from https://www.techrepublic.com/article/how-to-flush-the-dns-cache-on-linux/