LFCS · 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. To create a default route, the route add default command followed by the gateway IP address is used.
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
(43 responses)- B91% (39)
- C2% (1)
- D2% (1)
- E5% (2)
Why each option
To create a default route, the `route add default` command followed by the gateway IP address is used.
`netstat` is used to display network connections, routing tables, and interface statistics, not to add routes.
The `route` command is traditionally used on Linux systems to manipulate the kernel's IP routing tables. The syntax `route add default gw <gateway_ip>` specifically adds a default route, directing all traffic not matching other routes to the specified gateway.
While `ip route` is a modern command for routing, the correct syntax to add a default route is `ip route add default via 192.168.1.1`.
The `route` command requires the `add` keyword to perform an addition operation.
`ifconfig` is used to configure network interfaces, not to add routing table entries, and its syntax for setting a default gateway is incorrect.
Concept tested: Adding a default route (route command)
Source: https://man7.org/linux/man-pages/man8/route.8.html
Topics
Community Discussion
No community discussion yet for this question.