exam questions

Exam XK0-005 All Questions

View all questions & answers for the XK0-005 exam

Exam XK0-005 topic 1 question 68 discussion

Actual exam question from CompTIA's XK0-005
Question #: 68
Topic #: 1
[All XK0-005 Questions]

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 –p
  • F. echo "net.ipv6.conf.all.forwarding=l" >> /etc/sysctl.conf
Show Suggested Answer Hide Answer
Suggested Answer: CE 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Qubert2
2 months, 2 weeks ago
Selected Answer: CE
Correct answer is C and E. C changes the config file (which is read each time on boot) and E loads it immediately. B (sysctl -w net.ipv4.ip_forward=1) make the change immediately but does not persist. it's wrong.
upvoted 1 times
...
Bimbo_12
10 months, 2 weeks ago
To persistently enable IPv4 forwarding in a Linux system, you typically need to modify the system configuration files. The two commands you can actually use together to accomplish this task are: C. echo "net.ipv4.ip_forward=1" >> /etc/sysctl.conf: This appends the configuration net.ipv4.ip_forward=1 to the /etc/sysctl.conf file, which will enable IPv4 forwarding persistently across reboots. E. sysctl –p: This command reloads the sysctl settings from the configuration files, including /etc/sysctl.conf, so that the changes take effect immediately without needing a system reboot. So the correct combination of commands is C and E. They ensure that IPv4 forwarding is enabled persistently and immediately without requiring a reboot.
upvoted 1 times
...
e418137
11 months ago
Selected Answer: BC
B & C accomplish the same goal: write 'net.ipv4.ip_forward=1' to '/etc/sysctl.conf'. (And whatever is in '/etc/sysctl.conf' gets used persistently.) (A) prints the current value of 'net.ipv4.ip_forward'. (D) turns on IPv4 forwarding temporarily (e.g.: gone after reboot). (E) reads 'sysctl' configuration file(s). (F) relates to IPv6, not IPv4 in the question.
upvoted 2 times
...
bongobo
11 months, 1 week ago
D. echo 1 > /proc/sys/net/ipv4/ip_forward IS CORRECT ALSO
upvoted 1 times
p24
2 weeks, 2 days ago
but not persistent
upvoted 1 times
...
...
DRVision
1 year, 1 month ago
Selected Answer: CE
C. echo "net.ipv4.ip_forward=1" >> /etc/sysctl.conf E. sysctl –p The command echo "net.ipv4.ip_forward=1" >> /etc/sysctl.conf[C] is used to add the line net.ipv4.ip_forward=1 to the /etc/sysctl.conf file. This line enables IPv4 forwarding when the system boots. The command sysctl –p[E] is used to reload the sysctl settings from the /etc/sysctl.conf file. This makes the changes take effect immediately without requiring a system reboot.
upvoted 2 times
DRVision
1 year, 1 month ago
Option B, sysctl -w net.ipv4.ip_forward=1, does enable IPv4 forwarding, but it does not persist after a system reboot. This command changes the runtime settings of the system, which are reset to their default values when the system is rebooted. On the other hand, Option C, echo "net.ipv4.ip_forward=1" >> /etc/sysctl.conf, writes the setting into the /etc/sysctl.conf file, which is read at boot time. This makes the change persistent across reboots. Option E, sysctl –p, is used to reload the sysctl settings from the /etc/sysctl.conf file immediately, without needing to reboot the system. This is why options C and E are chosen for persistently enabling IPv4 forwarding.
upvoted 2 times
...
...
giomax
1 year, 1 month ago
Selected Answer: BD
just tested B and D is correct
upvoted 1 times
...
salthehash
1 year, 1 month ago
Selected Answer: CE
C. echo "net.ipv4.ip_forward=1" >> /etc/sysctl.conf This command adds the net.ipv4.ip_forward=1 line to the /etc/sysctl.conf file, which will be read during system startup. E. sysctl –p This command is used to apply changes from the sysctl configuration file, including the changes made in /etc/sysctl.conf. It makes sure that the changes take effect without requiring a system restart.
upvoted 1 times
...
Rob74613
1 year, 7 months ago
Selected Answer: CE
Alot of people are putting BC and I thought I agreed with it until I looked closer at the question, and I found 2 things wrong with BC 1. B doesnt actually make it persistent across system reboots only C does that 2. The question asks what commands can be used together, seems odd to run these commands together C and E however C. will turn on ipv4 forwarding via appending it to the /etc/sysctl.conf file D. will apply and reload the changes without a reboot of the system
upvoted 1 times
...
linux_admin
1 year, 11 months ago
Selected Answer: CE
The commands that can be used together to persistently enable IPv4 forwarding in a Linux system are: C. echo "net.ipv4.ip_forward=1" >> /etc/sysctl.conf E. sysctl –p The first command echo "net.ipv4.ip_forward=1" >> /etc/sysctl.conf is used to add the net.ipv4.ip_forward=1 line to the end of the /etc/sysctl.conf file. This file is used to configure kernel parameters at runtime. The change made in this file will persist across reboots. The second command sysctl –p is used to apply the changes made to the /etc/sysctl.conf file. It reloads the configuration file and sets the new values for the specified parameters. The other options sysctl net.ipv4.ip_forward, sysctl -w net.ipv4.ip_forward=1, echo 1 > /proc/sys/net/ipv4/ip_forward, and echo "net.ipv6.conf.all.forwarding=l" >> /etc/sysctl.conf are not suitable for persistently enabling IPv4 forwarding, as the changes made with these commands will not persist after a reboot.
upvoted 3 times
linux_admin
1 year, 10 months ago
***Discard*** I'm choosing BC.
upvoted 2 times
...
...
KnifeClown1
1 year, 11 months ago
Selected Answer: CE
The correct options to persistently enable IPv4 forwarding in Linux are C and E. Option C adds the line "net.ipv4.ip_forward=1" to the file /etc/sysctl.conf which is used to configure kernel parameters at boot time. This ensures that IPv4 forwarding is enabled each time the system starts. Option E is used to reload the sysctl configuration from the /etc/sysctl.conf file, which in turn sets the IPv4 forwarding value to 1 as specified in the configuration file.
upvoted 1 times
KnifeClown1
1 year, 11 months ago
Correct answer = BC
upvoted 2 times
...
...
Pinnubhai
2 years ago
Selected Answer: BC
1.to allow persistent IPv4 packet forwarding: sysctl -w net.ipv4.ip_forward=1 2. Once the system is satisfactorily tuned, make the new values permanent by modifying /etc/sysctl.conf or the /etc/sysctl.d/ directory.
upvoted 2 times
...
Ckl22
2 years ago
Selected Answer: BC
BC are the only ones that enable IPv4 forwarding persistently
upvoted 2 times
...
TheRealManish
2 years, 1 month ago
Selected Answer: BC
Proof that it is B and C : https://www.systutorials.com/setting-up-gateway-using-iptables-and-route-on-linux/
upvoted 2 times
Nvoid
2 years, 1 month ago
B & C are correct here. B & D do the same thing, but B is a command way and more versatile. C makes it persistently enabled as the question asks.
upvoted 1 times
...
...
clmason1994
2 years, 2 months ago
I agree with B but I disagree with C. It should be D given the information https://linuxconfig.org/how-to-turn-on-off-ip-forwarding-in-linux
upvoted 1 times
Ckl22
2 years ago
D is temporary, C is persistent through reboots
upvoted 1 times
...
MrGykz
2 years, 1 month ago
D talks about ipv6 not ipv4 , the task asks about ipv4
upvoted 1 times
...
MrGykz
2 years, 1 month ago
Even in your used link it states: Using either method above will not make the change persistent. To make sure the new setting survives a reboot, you need to edit the /etc/sysctl.conf file. # sudo nano /etc/sysctl.conf
upvoted 1 times
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago