CompTIA Linux+ (XK0-006)System ManagementHard
A technician manually configured a static IP address on eth0 using 'ip addr add 192.168.1.50/24 dev eth0'. The host can reach other devices on the local subnet but cannot reach any external networks. Which command is most likely needed to fix this issue?
- Aip route add default via 192.168.1.1
- Bip neigh add 192.168.1.1 dev eth0
- Cip addr flush dev eth0
- Dip link set eth0 up
Show answer & explanationAnswer & explanation
Correct answer: A. ip route add default via 192.168.1.1
Adding an IP address only sets the host's own address and connects it to the local subnet; without a default route (gateway), the kernel has no path to send traffic destined for networks outside the local subnet, so 'ip route add default via <gateway>' must be added.
Why the other options are wrong
- B. ip neigh add manually adds an ARP/neighbor cache entry, which does not establish routing to other networks.
- C. ip addr flush dev eth0 would remove the configured IP address, breaking connectivity entirely.
- D. ip link set eth0 up only brings the interface up; if it were down, local connectivity would also fail, but that's not the described symptom.
Default Route Configuration
A default route (gateway) tells the kernel where to forward packets destined for networks not directly connected to the host; without it, only local-subnet communication works.
- ip route add default via <gateway-ip>
- View routes with ip route show or route -n
- Persistent config depends on NetworkManager/netplan or /etc/sysconfig/network-scripts
Memory trick: 'No gateway = stuck in your neighborhood; default route is the highway on-ramp.'