Which of the following commands can be used together to accomplish this task?

A Linux systems administrator needs to persistently enable IPv4 forwarding in one of the Linux systems.

Which of the following commands can be used together to accomplish this task? (Choose two.)
A . sysctl net.ipv4.ip_forward
B . sysctl -w net.ipv4.ip_forward=1
C . echo "net.ipv4.ip_forward=1" >> /etc/sysctl.conf
D . echo 1 > /proc/sys/net/ipv4/ip_forward
E . sysctl Cp
F . echo "net.ipv6.conf.all.forwarding=l" >> /etc/sysctl.conf

Answer: B E

Explanation:

The commands that can be used together to persistently enable IPv4 forwarding in one of the Linux systems are sysctl -w net.ipv4.ip_forward=1 and sysctl Cp. The first command will use sysctl to write a new value (1) to the net.ipv4.ip_forward kernel parameter, which controls whether IP forwarding is enabled or disabled for IPv4. This will enable IP forwarding immediately without rebooting. However, this change is temporary and will be lost after a reboot or a system reload. To make it permanent, we need to use the second command sysctl Cp, which will load kernel parameters from /etc/sysctl.conf file. This file contains key-value pairs of kernel parameters and their values. To make sure that net.ipv4.ip_forward is set to 1 in this file, we can either edit it manually or append it using echo “net.ipv4.ip_forward=1” >> /etc/sysctl.conf.

The other options are not correct commands for persistently enabling IPv4 forwarding. The sysctl net.ipv4.ip_forward command will only display the current value of net.ipv4.ip_forward parameter, but not change it. The echo 1 > /proc/sys/net/ipv4/ip_forward command will write 1 to /proc/sys/net/ipv4/ip_forward file, which is another way to change net.ipv4.ip_forward parameter. However, this change is also temporary and will not survive a reboot or a system reload. The echo “net.ipv6.conf.all.forwarding=l” >> /etc/sysctl.conf command will append a line to /etc/sysctl.conf file that sets net.ipv6.conf.all.forwarding parameter to 1. However, this parameter controls whether IP forwarding is enabled or disabled for IPv6, not IPv4.

References: sysctl(8) – Linux manual page; Configure Linux as a Router (IP Forwarding)

Latest XK0-005 Dumps Valid Version with 136 Q&As

Latest And Valid Q&A | Instant Download | Once Fail, Full Refund

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments