Which command changes the source IP address to 192.0.2.11 for all IPv4 packets going through eth0?

Prepare for the LPIC3 303 Security Test. Engage with flashcards and multiple-choice questions, complete with hints and detailed explanations. Ace your exam!

Multiple Choice

Which command changes the source IP address to 192.0.2.11 for all IPv4 packets going through eth0?

Explanation:
The command that changes the source IP address to 192.0.2.11 for all IPv4 packets going through eth0 is structured correctly in the chosen option. The `iptables` tool is used to configure the packet filtering rules of the Linux kernel, and the `-t nat` option specifies that the command should operate on the NAT (Network Address Translation) table. In this case, using the POSTROUTING chain is appropriate because it modifies packets right before they are sent out on the interface. The `-o eth0` parameter directs the rule to apply to packets leaving the eth0 interface, ensuring that the source IP can be changed for outbound packets. The `-j SNAT` target specifically stands for Source NAT, which is designed to alter the source address of outgoing packets. The `--to-source 192.0.2.11` part clearly specifies the new source IP address that will be applied to all packets as they exit through eth0. The other options either misuse the NAT table or incorrectly target the wrong chain for the intended effect. For example, modifying packets in the PREROUTING chain would apply changes to incoming packets that haven't yet been routed, which doesn't fit the requirement of changing the source

The command that changes the source IP address to 192.0.2.11 for all IPv4 packets going through eth0 is structured correctly in the chosen option. The iptables tool is used to configure the packet filtering rules of the Linux kernel, and the -t nat option specifies that the command should operate on the NAT (Network Address Translation) table.

In this case, using the POSTROUTING chain is appropriate because it modifies packets right before they are sent out on the interface. The -o eth0 parameter directs the rule to apply to packets leaving the eth0 interface, ensuring that the source IP can be changed for outbound packets. The -j SNAT target specifically stands for Source NAT, which is designed to alter the source address of outgoing packets. The --to-source 192.0.2.11 part clearly specifies the new source IP address that will be applied to all packets as they exit through eth0.

The other options either misuse the NAT table or incorrectly target the wrong chain for the intended effect. For example, modifying packets in the PREROUTING chain would apply changes to incoming packets that haven't yet been routed, which doesn't fit the requirement of changing the source

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy