Use the net-tools route command to display the IPv4 routing table.
Avoid hostname resolution so destinations and gateways remain numeric.
Which command is appropriate?
route -n displays the legacy routing table numerically and avoids delays from reverse DNS lookups.
Detailed explanation
route add -nIncorrect. route add enters route-add mode rather than simply displaying the table.
Incorrect. route add enters route-add mode rather than simply displaying the table.
route -nCorrect. It displays the routing table without name resolution.
Correct. It displays the routing table without name resolution.
route -aIncorrect. -a is associated with all-interface listing in ifconfig, not this route operation.
Incorrect. -a is associated with all-interface listing in ifconfig, not this route operation.
route --listenIncorrect. route has no --listen option for socket listeners.
Incorrect. route has no --listen option for socket listeners.
Try it yourself
An example you can run in a temporary verification environment.
printf '%s
' 'route -n -> numeric kernel routing table'Expected result
route -n -> numeric kernel routing tableKey points
- -n means numeric
- Inspect gateways numerically
- Do not modify routes
Notes
- Environment: net-tools routeのoption対応表
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.