LX0-103 · Question #169
Identify the statement that would create a default route using a gateway of 192.168.1.1.
The correct answer is D. route add defaultgw 192.168.1.1. The route add command is used on Linux to add static routes, including a default gateway route.
Question
Identify the statement that would create a default route using a gateway of 192.168.1.1.
Options
- Anetstat add defaultgw
- Broute default 192.168.1.1
- Cip route default 192.168.1.1
- Droute add defaultgw 192.168.1.1
- Eifconfig defaultgw 192.168.1.1 eth0
How the community answered
(20 responses)- B5% (1)
- D90% (18)
- E5% (1)
Why each option
The `route add` command is used on Linux to add static routes, including a default gateway route.
`netstat` is a diagnostic utility for displaying network connections and statistics, not for adding or modifying routes.
The `route` command requires the `add` keyword before specifying the route type; omitting it results in invalid syntax.
The `ip route` command uses different syntax - the correct form would be `ip route add default via 192.168.1.1`, making this option syntactically incorrect.
The `route add defaultgw 192.168.1.1` command uses the correct `route` utility with the `add` action and `defaultgw` parameter to specify the gateway IP. The `route` command is the traditional Linux tool for manipulating the kernel's IP routing table, and `add defaultgw` is the required syntax to define where packets with no more-specific route should be forwarded.
`ifconfig` is used to configure network interface parameters such as IP address and netmask, not to define routing or gateways.
Concept tested: Linux static default route configuration with route command
Source: https://linux.die.net/man/8/route
Topics
Community Discussion
No community discussion yet for this question.