Use iproute2 to inspect only the IPv4 default route without changing the routing table.
Which command is appropriate?
ip route show default filters the routing table to the default destination, equivalent to 0.0.0.0/0.
Detailed explanation
ip route show defaultCorrect. It displays only routes whose destination is default.
Correct. It displays only routes whose destination is default.
ip address show defaultIncorrect. address operates on interface addresses, not a default interface.
Incorrect. address operates on interface addresses, not a default interface.
ip route add defaultIncorrect. route add changes the table and is missing required details.
Incorrect. route add changes the table and is missing required details.
ip neighbor show defaultIncorrect. neighbor operates on the neighbor cache.
Incorrect. neighbor operates on the neighbor cache.
Try it yourself
An example you can run in a temporary verification environment.
ip route show default 2>/dev/null || printf '%s
' 'ip command is not available'Expected result
default via GATEWAY dev INTERFACEなどの行、未設定なら空、または未導入メッセージKey points
- route show is read-only
- default means 0.0.0.0/0
- Inspect via and dev
Notes
- Environment: iproute2 / 読み取り専用
- 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.