CompTIA Linux+ (XK0-005) — Question 4
A Linux administrator needs to redirect all HTTP traffic temporarily to the new proxy server 192.0.2.25 on port 3128. Which of the following commands will accomplish this task?
Answer options
- 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 –-to-destination 192.0.2.25:3129
- C. iptables -t nat -I PREROUTING -p top --sport 80 -j DNAT –-to-destination 192.0.2.25:3129
- D. iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT –-to-destination 192.0.2.25:3128
Correct answer: D
Explanation
The correct command is D because it properly appends a rule to the NAT table that redirects traffic on port 80 to the specified proxy server. Options A, B, and C either use incorrect command flags or attempt to modify the rules in a way that does not achieve the desired redirection of HTTP traffic.