LPIC-2 Exam 201 (Linux Engineer) — Question 25
A network client has an Ethernet interface (eth0) configured with an IP address in the subnet 192.168.0.0/24. This subnet has a router, with the IP address
192.168.0.1, that connects this subnet to the Internet. Which of the following commands can be used on the client to enable it to use the router as its default gateway? (Choose two.)
Answer options
- A. route add default gw 192.168.0.1 eth0
- B. ifconfig eth0 defaultroute 192.168.0.1
- C. ip route add default via 192.168.0.1
- D. echo defaultroute 192.168.0.1 >>/etc/resolv.conf
- E. route add defaultgw=192.168.0.1 if=eth0
Correct answer: A, C
Explanation
The correct commands for setting the default gateway are 'route add default gw 192.168.0.1 eth0' and 'ip route add default via 192.168.0.1', as they properly configure the routing table. The other options either use incorrect syntax or are intended for different configurations, such as modifying DNS settings instead of routing.