QuestionQ33

System Maintenance

On a Linux router, IPv4 packet forwarding has been enabled. After rebooting, the system no longer forwards IP packets originating from other hosts. The command echo 1 > /proc/sys/net/ipv4/ip_forward temporarily fixes the problem.

Which of the following is the best way to ensure this setting persists 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/sysct1.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
Explanation

net.ipv4.ip_forward is the sysctl parameter that controls IPv4 forwarding; setting it to 1 enables forwarding between interfaces. Persisting that assignment in the system sysctl configuration causes it to be applied at boot. Modern systems commonly use /etc/sysctl.d/*.conf for this purpose; /etc/sysctl.conf is the traditional equivalent configuration location.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!