A Linux administrator has just added a new subnet behind an internal router, but the company's web server (192.168.56.101) still cannot reach any hosts on 192.168.100.0/24. The router's LAN address is 192.168.56.1, and it is connected to the server through interface enp0s8. The current routing table on the server contains only the following entries:
default via 10.0.0.1 dev enp0s3 proto dhcp metric 100
10.0.0.0/24 dev enp0s3 proto kernel scope link src 10.0.0.5 metric 100
192.168.56.0/24 dev enp0s8 proto kernel scope link src 192.168.56.101 metric 100
Which single command, executed as root, will immediately allow the server to reach the 192.168.100.0/24 network until the next reboot?
ip route add 192.168.100.0/24 via 192.168.56.1 dev enp0s8
ip route add 192.168.100.0/24 dev enp0s8 src 192.168.56.101
ip route add -net 192.168.56.1 netmask 255.255.255.0 gw 192.168.100.0
To reach 192.168.100.0/24, the host must learn that packets for that network should be forwarded to the next-hop router 192.168.56.1, which is reachable on interface enp0s8. The ip route add <prefix> via <gateway> dev <interface> syntax installs a unicast route in the kernel routing table that remains in memory only for the current boot session.
ip route add 192.168.100.0/24 via 192.168.56.1 dev enp0s8 adds exactly that: a route for the /24 prefix that uses 192.168.56.1 as the gateway on enp0s8, solving the connectivity issue.
Why the other choices are wrong:
ip route add 192.168.100.0/24 dev enp0s8 src 192.168.56.101 creates a link route; because no gateway is specified, the kernel assumes the destination is directly attached to enp0s8, so packets never reach the router.
ip route add default via 192.168.56.1 dev enp0s8 changes the default route for all traffic, not just the new subnet, which is unnecessary and risks breaking existing connectivity.
ip route add -net 192.168.56.1 netmask 255.255.255.0 gw 192.168.100.0 mixes legacy route syntax with incorrect addresses, so it would either fail or install a nonsensical entry.
Therefore, the first command is the only one that correctly and safely resolves the problem.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
Why is a gateway needed to reach the 192.168.100.0/24 network?
Open an interactive chat with Bash
What does the `ip route add` command do?
Open an interactive chat with Bash
What is the difference between a unicast route and a link route?
Open an interactive chat with Bash
CompTIA Linux+ XK0-006 (V8)
System Management
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
IT & Cybersecurity Package Join Premium for Full Access