LFCS · Question #769
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 default gw <gateway_ip> command is used to configure a default gateway for network traffic on Linux systems.
Question
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
(27 responses)- B4% (1)
- D93% (25)
- E4% (1)
Why each option
The `route add default gw <gateway_ip>` command is used to configure a default gateway for network traffic on Linux systems.
`netstat` is primarily used for displaying network connections, routing tables, and interface statistics, not for adding routes.
`route default 192.168.1.1` is syntactically incorrect; it lacks the `add` keyword and `gw` specifier.
`ip route default 192.168.1.1` is incomplete for the `ip` command; the correct syntax would be `ip route add default via 192.168.1.1`.
The `route add default gw 192.168.1.1` command is the correct and standard syntax to add a default gateway using the `route` command. The `default` keyword specifies the default route, and `gw` (or `gateway`) specifies the next-hop IP address for that route.
`ifconfig` is used for configuring network interfaces, not for adding default routes; `defaultgw` is not a valid parameter for `ifconfig`.
Concept tested: Adding a default network route
Source: https://man7.org/linux/man-pages/man8/route.8.html
Topics
Community Discussion
No community discussion yet for this question.