If Windows says connected but there is no internet, start with ipconfig /flushdns; if that fails, run ipconfig /release, ipconfig /renew, then netsh winsock reset and netsh int ip reset, and stop when you have a valid IP but no web access. Bad fixes waste time and can leave you chasing Windows settings while the real fault is the router or ISP. This guide gives a symptom-based Command Prompt flow, the exact command to try first, what result to expect, and when to stop.
What a broken internet connection in Command Prompt usually means
When Command Prompt points to an internet problem, the fault is usually in the Windows network stack, the router, the DNS resolver cache, or the ISP path. Match the symptom to the failing layer first, then run the one command that tests that layer.
Connected but no internet
This often means Windows has a link to the router but cannot reach a usable address on the wider network. A stale DHCP lease, a bad gateway, or a Winsock problem can sit between the PC and the web.
Can reach the router but not websites
If the router answers but websites do not, DNS is a likely suspect. The DNS resolver cache stores website names and IP addresses, so a bad entry can break browsing even when the local connection is still alive.
Sites fail to resolve or load intermittently
Intermittent failures often point to flaky DNS, packet loss, or a router that is passing some traffic and dropping the rest. Picture a laptop that loads one page, then stalls on the next. That pattern usually calls for a DNS check before a deeper Windows reset.
When the issue is outside Windows
If Command Prompt shows a valid IP, the gateway responds, and DNS lookup still fails for every device on the network, the fault is likely beyond Windows. Check the router, modem, or ISP before burning time on more commands.
Which Command Prompt fix should you try first?
Start with the command that matches the symptom instead of jumping straight to a more aggressive reset. If browsing fails but the connection icon stays up, flush DNS first. If you have no lease or see a bad address, renew DHCP. If Windows network behavior looks corrupted, reset Winsock next.
Likely causes, ranked from most common to least common
- Stale or invalid DHCP lease.
- Corrupted DNS resolver cache.
- Winsock or socket stack corruption.
- Router, modem, or ISP outage.
- Windows TCP settings that need review.
Say your PC shows a local network icon, but every browser tab times out. That usually points to DNS or the router, not a dead Wi-Fi card. If the IP address starts with 169.254.x.x, it often suggests DHCP did not hand out a usable lease.
How to tell DHCP, DNS, Winsock, and router problems apart
Run a gateway ping, a DNS lookup, and ipconfig /all in that order. If the gateway answers but names do not resolve, DNS is the next target. If you never get a normal IPv4 address, the DHCP side is failing. If everything local looks normal but traffic still dies, suspect the router or ISP.
Do I need to run Command Prompt as administrator for network fixes?
Yes. Open Windows Command Prompt by typing cmd in Windows search, then choose the administrator option before running network repair commands. That matters most for lease changes, Winsock resets, and broader stack fixes, because standard rights can block parts of the repair.
Open an elevated Command Prompt
- Press the Windows key and type
cmd. - Choose Run as administrator.
- If User Account Control appears, select Yes.
- Keep this window open for the next commands.
Why it matters: ipconfig /release, ipconfig /renew, and netsh winsock reset are more reliable from an elevated window. If a command returns access denied, rerun Command Prompt with admin rights before changing anything else.
Is your IP address the problem?
If Windows shows no valid IPv4 address, a wrong subnet, or a lease that looks stale, the DHCP path is often the first thing to reset. Start with ipconfig /release, then ipconfig /renew. That sequence clears the current lease and asks DHCP for a fresh one.
Run ipconfig /release
- In elevated Command Prompt, type
ipconfig /releaseand press Enter. - Watch for the adapter to lose its current address.
- Wait for the command to finish before moving on.
A successful release shows the adapter giving up its current IPv4 address. This is the first IP reset command and is the right move before renewal. If the adapter still shows an address after release, note the result and continue anyway.
Run ipconfig /renew
- Type
ipconfig /renewand press Enter. - Wait for DHCP to assign a new address.
- Run
ipconfig /alland check the IPv4 address, subnet mask, default gateway, and DHCP lease data.
A good renewal returns a usable IPv4 address and a default gateway from DHCP. If renewal fails, the DHCP server may be down, the router may be out of service, or the cable or Wi-Fi link may be broken before Windows can ask for a lease.
What failure means the DHCP server may be the issue
If ipconfig /renew times out, returns an APIPA-style address, or never populates a gateway, the problem may be the router’s DHCP service rather than Windows. Test the router from another device or power-cycle the router and modem before repeating the command.
Could DNS be the reason websites will not load?
Yes. DNS is the layer that turns names into IP addresses, and the DNS resolver cache can hold stale or broken entries. If local network access works but sites fail by name, run ipconfig /flushdns and then test name resolution again.
Run ipconfig /flushdns
- In elevated Command Prompt, type
ipconfig /flushdnsand press Enter. - Look for confirmation that the DNS resolver cache was cleared.
- Test the browser again or run a DNS lookup for a known host.
Successful output confirms the flush completed. That matters because the DNS resolver cache keeps website names and IP addresses; if it contains a bad record, browsing breaks while raw local connectivity still looks fine.
Test name resolution after flushing
- Run
nslookup www.google.com. - Confirm that a DNS server returns an IP address.
- Run
ping google.comorping www.google.comand compare the reply to the browser result.
If name resolution fails across several sites after a flush, the DNS server may be the real fault. Try a different DNS server in the adapter’s Internet Protocol Version 4 properties, such as 1.1.1.1 or 8.8.8.8, and then retest.
Does Winsock or TCP need a reset?
If DNS and DHCP look normal but apps still cannot open websites, the Windows socket stack may be damaged. Run netsh winsock reset, then restart. If the problem still points to the transport layer, review netsh int tcp settings, but keep compatibility limits in mind.
Run netsh winsock reset
- Type
netsh winsock resetand press Enter. - Wait for the reset message to complete.
- Restart the PC before retesting the connection.
Winsock changes usually need a restart. Use this when you suspect socket corruption or LSP issues, especially after security software changes or a broken network stack. If the restart is skipped, the reset may not fully take effect.
When to inspect netsh int tcp settings
netsh int tcp belongs to the TCP tuning family and can change global TCP parameters. One example sets TCP auto-tuning to normal, and another applies to Windows 7 congestion provider settings. Compatibility varies by Windows version, so do not treat these switches as universal fixes.
What if a TCP tweak causes trouble?
If a netsh change makes the connection worse, replace enabled with disabled when reversing the setting. That is safer than stacking more tweaks on top of a broken one, especially on newer Windows builds where older tuning advice may not fit.
Proof table: top internet symptoms and the first command to run
This table maps the most common failure patterns to the first command to try, what a good result looks like, and the next check if the command does not help. It keeps you from running a full reset when the fault is clearly on the router, DHCP server, or DNS path.
| Symptom | Exact command to run | Expected console output | Next check if it fails |
|---|---|---|---|
| Connected but no internet | ipconfig /flushdns |
Confirmation that the DNS resolver cache was cleared | Run ipconfig /all and ping the gateway |
| Wi-Fi or Ethernet link shows, but the IP looks wrong | ipconfig /release then ipconfig /renew |
New IPv4 address and default gateway from DHCP | Check the router’s DHCP service or reboot the router |
| Websites fail by name | ipconfig /flushdns |
DNS resolver cache cleared message | Run nslookup www.google.com |
| Browser loops on captive portal | ipconfig /release then ipconfig /renew |
Fresh lease and gateway | Open the portal again or check router login settings |
| Apps fail while the adapter stays connected | netsh winsock reset |
Reset completed, then a restart prompt or implied restart need | Restart and retest on another browser |
| Intermittent loss on several devices | No Windows command first | N/A | Check modem lights, router logs, and ISP status |
What should I do after running network reset commands in cmd?
After any reset, verify the result instead of guessing. Check ipconfig /all, ping the default gateway, and test DNS resolution with a known host. If the PC gets a valid lease but still cannot reach the web, the fault is likely outside Windows.
Run the checks in this order
- Run
ipconfig /alland confirm the IPv4 address and default gateway. - Run
ping 192.168.1.1or your router’s real gateway address. - Run
ping google.comornslookup www.google.com. - Check router lights, captive portal prompts, and ISP outage notices.
If the gateway ping works but public names fail, the browser problem is likely DNS. If even the gateway fails, stop looking at Windows and check the router, modem, cable, or Wi-Fi link first.
If that did not work, try this next
Move from least invasive to most invasive. Restart the router and modem, then repeat the lease and DNS checks. If the adapter still fails, use the Windows Network reset feature, then reinstall or roll back the network driver in Device Manager. A full Reset This PC is the last step, not the first.
Prevention: Keep router firmware current and avoid changing DNS or TCP settings unless you can reverse them cleanly. If a manual DNS server or netsh tweak causes new errors, restore the prior value before adding more changes.
Frequently asked questions
How to fix internet connection using cmd
Start with ipconfig /flushdns if sites fail by name, then run ipconfig /release and ipconfig /renew if the IP looks stale or missing. If the connection still breaks after that, run netsh winsock reset, restart, and test the gateway before changing anything else.
How to fix internet connection using command prompt
Open Command Prompt as administrator, run ipconfig /all, and check whether the PC has a valid IPv4 address, gateway, and DNS server. Then use the symptom that matches the failure: flush DNS for name errors, renew DHCP for bad leases, or reset Winsock for stack corruption.
How to fix internet connection problems with command prompt
Use a branching order instead of a flat list. Test the gateway with ping 192.168.1.1 or the correct router IP, test DNS with nslookup www.google.com, then apply ipconfig /renew or netsh winsock reset based on the result.
How do I fix network connection problems
Check whether the PC can reach the router first, then check whether DNS can resolve a public name. If both work but web pages still fail, restart the router and modem, and only then look at Windows TCP settings or a driver issue in Device Manager.
Which Command Prompt commands should I run first to fix internet issues?
Run ipconfig /flushdns first for browsing failures, then ipconfig /release and ipconfig /renew for lease problems. If that does not fix the issue, use netsh winsock reset and restart. For most Windows users, that sequence is the cleanest order.
Do I need to run Command Prompt as administrator for network fixes?
Yes. Open cmd from Windows search and choose Run as administrator. That avoids permission failures when you run ipconfig /release, ipconfig /renew, or netsh winsock reset, and it reduces the chance of a partial repair.
What if ipconfig /renew does not restore my internet connection?
If renewal fails, check whether the router is handing out leases at all. Run ipconfig /all, then ping the gateway. If the lease is missing or the gateway never answers, the DHCP server, router, or upstream connection may be the fault, not Windows.
How do I reset DNS and Winsock from Command Prompt?
Use ipconfig /flushdns to clear the DNS resolver cache, then run netsh winsock reset and restart the PC. After the restart, test a known site with ping google.com or nslookup www.google.com to confirm resolution is working again.
Can these commands fix Wi-Fi, Ethernet, and DNS problems?
Yes, if the fault sits in Windows, DHCP, DNS, or Winsock. They will not fix a dead modem, a router outage, or an ISP problem. If the router gateway does not respond or every device is offline, stop at the router and ISP layer first.
What should I do after running network reset commands in cmd?
Recheck the IP lease, ping the default gateway, and test DNS resolution. If those three checks pass but websites still fail, move to router or ISP checks. If they fail, repeat the most relevant command once, then escalate to hardware or provider support.