Website Not Loading? Troubleshoot DNS Before Suspecting Malware
This guide walks through a layered method for diagnosing a website that won't open. It starts with connectivity and DNS checks, then covers hosts files, proxy settings, browser problems, certificate errors, and security scans. It explains which tools to use, how to read their output, and when to change direction.
A website that won’t open is one of the most common failures in daily development and operations. Many people’s first thought is that their computer has malware. The real cause is often more complicated. DNS resolution failures, a modified local hosts file, a faulty system proxy, a polluted browser cache, ISP DNS hijacking, and temporary outages on the target site can all produce the same symptom. Without a clear order of checks, it is easy to spend a lot of time looking in the wrong place.
This article follows a troubleshooting order that moves from the outside in, and from the network layer to the application layer. Each step explains what to check, how to interpret the result, and when to switch to a different direction.
1. Confirm What “Won’t Open” Means
A site that “won’t open” usually shows one of three symptoms. The domain cannot be resolved at all. The domain resolves, but the connection times out. Or the connection succeeds, but the page content is abnormal or has been replaced. Each symptom points to a different troubleshooting path, so the first step is to identify which one you are seeing.
Start by checking basic connectivity. Run this command in a terminal:
ping example.com
If the command returns an IP address and receives replies, domain resolution and basic connectivity are working. If it reports “unknown host” or “could not find host,” the problem most likely lies in DNS. Scanning for viruses usually won’t help at this stage.
Keep in mind that ping only tests ICMP and domain resolution. Many websites and servers block ICMP, so ping may time out even when the site works normally. In that case, confirm the result with curl -v https://example.com or the browser developer tools. Do not conclude that a site is down based on a failed ping alone.
To find where a connection breaks along the route, use a traceroute tool. On Linux and macOS, mtr is the recommended choice:
mtr -rwc 20 example.com
This command sends 20 rounds of probes and reports the packet loss and latency for each hop. If packet loss starts at one hop and continues at every hop after it, the problem usually lies at that hop or in the links beyond it. On Windows, you can use tracert example.com. However, it makes only one probing pass, so its results are less reliable.
2. Compare DNS Results Across Multiple Resolvers
DNS is the first checkpoint when a website loads. Local caches, ISP DNS pollution, and differences between public DNS results and authoritative DNS results can all cause resolution failures or resolution to the wrong address. Compare several resolvers during troubleshooting.
The following commands are for Linux and macOS. Windows does not include dig by default. Use nslookup example.com instead, or install the BIND tools to get dig.
- Query your default DNS server:
dig example.com
- Query public DNS servers:
- Query the authoritative DNS server. First find the domain’s authoritative name servers, then query one of them directly:
dig NS example.com +shortdig @ns1.example.com example.com A
- Start at the root servers and query level by level to find where the problem appears:
dig +trace example.com
When you read the results, focus on three things. The first is the status field. NOERROR means the query succeeded. NXDOMAIN means the domain does not exist. SERVFAIL means the upstream server failed to process the query. The second is the A records in the ANSWER section. The third is the TTL, which shows how many seconds the record can stay in the cache.
If local results differ from authoritative DNS, and public DNS returns the correct results, suspect a polluted local cache or an intermediate DNS server first. Do not reach a conclusion yet, though. The following situations also produce different results, so rule them out one by one:
- An entry in the hosts file overrides DNS results.
- A system proxy or VPN client intercepts DNS requests.
- A corporate network or home router uses split-horizon DNS, which returns different IP addresses for internal and external queries.
- A CDN returns different IP addresses based on the requester’s region. This is normal behavior. When judging the result, check whether the status is abnormal and whether the returned IP address actually connects. Do not just check whether the IP addresses match.
3. Clear the DNS Cache
If you suspect a cache problem, clear the cache and query again. If dig returns correct results after the flush, the problem was in the cache.
On Windows, run the following as administrator or as a regular user:
ipconfig /flushdns
On macOS, run:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
The second command restarts the mDNSResponder service. The exact commands can differ between macOS versions. If a command returns an error, check the official documentation for your version of the system.
On Linux, the command depends on whether you use systemd-resolved. If you do, run:
sudo resolvectl flush-caches
Clearing the cache only deletes locally stored resolution records. It does not change system settings, so the risk is low and the step is safe to run.
4. Check the Hosts File and Proxy Settings
The hosts file takes precedence over DNS servers. Malware often uses it to point popular domains to fake IP addresses. Check the following paths:
- Windows:
C:\Windows\System32\drivers\etc\hosts - macOS and Linux:
/etc/hosts
Always back up the file before editing it. On macOS or Linux, run:
sudo cp /etc/hosts /etc/hosts.bak
On Windows, open Notepad as administrator, then copy the original file to a backup file.
Entries such as 127.0.0.1 localhost and ::1 localhost are normal. Focus on entries that point well-known domains to other IP addresses. If you find an entry you cannot explain, delete the line, save the file, and then clear the DNS cache. Before deleting an entry, confirm that you or your team did not add it manually for a development environment. Removing such an entry could break internal services.
System proxies and leftover VPN connections can also redirect traffic:
- Windows: Open Settings, go to Network & Internet, then open Proxy. Check whether a manual proxy or a proxy script is enabled.
- macOS: Open System Settings, go to Network, select your current network service, then view its Proxies settings.
- Check the taskbar or menu bar for VPN clients that are still running. If you find any, quit them completely and try again.
5. Rule Out Browser Interference
If a site fails in one browser but works in others, the browser itself is usually the cause. Follow these steps:
- Open a private window. In Chrome and Edge, press Ctrl+Shift+N on Windows or Cmd+Shift+N on macOS. Private mode does not load extensions by default, so it helps you quickly check whether an extension is causing the problem.
- If the site works in private mode, disable extensions one at a time to find the one that conflicts.
- Clear the cache and cookies for that site, then try turning off hardware acceleration.
- Resetting network settings is a heavy step. It removes saved network configurations, so use it only if all the previous steps have failed.
Browser developer tools show where a request gets stuck. Press F12 to open them, switch to the Network panel, and check Disable cache. Reload the page, click the target request, and review the Timing information:
- A long DNS Lookup time points to a DNS problem.
- A long Initial connection or TCP Handshake time points to a network connection or firewall problem.
- An error during the SSL phase points to a certificate problem.
- A long Waiting (TTFB) time usually means the server itself is responding slowly.
This information narrows the search to one layer, which is faster than trying random fixes.
6. Handle Certificate Errors
If the request reaches the server but the browser shows a certificate error, check the system time first. An incorrect system clock can make a valid certificate look invalid. Once the time is correct, click the lock icon in the address bar to view the certificate details, then confirm that the issuing authority is trusted.
If the certificate was issued by an unfamiliar root certificate authority, the traffic may be under a man-in-the-middle attack. A corporate proxy inspecting traffic may also be the cause. Do not install root certificates from unknown sources. Ask your network administrator first to confirm that the certificate is part of a legitimate corporate policy.
7. Run Security Scans Last
Security scans are useful, but run them only after you have ruled out network-layer problems. Once DNS and the network are working correctly, run the built-in security tools of your operating system or a trusted antivirus program for a full system check. Pay attention to the following:
- Recently installed software you don’t recognize.
- Unusual startup items and scheduled tasks.
- Changes to the hosts file.
- Unexpected listening ports. On Windows, run
netstat -ano. On Linux, runsudo ss -tlnp. Check which processes are listening on ports 80 or 443, and confirm that they are trusted.
Real malware rarely blocks just one website. It more often causes widespread traffic hijacking or background cryptomining that slows the computer down. So when only a single website is affected, check its configuration and the network layer first, rather than assuming malware.
8. Special Cases in Enterprise and Cloud Environments
In enterprise environments, the internal DNS server may handle external domains in a special way. A firewall may also block certain domains or use a transparent proxy. As a result, internal and public queries can return different results. If you see this, contact your network administrator to confirm whether a domain allowlist or a transparent proxy policy is in place.
If a cloud virtual machine has similar problems, check the operating system and also check the following:
- Whether security groups and network ACLs allow the outbound ports you need.
- Whether the route table points to the correct gateway.
- Whether the DNS server settings in the VPC point to a working resolver, such as the built-in resolver from your cloud provider or a custom DNS service.
9. Keep a Consistent Diagnostic Record
Running the same commands every time reduces the chance of missing a step, and it makes collaboration easier. The template below can be saved as a text file:
dig <domain>dig @1.1.1.1 <domain>nslookup <domain>curl -v https://<domain>ipconfig /flushdns # Windowssudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder # macOS
When you ask someone else for help, include the output of the multi-resolver comparison along with the result of curl -v. Others can usually identify the problem quickly from that information.
10. Prevent Problems in Daily Use
Prevention saves more time than troubleshooting after the fact. These habits are worth keeping:
- Choose a reliable public resolver. If you need DNSSEC validation, pick a resolver that supports it, and confirm that your router and system have not turned validation off. Manually changing the DNS server address does not automatically enable DNSSEC.
- Check the hosts file and startup items regularly, and back up the file before making changes.
- Use separate browser profiles for work and personal browsing to keep extensions and cookies from interfering with each other.
- Record the correct IP addresses of key websites so you can compare them quickly when something goes wrong.
Troubleshooting Order at a Glance
When a web page won’t open, follow this order: confirm the symptom, compare results across multiple DNS resolvers, clear the cache, check the hosts file and proxy settings, rule out browser interference, and run a security scan last. Following this order usually locates the problem within a short time. It also avoids reinstalling the operating system or deleting files without a clear reason.
