Which of the following commands will accomplish this task?

0.2.25 on port 3128.

Which of the following commands will accomplish this task?
A . iptables -t nat -D PREROUTING -p tcp –sport 80 -j DNAT – -to-destination 192.0.2.25:3128
B . iptables -t nat -A PREROUTING -p top –dport 81 -j DNAT C-to-destination 192.0.2.25:3129
C . iptables -t nat -I PREROUTING -p top –sport 80 -j DNAT C-to-destination 192.0.2.25:3129
D . iptables -t nat -A PREROUTING -p tcp –dport 80 -j DNAT C-to-destination 192.0.2.25:3128

Answer: D

Explanation:

The command iptables -t nat -A PREROUTING -p tcp –dport 80 -j DNAT –to-destination 192.0.2.25:3128 adds a rule to the nat table that redirects all incoming TCP packets with destination port 80 (HTTP) to the proxy server 192.0.2.25 on port 3128. This is the correct way to achieve the task. The other options are incorrect because they either delete a rule (-D), use the wrong protocol (top instead of tcp), or use the wrong port (81 instead of 80).

Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 12: Managing Network Connections, page 381.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments