SkillPilotAI

Lab: the internet is not working

"No internet" is one message on the screen, but the cause can be any piece of the chain: cable, IP address, gateway, outside path, DNS or a firewall. A fixed bottom-up checklist finds the broken piece quickly: the first step that fails is your problem.

274.1 Why is it used?

  • Story: Ravi's laptop suddenly shows No internet.
  • Opening site.example needs DNS (name -> IP), then laptop -> home router -> ISP -> internet server.
  • If any one piece breaks, the screen shows the same message, so you need a checklist, not a guess.
Ravi's chain to the internet
  1. 1.Ravi's laptop 192.168.74.10 (link: cable / Wi-Fi)

  2. 2.IP address from DHCP + default gateway

  3. 3.Home router 192.168.74.1

  4. 4.ISP 198.51.100.1 -> internet server 198.51.100.10

  5. 5.DNS server 198.51.100.53 turns site.example into an IP

  6. 6.Router firewall must allow the web traffic (port 80)

274.2 How it works: the 6-step checklist

  • Step 1 Link: cable unplugged = the packet never leaves the laptop.
  • Step 2 IP: an address starting with 169.254 means the DHCP server did not answer.
  • Step 3 Gateway: ping the router 192.168.74.1; a reply means the local network is fine.
  • Step 4 Outside IP: ping 198.51.100.10; a reply means the internet path is fine.
  • Step 5 DNS: IP ping works but the name fails = DNS problem.
  • Step 6 Firewall: ping and DNS work but a router rule drops the web traffic.
StepWindowsLinuxResult tells you
1 LinkGet-NetAdapterip linkDisconnected / DOWN: cable or Wi-Fi
2 IPipconfig /allip addr169.254.x.x: no answer from DHCP
3 Gatewayipconfig, ping gwip route, ping gwTimeout: the problem is local
4 Outsideping 198.51.100.10ping 198.51.100.10Reply: internet path OK
5 DNSnslookupdig site.exampleIP OK, name fails: DNS problem
6 FirewallTest-NetConnection -Port 80nc -zv 198.51.100.10 80Ping, DNS OK, port fails: firewall
Checklist decision path
  1. 1.Link DOWN? -> fix cable / Wi-Fi

  2. 2.169.254 address? -> DHCP problem

  3. 3.Gateway ping fails? -> local problem (route, gateway)

  4. 4.Outside IP ping fails? -> path beyond the router

  5. 5.Name fails but IP works? -> DNS

  6. 6.Port fails but ping + DNS work? -> firewall

Stop at the first failing step: that is your problem

274.3 Practical 1: Windows

PowerShell
ping -n 2 127.0.0.1nslookup example.com 8.8.8.8
Output
$ ping -n 2 127.0.0.1Reply from 127.0.0.1: bytes=32 time<1ms TTL=128Reply from 127.0.0.1: bytes=32 time<1ms TTL=128    Packets: Sent = 2, Received = 2, Lost = 0 (0% loss),$ nslookup example.com 8.8.8.8Non-authoritative answer:Server:  dns.googleAddress:  8.8.8.8Name:    example.comAddresses:  2606:4700:9765:72db:f2a8:0:ef6b:ff98          104.20.23.154          172.66.147.243
  • Loopback OK = local TCP/IP stack fine; nslookup to 8.8.8.8 answers = DNS and internet path work.
  • ipconfig /all: per Microsoft docs, Autoconfiguration Enabled Yes + Autoconfiguration IP Address 169.254.x.y means APIPA (no DHCP).
PowerShell
Test-NetConnection -ComputerName `  "www.contoso.com" -InformationLevel `  "Detailed"Test-NetConnection -Port 80 `  -InformationLevel "Detailed"
Output
ComputerName           : www.contoso.comRemoteAddress          : 65.55.39.10NameResolutionResults  : 65.55.39.10                         64.4.6.100PingSucceeded          : TruePingReplyDetails (RTT) : 164 msComputerName            : internetbeacon.msedge.netRemotePort              : 80TcpTestSucceeded        : True
  • Example output from the Microsoft docs: PingSucceeded checks L3, TcpTestSucceeded checks whether a connection to the port was made.

274.4 Practical 2: Docker lab baseline

Terminal
ip link show eth0ip -4 addr show eth0ip routeping -c 2 -W 1 192.168.74.1ping -c 2 -W 1 198.51.100.10nslookup site.examplecurl -sS -m 3 http://site.example/
Output
$ ip link show eth02: eth0@if3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP$ ip -4 addr show eth0    inet 192.168.74.10/24 scope global eth0$ ip routedefault via 192.168.74.1 dev eth0192.168.74.0/24 dev eth0 proto kernel scope link src 192.168.74.10$ ping -c 2 -W 1 192.168.74.164 bytes from 192.168.74.1: icmp_seq=1 ttl=64 time=0.081 ms2 packets transmitted, 2 received, 0% packet loss, time 1013ms$ ping -c 2 -W 1 198.51.100.1064 bytes from 198.51.100.10: icmp_seq=1 ttl=63 time=0.380 ms2 packets transmitted, 2 received, 0% packet loss, time 1009ms$ nslookup site.exampleServer:		198.51.100.53Address:	198.51.100.53#53Name:	site.exampleAddress: 198.51.100.10$ curl -sS -m 3 http://site.example/Hello from the internet (lab)

274.5 Fault 1 (step 1): cable unplugged

Terminal
# fault 1: cable pulled (router side down)curl -sS -m 3 http://site.example/ip link show eth0ping -c 2 -W 1 192.168.74.1# fix: cable back inip link show eth0ping -c 2 -W 1 192.168.74.1
Output
$ curl -sS -m 3 http://site.example/curl: (28) Resolving timed out after 3000 milliseconds$ ip link show eth02: eth0@if3: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN$ ping -c 2 -W 1 192.168.74.1--- 192.168.74.1 ping statistics ---2 packets transmitted, 0 received, 100% packet loss, time 1029ms$ ip link show eth02: eth0@if3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP$ ping -c 2 -W 1 192.168.74.164 bytes from 192.168.74.1: icmp_seq=1 ttl=64 time=0.113 ms64 bytes from 192.168.74.1: icmp_seq=2 ttl=64 time=0.055 ms2 packets transmitted, 2 received, 0% packet loss, time 1014ms
  • curl says Resolving timed out, which is misleading; NO-CARRIER + state DOWN shows there is no signal on the link at all.

274.6 Fault 2 (step 2): 169.254 address

Terminal
# lab: ip addr add 169.254.10.20/16 dev eth0ip -4 addr show eth0ip routeping -c 2 -W 1 192.168.74.1# fix: correct address + default routeip addr del 169.254.10.20/16 dev eth0ip addr add 192.168.74.10/24 dev eth0ip route add default via 192.168.74.1ping -c 2 -W 1 192.168.74.1
Output
$ ip -4 addr show eth02: eth0@if3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP    inet 169.254.10.20/16 scope global eth0$ ip route169.254.0.0/16 dev eth0 proto kernel scope link src 169.254.10.20$ ping -c 2 -W 1 192.168.74.1ping: connect: Network unreachable$ ip addr del 169.254.10.20/16 dev eth0$ ip addr add 192.168.74.10/24 dev eth0$ ip route add default via 192.168.74.1$ ping -c 2 -W 1 192.168.74.164 bytes from 192.168.74.1: icmp_seq=1 ttl=64 time=0.074 ms2 packets transmitted, 2 received, 0% packet loss, time 1029ms
  • 169.254.x.x/16 is the APIPA-style address Windows takes by itself when DHCP does not answer (added by hand in the lab).
  • No default route either, so even the gateway ping says Network unreachable.

274.7 Fault 3 (steps 3-4): wrong gateway

Terminal
# fault 3: wrong default gatewayip routeping -c 2 -W 1 192.168.74.1ping -c 2 -W 1 198.51.100.10ip neigh# fixip route replace default via 192.168.74.1ping -c 2 -W 1 198.51.100.10
Output
$ ping -c 2 -W 1 192.168.74.164 bytes from 192.168.74.1: icmp_seq=1 ttl=64 time=0.049 ms64 bytes from 192.168.74.1: icmp_seq=2 ttl=64 time=0.054 ms2 packets transmitted, 2 received, 0% packet loss, time 1000ms$ ping -c 2 -W 1 198.51.100.10--- 198.51.100.10 ping statistics ---2 packets transmitted, 0 received, 100% packet loss, time 1028ms$ ip routedefault via 192.168.74.254 dev eth0192.168.74.0/24 dev eth0 proto kernel scope link src 192.168.74.10$ ip neigh192.168.74.254 dev eth0 FAILED192.168.74.1 dev eth0 lladdr 0a:d9:f1:15:34:ea REACHABLE$ ip route replace default via 192.168.74.1$ ping -c 2 -W 1 198.51.100.1064 bytes from 198.51.100.10: icmp_seq=1 ttl=63 time=0.096 ms64 bytes from 198.51.100.10: icmp_seq=2 ttl=63 time=0.083 ms2 packets transmitted, 2 received, 0% packet loss, time 1002ms
  • Tricky: the router itself pings fine, but the default route points to 192.168.74.254.
  • ip neigh FAILED for .254 = no device lives on that IP.

274.8 Fault 4 (step 5): wrong DNS server

Terminal
# fault 4: wrong DNS serverping -c 2 -W 1 198.51.100.10ping -c 1 -W 1 site.examplenslookup -timeout=2 site.examplecat /etc/resolv.confdig @198.51.100.53 site.example +short \  +time=1 +tries=1# fix: nameserver 198.51.100.53dig site.example +short +time=1 +tries=1curl -sS -m 3 http://site.example/
Output
$ ping -c 2 -W 1 198.51.100.1064 bytes from 198.51.100.10: icmp_seq=1 ttl=63 time=0.080 ms2 packets transmitted, 2 received, 0% packet loss, time 1020ms$ ping -c 1 -W 1 site.exampleping: site.example: Try again$ nslookup -timeout=2 site.example;; communications error to 198.51.100.99#53: timed out;; communications error to 198.51.100.99#53: timed out;; no servers could be reached$ cat /etc/resolv.confnameserver 198.51.100.99$ dig @198.51.100.53 site.example +short +time=1 +tries=1198.51.100.10$ cat /etc/resolv.confnameserver 198.51.100.53$ dig site.example +short +time=1 +tries=1198.51.100.10$ curl -sS -m 3 http://site.example/Hello from the internet (lab)
  • Ping by IP works, ping by name says Try again: classic DNS fault.
  • resolv.conf points to 198.51.100.99; dig @ the correct server 198.51.100.53 answers at once.

274.9 Fault 5 (step 6): firewall rule

Terminal
# fault 5: a firewall rule on the routercurl -sS -m 3 http://site.example/ping -c 2 -W 1 198.51.100.10dig site.example +short +time=1 +tries=1nc -zv -w 2 198.51.100.10 80nft list chain ip n274fw forward  # router# fix (router): delete the rulenft delete rule ip n274fw forward handle 2nc -zv -w 2 198.51.100.10 80curl -sS -m 3 http://site.example/
Output
$ curl -sS -m 3 http://site.example/curl: (28) Connection timed out after 3002 milliseconds$ ping -c 2 -W 1 198.51.100.1064 bytes from 198.51.100.10: icmp_seq=1 ttl=63 time=0.087 ms2 packets transmitted, 2 received, 0% packet loss, time 1020ms$ dig site.example +short +time=1 +tries=1198.51.100.10$ nc -zv -w 2 198.51.100.10 80nc: connect to 198.51.100.10 port 80 (tcp) timed out: Operation in progress[router]$ nft list chain ip n274fw forwardtable ip n274fw {	chain forward {		type filter hook forward priority filter; policy accept;		ip daddr 198.51.100.10 tcp dport 80 counter packets 5 bytes 300 drop	}}[router]$ nft delete rule ip n274fw forward handle 2$ nc -zv -w 2 198.51.100.10 80Connection to 198.51.100.10 80 port [tcp/http] succeeded!$ curl -sS -m 3 http://site.example/Hello from the internet (lab)
  • Ping and DNS fine, port 80 times out: a router rule drops port 80, and its counter (5 packets) proves it.
FaultFailing stepKey clue
Cable unplugged1 LinkNO-CARRIER, state DOWN
169.254 address2 IP169.254.10.20/16, no default route
Wrong gateway3-4 Gateway / outsidedefault via .254, ip neigh FAILED
Wrong DNS server5 DNSTry again, no servers could be reached
Firewall rule6 Firewallnc timed out, nft drop counter

274.10 Common mistakes

  • Myth: ping to 8.8.8.8 works, so the internet is fine. Ping only tests L3; DNS can still fail or a firewall can block a port (faults 4 and 5).
  • Gateway and IP pings work but the browser says server not found: check step 5, DNS (nslookup / dig).
  • Trusting curl's first error message: Resolving timed out was really a pulled cable.
  • Pinging only the router and assuming the gateway setting is right.

274.11 Interview tips

  • Answer bottom-up: link (cable, Wi-Fi, adapter), then IP address (169.254 = DHCP failure).
  • Ping the gateway, then one outside IP: tells you local vs further out.
  • Then DNS with nslookup and the port with Test-NetConnection -Port, because a firewall can block only some ports.
  • Say the rule: the first step that fails is the problem.