CompTIA Linux+ (XK0-005) — Question 47
A systems administrator needs to reconfigure a Linux server to allow persistent IPv4 packet forwarding. Which of the following commands is the correct way to accomplish this task?
Answer options
- A. echo 1 > /proc/sys/net/ipv4/ipv_forward
- B. sysctl -w net.ipv4.ip_forward=1
- C. firewall-cmd --enable ipv4_forwarding
- D. systemctl start ipv4_forwarding
Correct answer: B
Explanation
The correct command is 'sysctl -w net.ipv4.ip_forward=1' because it modifies the kernel parameter for IPv4 forwarding. While 'echo 1 > /proc/sys/net/ipv4/ipv_forward' can change the setting temporarily, it does not ensure persistence after a reboot. The other options related to firewall and systemctl commands are not valid for enabling IPv4 packet forwarding.