CompTIA Linux+ (XK0-006)TroubleshootingMedium

A server can successfully ping other hosts on its local subnet but cannot reach any external IP addresses. Running `ip route show` returns no default route entry. Which command adds a default gateway of 192.168.1.1 through interface eth0?

  1. Aip route add default via 192.168.1.1 dev eth0
  2. Bip link set eth0 up
  3. Cip neigh add 192.168.1.1 dev eth0
  4. Dip addr add 192.168.1.1/24 dev eth0
Show answer & explanation

Correct answer: A. ip route add default via 192.168.1.1 dev eth0

The `ip route add default via <gateway> dev <interface>` command inserts a default route so that traffic destined for networks outside the local subnet is forwarded to the specified gateway. Without this entry, the kernel has no route for external destinations and packets are dropped.

Why the other options are wrong

  • B. ip link set eth0 up only brings the interface into an operational state; it doesn't add a route.
  • C. ip neigh add manually populates the ARP/neighbor table, unrelated to routing configuration.
  • D. ip addr add assigns an IP address to an interface; it does not configure routing.

Missing Default Route

Without a default route, a host can only communicate with directly connected subnets; all other traffic has no path and is discarded by the kernel.

  • Check with ip route show or route -n
  • Add temporarily with ip route add default via <gw> dev <iface>
  • Persist via NetworkManager, netplan, or /etc/sysconfig/network-scripts depending on distro

Memory trick: No default route = no way out of town.

More Troubleshooting questions