How to make changes to DNS configuration take effect immediately in Linux?

In Linux systems, changes to DNS configurations don’t take effect immediately, instead requiring a restart of the network service or a refresh of the DNS cache for the changes to be applied.

Here are two ways that can take immediate effect:

  1. Restart network services.
  2. If you are using systemd, you can restart the network service with the following command: sudo systemctl restart network.
  3. If you are using init.d, you can restart the network service with the following command: sudo /etc/init.d/network restart.
  4. Clearing the DNS cache:
  5. If you are using systemd-resolved, you can refresh the DNS cache by using the following command: sudo systemd-resolve –flush-caches
  6. If you are using nscd (Name Service Cache Daemon), you can refresh the DNS cache with the following command: sudo /etc/init.d/nscd restart.
  7. If you are using dnsmasq, you can refresh the DNS cache with the following command: sudo /etc/init.d/dnsmasq restart.

You can immediately make DNS configurations take effect by using any of the methods mentioned above.

Leave a Reply 0

Your email address will not be published. Required fields are marked *


广告
Closing in 10 seconds
bannerAds