CompTIA Linux+ (XK0-006)TroubleshootingEasy

A Linux server is configured with a network interface `eth0` and a default gateway `192.168.1.1`. The server can communicate with devices on its local subnet (`192.168.1.0/24`) but cannot reach any hosts on external networks. Which of the following commands would most effectively diagnose if the default route is correctly configured?

  1. A`dig google.com` to test DNS resolution for external hosts.
  2. B`ping 192.168.1.1` to check connectivity to the gateway.
  3. C`ip route show` to inspect the routing table for a default gateway.
  4. D`ip addr show eth0` to verify the IP address of the interface.
Show answer & explanation

Correct answer: C. `ip route show` to inspect the routing table for a default gateway.

The problem states the server can reach local subnet devices but not external ones. This strongly suggests a problem with the default route, which directs traffic to external networks. `ip route show` displays the system's routing table, explicitly showing if a default route (`default via ...`) is present and correctly configured.

Why the other options are wrong

  • A. `dig google.com` tests DNS resolution, which relies on external network access. If the default route is missing, DNS resolution will fail, but it's a symptom, not the direct cause of routing failure.
  • B. Pinging the gateway (`192.168.1.1`) confirms local connectivity to the gateway, but doesn't show if that gateway is actually configured as the *default route* for external traffic.
  • D. `ip addr show eth0` verifies the interface's IP, which is necessary for local communication, but not directly for external routing issues beyond the local subnet.

ip route show (Default Route)

The `ip route show` command displays the Linux kernel's routing table. It's used to verify if a default route (specified as `default via <gateway_ip> dev <interface>`) exists, which is essential for communication with hosts outside the local subnet.

  • Shows the kernel's routing table.
  • Identifies the default gateway for external traffic.
  • Crucial for diagnosing external network connectivity issues.

Memory trick: IP ROUTE SHOWs the road out of town.

More Troubleshooting questions