Use iproute2 to check the default route, next hops, devices, and metrics for destination networks.
Do not modify routes.
Which command is appropriate?
ip route show reads the kernel routing table, including default routes, gateways, devices, and metrics.
Detailed explanation
ip address showIncorrect. address show displays interface addresses.
Incorrect. address show displays interface addresses.
ip link showIncorrect. link show displays link-layer state.
Incorrect. link show displays link-layer state.
ip route showCorrect. It displays the main routing table.
Correct. It displays the main routing table.
ip route flush table mainIncorrect. route flush removes routes and is a destructive change.
Incorrect. route flush removes routes and is a destructive change.
Try it yourself
An example you can run in a temporary verification environment.
printf '%s
' 'ip route show -> destination via gateway dev interface metric value'Expected result
ip route show -> destination via gateway dev interface metric valueKey points
- Use the route object
- Inspect the default route
- show is read-only
Notes
- Environment: 操作対応表の表示のみ
- 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.