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?

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/sysctl.conf change net.ipv4.ip_forward to 1
D. In /etc/rc.local add net.ipv4.ip_forward = 1
E. In /etc/sysconfig/iptables-config add ipv4.ip_forward = 1

題解

直接更改/proc目錄裡的檔案,只會影響到記憶體的內容,並不會將設定存在任何硬碟的設定檔內。反過來若是直接設定硬碟的設定檔,則可以永久地讓設定套用至/proc的目錄中,例如修改「/etc/sysctl.conf」會影響到「/proc/sys/」。

所以這題答案是選項「C」。