202-450 practice question 14 of 25

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?

Full set: 119 questions
Answer options
A: Add echo 1 > /proc/sys/net/ipv4/ip_forward to the root user login script
B: Add echo 1 > /proc/sys/net/ipv4/ip_forward to any user login script
C: In /etc/sysct1.conf change net.ipv4.ip_forward to 1 Correct answer
D: In /etc/rc.local add net.ipv4.ip_forward = 1
E: In /etc/sysconfig/iptables-config add ipv4.ip_forward = 1
Correct Answer:
C. In /etc/sysct1.conf change net.ipv4.ip_forward to 1
Explanation

The /proc/sys/ filesystem provides a temporary way to modify kernel parameters. To make these changes persistent across reboots, the standard method is to use the sysctl interface. The configuration file /etc/sysctl.conf (or files in /etc/sysctl.d/) is read at boot time to apply these settings. The parameter net.ipv4.ipforward in this file corresponds directly to the /proc/sys/net/ipv4/ipforward kernel parameter. Setting its value to 1 ensures that IPv4 forwarding is enabled automatically after every system restart.

Why Incorrect

A. A root login script only runs when the root user logs in, not necessarily at boot, making it an unreliable method for a system service.
B. A regular user's login script is inappropriate for a system-wide setting and lacks the necessary privileges to modify kernel parameters.
D. The syntax net.ipv4.ipforward = 1 is for sysctl.conf, not a shell command for /etc/rc.local, which is also a legacy method.
E. The file /etc/sysconfig/iptables-config is specific to RHEL-based systems for configuring the iptables service, not for general kernel parameters.

References

- sysctl.conf(5) man page. Section "DESCRIPTION" states: "/etc/sysctl.conf is a simple file containing sysctl values to be read in and set by sysctl at boot time."

- Red Hat Enterprise Linux 7 Documentation, "Networking Guide", Chapter 3. Kernel Tuning, Section 3.2. "Persistent Module Loading". It specifies using /etc/sysctl.conf or files in /etc/sysctl.d/ for persistent changes.

- Debian Wiki, "KernelModuleBlacklisting". The page also discusses kernel parameter tuning, stating: "To make the change permanent, you need to add the line... to /etc/sysctl.conf".

Scroll to Top