LX0-104 · Question #503
Identify the statement that would create a default route using a gateway of 192.168.1.1.
The correct answer is B. route add default gw 192.168.1.1. The route add default gw <gateway_IP> command is used to manually add a default route to the kernel's IP routing table, directing traffic for unknown networks through the specified gateway.
Question
Options
- Anetstat -add default gw 192.168.1.1
- Broute add default gw 192.168.1.1
- Cip route default 192.168.1.1
- Droute default gw 192.168.1.1
- Eifconfig default gw 192.168.1.1 eth0
How the community answered
(24 responses)- A8% (2)
- B88% (21)
- E4% (1)
Why each option
The `route add default gw <gateway_IP>` command is used to manually add a default route to the kernel's IP routing table, directing traffic for unknown networks through the specified gateway.
netstat is primarily used to display network connections, routing tables, and interface statistics, not to add routes.
The `route` command, specifically with the `add default gw` options, is the correct syntax for adding a default gateway to the routing table. This establishes the path for all traffic destined for networks not explicitly defined in the routing table, directing it to the specified gateway IP address.
The `ip route add default via <gateway_IP>` command is the modern equivalent, but `ip route default` is not the correct syntax for adding a default route with `ip`.
This option is missing the `add` keyword required by the `route` command to establish a new route.
ifconfig is used to configure network interfaces, not to add default routes directly; it's also a deprecated command in favor of `ip`.
Concept tested: Adding a default route using the route command.
Source: https://linux.die.net/man/8/route
Topics
Community Discussion
No community discussion yet for this question.