Operating Systems

A Linux workstation's eth0 has no address. Using iproute2 tools, a technician must temporarily set 192.168.10.25/24 on eth0, add 192.168.10.1 as the default gateway, and confirm the route. Which sequence does this?

Show the answer

Correct answerA. ip addr add 192.168.10.25/24 dev eth0; ip route add default via 192.168.10.1; ip route show

AWhy this is right: ip addr assigns the address, ip route add default via sets the gateway, and ip route show confirms the route.

BWhy not this: ip neigh manages the ARP/neighbor table, so it cannot set a default gateway or show the route.

CWhy not this: The route syntax is reversed (default must come first, then via the gateway), and ip addr show does not display routes.

DWhy not this: ip link manages interface state, not addresses, and ip link add creates virtual devices rather than assigning an address.

ip addr assigns the address, ip route add default via sets the gateway, and ip route show confirms the route. Using ip neigh is tempting, but it manages the ARP/neighbor cache, not routes.