CompTIA Linux+ (XK0-005) — Question 10
Developers have requested implementation of a persistent, static route on the application server. Packets sent over the interface eth0 to 10.0.213.5/32 should be routed via 10.0.5.1. Which of the following commands should the administrator run to achieve this goal?
Answer options
- A. route -i etho -p add 10.0.213.5 10.0.5.1
- B. route modify eth0 +ipv4.routes "10.0.213.5/32 10.0.5.1"
- C. echo "10.0.213.5 10.0.5.1 eth0" > /proc/net/route
- D. ip route add 10.0.213.5/32 via 10.0.5.1 dev eth0
Correct answer: D
Explanation
The correct command is D because it properly uses the 'ip' command to add a static route, specifying the destination and next hop. Option A is incorrect due to a syntax error with 'etho' instead of 'eth0', while option B uses an invalid command format and option C is not a standard way to add a static route in modern Linux systems.