Sub topic 12
Command-line tools for diagnosis
This chapter assumes you can open a terminal on Windows and Linux and that your lab has one guest of each. It also assumes you know what an IP address, a default gateway, and DNS are. Command-line tools matter for the exam because they give you evidence. A guess about a fault is weak. A command's output shows where the fault is.
Test the network from the inside out
Work in a fixed order. Each step tests one layer and rules it out before you move to the next.
On Windows, the sequence looks like this:
ipconfig /all
ping 127.0.0.1
ping <default-gateway-address>
nslookup example.com
tracert example.comipconfig /allshows the IP address, gateway, and DNS servers. An address starting with 169.254 means the machine got no answer from DHCP.ping 127.0.0.1tests the local TCP/IP stack. It does not touch the network.- Pinging the gateway tests the local link.
nslookuptests name resolution. If pinging an IP address works butnslookupfails, the fault is DNS.tracertlists each router on the way and shows where packets stop.
On a Linux guest, the equivalent commands are:
ip addr show
ip route show
ping -c 4 <default-gateway-address>
resolvectl statusip addr show lists interface addresses. ip route show lists the default route, and a missing default route explains why nothing outside the subnet works. -c 4 stops ping after four packets. resolvectl status shows the DNS servers that systemd-resolved is using.
Check the operating system
When a Windows machine has crashes or missing-file errors, run these from an elevated prompt in a lab VM:
sfc /scannow
DISM /Online /Cleanup-Image /RestoreHealth
chkdsk C: /scansfc /scannowchecks protected system files and replaces damaged ones.DISM ... /RestoreHealthrepairs the component store thatsfccopies from. Run it whensfcreports files it cannot fix.chkdsk C: /scanscans the file system for errors without taking the volume offline.
Practice with a fault
Break something on purpose and diagnose it using only these commands. For example, set a wrong DNS server on the Windows guest. Then run the sequence above and write down which step first fails. Keep a short note of the command, the output, and your conclusion. These notes feed the troubleshooting method in the next chapters.
Exercise
A Windows lab VM can ping 8.8.8.8 but cannot open example.com in a browser. Which command from this chapter confirms the cause, and what does it point to?
Show answer
Run nslookup example.com. If it fails or times out while pinging an IP address works, the network path is fine and the fault is DNS. Check the DNS servers shown by ipconfig /all.