ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 68 - XK0-005 discussion

Report
Export

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
Answers
A.
sysctl net.ipv4.ip_forward
B.
sysctl -w net.ipv4.ip_forward=1
Answers
B.
sysctl -w net.ipv4.ip_forward=1
C.
echo "net.ipv4.ip_forward=1" >> /etc/sysctl.conf
Answers
C.
echo "net.ipv4.ip_forward=1" >> /etc/sysctl.conf
D.
echo 1 > /proc/sys/net/ipv4/ip_forward
Answers
D.
echo 1 > /proc/sys/net/ipv4/ip_forward
E.
sysctl -p
Answers
E.
sysctl -p
F.
echo "net.ipv6.conf.all.forwarding=l" >> /etc/sysctl.conf
Answers
F.
echo "net.ipv6.conf.all.forwarding=l" >> /etc/sysctl.conf
Suggested 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 -p. 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 -p, 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. Reference: sysctl(8) - Linux manual page; Configure Linux as a Router (IP Forwarding)

asked 02/10/2024
Mohammad Wahid
46 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first