DNS flush required when you changed the certain domain name IP address's or Domain names. DNS cache will keep the old record so we may need to flush DNS cache to retrieve new IP or Domain names.
resolve.conf usually have the DNS server details
so DNS flus command also something related to resolve
[root@centos ~]# systemd-resolve --flush-caches
Failed to flush caches: Unit dbus-org.freedesktop.resolve1.service not found.
[root@centos ~]#
//the DNS flush command is not working here, propobly need to check with the resolved services
[root@centos ~]# systemctl status systemd-resolved.service
● systemd-resolved.service - Network Name Resolution
Loaded: loaded (/usr/lib/systemd/system/systemd-resolved.service; disabled; >
Active: inactive (dead)
Docs: man:systemd-resolved.service(8)
https://www.freedesktop.org/wiki/Software/systemd/resolved
https://www.freedesktop.org/wiki/Software/systemd/writing-network-co>
https://www.freedesktop.org/wiki/Software/systemd/writing-resolver-c>
lines 1-7/7 (END)
//resolved.service seems to be inactive, this service must be active in order to flush DNS.
[root@centos ~]# systemctl restart systemd-resolved.service
[root@centos ~]# systemctl status systemd-resolved.service
● systemd-resolved.service - Network Name Resolution
Loaded: loaded (/usr/lib/systemd/system/systemd-resolved.service; disabled; vendor preset: disabled)
Active: active (running) since Thu 2021-09-23 05:59:11 PDT; 2s ago
Docs: man:systemd-resolved.service(8)
https://www.freedesktop.org/wiki/Software/systemd/resolved
https://www.freedesktop.org/wiki/Software/systemd/writing-network-configuration-managers
https://www.freedesktop.org/wiki/Software/systemd/writing-resolver-clients
Main PID: 35599 (systemd-resolve)
Status: "Processing requests..."
Tasks: 1 (limit: 11231)
Memory: 1.6M
CGroup: /system.slice/systemd-resolved.service
└─35599 /usr/lib/systemd/systemd-resolved
//now check the flush command
[root@centos ~]# systemd-resolve --statistics
DNSSEC supported by current servers: yes
Transactions
Current Transactions: 0
Total Transactions: 2
Cache
Current Cache Size: 0
Cache Hits: 0
Cache Misses: 0
DNSSEC Verdicts
Secure: 0
Insecure: 0
Bogus: 0
Indeterminate: 0
[root@centos ~]#
[root@centos ~]# systemd-resolve --flush-caches
[root@centos ~]# systemd-resolve --statistics
DNSSEC supported by current servers: yes
Transactions
Current Transactions: 0
Total Transactions: 2
Cache
Current Cache Size: 0
Cache Hits: 0
Cache Misses: 0
DNSSEC Verdicts
Secure: 0
Insecure: 0
Bogus: 0
Indeterminate: 0
//now the DNS flush has been done.
0 Comments