LPIC-2 Exam 202 (Linux Engineer) — Question 32

On a Linux router, packet forwarding for IPv4 has been enabled. After a reboot, the machine no longer forwards IP packets from other hosts. The command: echo 1 > /proc/sys/net/ipv4/ip_forward temporarily resolves this issue.
Which one of the following options is the best way to ensure this setting is saved across system restarts?

Answer options

Correct answer: C

Explanation

The correct answer is C because modifying /etc/sysctl.conf ensures that the setting is applied at boot time when the system processes the sysctl settings. Options A and B are incorrect as they only apply to user sessions and do not affect system-wide settings. Options D and E are also incorrect since they do not use the correct method for making kernel parameters persistent across reboots.