If you’ve ever switched hosting providers, you’ve likely experienced that nail-biting period when your trang web isn’t loading yet in your browser, even though the DNS should have already propagated.
Your host will probably give you the standard line: “DNS propagation takes 24-72 hours. Wait.” But did you know that by flushing your DNS, you might be able to lớn over that painful waiting game immediately? (Assuming that the DNS propagation is complete and nothing else is wrong, such as improper nameserver configurations.) Clearing your DNS cache can also protect your privacy, resolve mạng internet connectivity issues, and prevent DNS spoofing. Get ready to lớn learn, as I’ll walk you through how to lớn clear DNS cache (flush DNS), what it means, and why you might want to lớn try it. Table of Contents The process for flushing DNS varies depending on your computer’s operating system. Let’s go over the process for the major systems below. The process for flushing your DNS cache on a Mac computer is similar, regardless of the operating system version. But for step 6, you’ll need to lớn know which version since the command prompt varies. 1. Open Finder. 2. Click Applications. 3. Scroll down to lớn the Utilities thư mục and click it. 4. Open Terminal. 5. To open Terminal, you could also simply open Launchpad and type in “Terminal” in the tìm kiếm bar. 6. In the Terminal window, type in one of the following commands based on your software version: 7. Hit Enter. 8. Type your password and press Enter again. 9. You might see a message confirming that the DNS cache has been reset. Here’s the process for flushing your DNS cache on Windows 10 and 11. These steps should also work for Windows 8.1. 1. Click the Start button. It’s the Windows logo in the bottom left corner. 2. Select Command Prompt (also called “Terminal”). Source 3. To open the Command Prompt console, you could also simply press the Windows and R keys at the same time and enter cmd. 4. You may see a popup asking if you want to lớn allow Command Prompt to lớn make changes to lớn your computer. If you vì thế, select Yes. 5. If you are asked for an administrative login at this point, then you’ll need to lớn tương tác your system administrator to lớn proceed. 6. In the command prompt window, type ipconfig /flushdns. Source 7. Press Enter. 8. You should see a message confirming that the DNS Resolver Cache was successfully flushed. The process for flushing your DNS cache on Windows 7 is nearly identical to lớn that of newer versions. 1. Click the Start button. It’s the Windows logo in the bottom left corner. 2. Click All Programs > Accessories. 3. Find Command Prompt. Right-click it, and choose Run as administrator. Source 4. You may see a popup asking if you want to lớn allow Command Prompt to lớn make changes to lớn your computer. If you vì thế, select Yes. Source 5. If you are asked for an administrative login at this point, then you’ll need to lớn tương tác your system administrator to lớn proceed. 6. In the command prompt window, type ipconfig /flushdns. 7. Press Enter. 8. You should see a message confirming that the DNS Resolver Cache was successfully flushed. Pro tip: Unlike Windows and Mac computers, Linux systems don’t necessarily have a DNS cache by mặc định. For that reason, it’s a good idea to lớn first kiểm tra that your Linux computer has a local DNS cache. If you try to lớn flush the cache and get an error message, it’s likely that you don’t have a DNS service installed. Below is an example from a Linux Mint diễn đàn of what that error might look lượt thích. The user did not have the DNS service systemd-resolved installed, ví the command to lớn flush the DNS did not work. Source Additionally, each distribution might use a different DNS service to lớn store DNS records locally. Depending on the service, you can either clear the cache or restart the service. 1. Press Ctrl+Alt+T on your keyboard to lớn launch a terminal window. Source 2. In the Terminal window, type in one of the following commands based on the service your Linux system is running. 3. You may be asked to lớn enter your password. 4. The service might stop, then start again before sending a confirmation message that the cache was successfully reset. Here’s what the flush DNS command looked lượt thích when I tried these steps on a Linux virtual machine running Ubuntu 24.04.1: Google Chrome is not an operating system, but it does keep a DNS cache of its own. This is separate from your operating system’s cache and from Chrome’s browser cache. If Chrome is phối as your mặc định trang web browser, then you’ll need to lớn clear both Chrome’s DNS cache and your operating system’s DNS cache. Here’s the process: 1. Type the following address into your browser’s address bar: chrome://net-internals/#dns 2. Click the Clear host cache button. 3. All done! A DNS (Domain Name System) cache is a record of all queries made to lớn a DNS server from your browser. When you enter a URL into your browser, your browser sends a request to lớn the DNS server asking for the URL’s IP address. After your browser receives the IP address, it can then load the correct trang web in your window. But what happens when you try to lớn access the trang web a second time? Does the browser have to lớn make a whole new request to lớn the DNS server? No. By mặc định, most operating systems will cache IP addresses and other Domain Name System (DNS) records in order to lớn fulfill future requests more quickly. This is your DNS cache. The DNS cache prevents browsers from having to lớn make a new request ví that, instead, it can use stored information to lớn load the trang web. This reduces server response times, making the site load more quickly. Flushing DNS will clear any IP addresses or other DNS records from your cache. This can help resolve security, mạng internet connectivity, and other issues. For example, when I type in https://lonezscents.com/ in my browser’s address bar for the first time, the browser has to lớn ask DNS servers where to lớn find the site. Once it has that information, the browser can store it in its local cache. Then, the next time I type in that trang web address, the browser will look for its DNS information in the local cache first and be able to lớn find the site more quickly. The problem is that sometimes dangerous IP addresses or corrupted results can be cached and need to lớn be removed. The DNS cache can also impact your ability to lớn connect to lớn the mạng internet or cause other issues. Whatever the reason, all major operating systems allow you to lớn force the process of clearing this cache — or “flushing DNS.” It’s important to lớn understand that your DNS cache will clear itself out from time to lớn time without your intervention. That’s because the DNS cache — in addition to lớn saving all information that’s relevant to lớn identifying and finding a trang web — also saves a component called TTL, or time to lớn live. Source TTL specifies a period of time (in seconds) in which the DNS record for a site remains valid. Within this time period, any queries to lớn the trang web are answered from the local cache without the help of the DNS server. Once the TTL expires, the entry will be removed from the cache. However, there are reasons you may need to lớn force a DNS flush rather phàn nàn wait for the TTL of all the entries to lớn expire. Let’s take a look at why below. There are a few reasons you might need to lớn flush your DNS cache: technical problems, security, or data privacy. Let’s briefly cover each one below. One reason you might want to lớn clear DNS cache is if you recently changed hosts, launched a new trang web, or added a CDN or firewall. These are all reasons that clients have contacted Shane Larrabee, founder of WordPress hosting and tư vấn provider FatLab. “Typically, clients don’t know that their local DNS cache needs to lớn be flushed,” he says. “Instead, they gọi complaining that part or the whole trang web is not loading or loading with a different version phàn nàn expected.” This happens because the DNS information on your computer may not get updated right away. So it’ll show a 404 error or an outdated version of a site when you try to lớn visit from your browser. It's a situation HubSpot staff writer Amy Rigby once found herself in. "A freelance client hired bủ to lớn migrate her WordPress.com blog over to lớn self-hosted WordPress on SiteGround,” Rigby explains. “After the migration, when I tried to lớn log into her site to lớn make edits, the old trang web loaded — which sent bủ into a panic.” Rigby used an online tool called whatsmydns.net, which showed her that the DNS had already finished propagating. That meant the migration was indeed successful, but her computer was “stuck in a DNS cache,” as her WordPress tư vấn person explained to lớn her at the time. In cases lượt thích Rigby’s, the information will eventually get updated in your local DNS cache, but you don’t have to lớn wait. You can force the DNS cache to lớn clear and get the trang web to lớn load in your browser immediately. “I wish I’d known this earlier,” she adds. Pro tip: If this is the case for you, try clearing your browser cache first. Flushing the DNS isn’t the first fix Larrabee would reach for. “If we know that the DNS records have changed recently, we will first have them clear their browser cache (which includes DNS information),” he says. “This rules out the first-level DNS cache plus the browser cache. If that does not resolve the issue, we will ask them to lớn be patient if changes to lớn the DNS records are recent.” Why not just immediately clear the DNS cache? “Clearing the computer DNS is a bit tricker and typically requires opening Terminal on a Mac or Command on a PC and running a command,” he explains. “This is not hard, but the terminal can be intimidating; therefore, we typically have to lớn walk a client through it.” Additionally, there are other reasons why you might not be seeing your updated trang web in your browser. “I have seen scenarios where IT folks have hardcoded non-expiring DNS records in place for the trang web, ví no matter what, the client cannot see the changes within their corporate system until IT changes those,” says Larrabee. “I have also seen corporate IT systems that override TTLs for a very long time in the name of network efficiency.” For that reason, sometimes, all we can vì thế is wait. DNS spoofing — also known as DNS cache poisoning — is an attack in which bad actors gain access to lớn your DNS cache and alter the information in order to lớn redirect you to lớn the wrong sites. In some cases, they will redirect you to lớn a fraudulent trang web that resembles its intended destination ví that you enter sensitive information, lượt thích your online banking login information. Source Pro tip: While flushing the DNS cache can help, there are multiple other ways to lớn enhance your website’s security. Here's a miễn phí trang web safety checklist we put together with the help of security experts. When you think of tracking user behavior on the mạng internet, you probably think of cookies — but the DNS cache can reveal your tìm kiếm history as well. That’s because the DNS cache is designed to lớn act lượt thích a virtual address book, storing the information of the websites you visit regularly. To keep this information away from data collectors or bad actors on the trang web, you might decide to lớn flush your DNS cache. Flushing your DNS cache is not a common task, but there are some situations in which you might want to lớn try it. It can help prevent phishing schemes or other attacks on your computer, direct you to lớn the most up-to-date version of a trang web, restore your mạng internet connection, and keep your tìm kiếm behavior private. The best part is how easy the process is. Following the steps above can help you perform a DNS flush quickly and easily, no matter your computer’s operating system. That way, you can move on to lớn your other trang web development tasks. This article was written by a human, but our team uses AI in our editorial process. Check out our full disclosure to lớn learn more about how we use AI. Editor's note: This post was originally published in February 2021 and has been updated for comprehensiveness.
How to lớn Flush DNS on Mac OS X
How to lớn Flush DNS on Windows
How to lớn Flush DNS on Windows 10 và 11
How to lớn Flush DNS on Windows 7
How to lớn Flush DNS on Linux
How to lớn Clear DNS Cache on Chrome
What is DNS cache?
What does flush DNS do?
Why would you flush DNS?
1. You’re seeing a 404 error or an old version of your trang web.
2. You want to lớn prevent DNS spoofing.
3. You want to lớn keep your tìm kiếm behavior private.
Flushing Your DNS Cache: Just One Step to lớn Try as You Troubleshoot
Flush DNS: How to Clear DNS Cache (“I Wish I'd Known This Earlier”)
- 14,000
- Tác giả: admin
- Ngày đăng: 09:30 12/12/2024
- Lượt xem: 14
- Tình trạng: Còn hàng