LFCS · Question #231
Which of the following statements would create a default route using a gateway of 192.168.1.1?
The correct answer is D. route add default gw 192.168.1.1. The route add command is used to add a static route to the routing table, including a default route, by specifying the gateway IP address.
Question
Options
- Anetstat -add default gw
- Broute default 192.168.1.1
- Cip route default 192.168.1.1
- Droute add default gw 192.168.1.1
- Eifconfig default gw 192.168.1.1 eth0
How the community answered
(27 responses)- B4% (1)
- D93% (25)
- E4% (1)
Why each option
The `route add` command is used to add a static route to the routing table, including a default route, by specifying the gateway IP address.
`netstat` is primarily used for displaying network connections, routing tables, and interface statistics, not for adding routes.
The syntax `route default 192.168.1.1` is incomplete and syntactically incorrect for adding a default route using the `route` command.
While `ip route add default via 192.168.1.1` is a correct modern command, the provided option `ip route default 192.168.1.1` is syntactically incorrect.
The `route add` command is used to manually add an entry to the kernel routing table. The `default gw` syntax specifies that the entry is for the default route, directing all traffic for unknown networks through the specified gateway IP address.
`ifconfig` is used for configuring network interfaces (like setting IP addresses), not for adding routes to the routing table.
Concept tested: Adding a default route using `route` command
Source: https://man7.org/linux/man-pages/man8/route.8.html
Topics
Community Discussion
No community discussion yet for this question.