Network Troubleshooting · Topic 5 of 6
Command Line and Software Tools
Use ping, traceroute, ipconfig, ifconfig, ip, nslookup, dig, arp, netstat, nmap and tcpdump, plus protocol analyzers and speed tests, to solve problems.
- 6 min
- ipconfig is for Windows. ifconfig and ip are for Linux and macOS. ip is the newer Linux command.
- ipconfig /release and /renew refresh a DHCP lease. /flushdns clears the DNS cache.
- ping tests reachability using ICMP. traceroute and tracert show the path hop by hop.
What it is
A few command line tools answer most basic network questions. They show your address configuration, test reachability, trace the path, look up names, list connections and capture traffic.
The exam gives a problem and asks which tool or command fits, and sometimes asks what a command output means. Know the tool, the operating system and the question it answers.
How it works
Checking addresses and tables
| Tool | Platform | Use |
|---|---|---|
| ipconfig | Windows | Shows Internet Protocol (IP) address, mask, gateway and Domain Name System (DNS) settings, and can release and renew a Dynamic Host Configuration Protocol (DHCP) lease |
| ifconfig | Older Linux and macOS | Shows interface settings |
| ip | Linux | Newer command to show and change addresses and routes |
| arp | Windows, Linux, macOS | Shows or edits the IP to Media Access Control (MAC) mappings in the Address Resolution Protocol (ARP) table |
| route | Windows, Linux | Shows or edits the routing table |
| hostname | All | Shows the name of the local host |
Windows Command Prompt:
ipconfig /all show full configuration
ipconfig /release give up the DHCP address
ipconfig /renew request a new DHCP address
ipconfig /flushdns clear the local DNS cache
arp -a show the ARP table
route print show the routing table
Linux shell:
ip addr show addresses
ip route show routes
Testing reachability and the path
ping sends Internet Control Message Protocol (ICMP) echo requests and reports replies, the round trip time and packet loss. A reply proves basic connectivity at layer 3, but a missing reply does not always mean the host is down, because ICMP may be blocked.
traceroute (tracert on Windows) lists each router along the path by sending packets with increasing Time to Live values. It shows where a path stops or slows.
Windows: ping -t 192.0.2.10 continuous ping until stopped
Linux: ping -c 4 192.0.2.10 four requests then stop
Windows: tracert example.com
Linux: traceroute example.com
A continuous ping while you change a cable or setting shows the moment connectivity returns. The address 127.0.0.1 tests the local network stack.
Checking names
| Tool | Use |
|---|---|
| nslookup | Queries a DNS server for a name or address, on Windows and Linux |
| dig | More detailed DNS queries on Linux and macOS, with record types |
nslookup example.com
dig example.com A
dig -x 192.0.2.10
The dig option -x does a reverse lookup. Query a specific server to find out whether the fault is in your local resolver or in the record.
Connections and ports
netstat lists active connections, listening ports and statistics for the Transmission Control Protocol (TCP) and User Datagram Protocol (UDP). The common options are shown here.
Windows: netstat -an all connections and listening ports, numeric
Windows: netstat -ano also shows the process ID
Linux: ss -tuln listening TCP and UDP ports (modern replacement)
nmap is a port scanner that finds hosts and open ports on a network. For example, nmap -p 1-1024 192.0.2.10 scans the first 1024 ports on one host. Only scan networks you are authorized to test.
Capturing packets
A protocol analyzer or packet capture tool records traffic and decodes it. Wireshark has a graphical interface, and tcpdump runs on the command line.
tcpdump -i eth0 port 53 capture DNS traffic on interface eth0
Packet captures show exactly what is sent, such as a failing handshake or a wrong DNS answer. Use filters to capture only what is needed.
Other software tools
| Tool | Use |
|---|---|
| Speed test | Measures throughput and latency to a test server |
| Wi-Fi analyzer | Shows nearby networks, channels and signal strength |
| Device show commands | Display interface status, counters, configuration and routes on switches and routers |
| iperf | Measures the throughput between two hosts, one acting as server and one as client |
| IP scanner | Finds the devices that answer on a subnet |
| NetFlow analyzer | Reads flow data to show the top talkers |
| Terminal emulator | Gives a console or Secure Shell (SSH) session to a device |
| Trivial File Transfer Protocol (TFTP) server | Holds device configurations and firmware images for transfer |
Device show commands
These commands run on a switch or router (Cisco style syntax shown).
| Command | Shows | Use |
|---|---|---|
| show mac address-table | MAC address to port mappings (older software uses show mac-address-table) | Find which port a device is on, and spot a MAC address that keeps moving between ports or is missing |
| show arp (or show ip arp) | IP to MAC entries and their age | Confirm a neighbor was resolved. Incomplete means no ARP reply came back |
| show vlan brief | VLAN IDs, names and member ports | Check that a port is in the right VLAN |
| show power inline | Per port Power over Ethernet (PoE) draw, plus total budget and remaining watts | Find out why a powered device will not start |
Switch# show mac address-table
Vlan Mac Address Type Ports
10 0050.7966.6801 DYNAMIC Gi1/0/5
Router# show ip arp
Protocol Address Age (min) Hardware Addr Type Interface
Internet 192.168.1.10 5 0050.7966.6801 ARPA Vlan10
Internet 192.168.1.20 0 Incomplete ARPA
Switch# show vlan brief
VLAN Name Status Ports
10 Sales active Gi1/0/5
Switch# show power inline
Available:370.0(w) Used:15.4(w) Remaining:354.6(w)
Interface Admin Oper Power(W)
Gi1/0/5 auto on 15.4
If a MAC address shows up on a different port every few seconds, suspect a loop or a duplicate address. If the remaining PoE watts reach zero, new powered devices will not start.
What to remember for the exam
- ipconfig is for Windows. ifconfig and ip are for Linux and macOS. ip is the newer Linux command.
- ipconfig /release and /renew refresh a DHCP lease. /flushdns clears the DNS cache.
- ping tests reachability using ICMP. traceroute and tracert show the path hop by hop.
- nslookup and dig test DNS. dig gives more detail.
- arp -a shows the IP to MAC table.
- netstat shows connections and listening ports. ss is the newer Linux tool.
- nmap discovers hosts and open ports. Wireshark and tcpdump capture packets.
- Ping 127.0.0.1 to test the local network stack.
- Use authorized scans only.
To check whether a problem is DNS, ping the target by IP address first. If that works but the name fails, use nslookup or dig.
Common mistakes
Treating a failed ping as proof the host is down. Firewalls often block ICMP.
Using the wrong command for the platform. ipconfig is Windows. On Linux, use ip or ifconfig.
Forgetting to flush the DNS cache. A stale entry gives old answers after a record change.
Confusing traceroute with ping. Ping tests one destination, and traceroute shows each hop.
Running nmap on networks you do not manage. Unauthorized scanning may be against policy or law.
Packet captures can contain passwords and personal data. Handle capture files as sensitive and capture only what is needed.
Check yourself
Answer these three.
Which Windows command shows the full IP configuration including DNS servers?
ipconfig /all.
Which tool lists each router between you and a destination?
traceroute on Linux, or tracert on Windows.
Which command shows listening ports and active connections?
netstat, or ss on modern Linux.
Topic 5 of 6 in Network Troubleshooting
Test yourself on Network Troubleshooting
The full CompTIA Network+ N10-009 question bank has 910 questions, with timed practice exams and an explanation for every answer.
This study guide is independent and is not affiliated with, endorsed by, or sponsored by CompTIA. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.