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?
The command "iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT –-to-destination 192.0.2.25:3128" will temporarily redirect all HTTP traffic to the new proxy server at IP address 192.0.2.25 and port 3128. The options used in this command are:
-t nat: Specifies the table (nat) to be used for this operation
-A PREROUTING: Specifies that the rule should be added to the PREROUTING chain, which is used to manipulate incoming packets before they are processed by the routing decision
-p tcp: Specifies that the rule should apply to TCP packets
--dport 80: Specifies that the rule should apply to incoming packets destined for port 80 (the default HTTP port)
-j DNAT: Specifies that the target of the rule should be DNAT (Destination NAT), which rewrites the destination address of a packet
--to-destination 192.0.2.25:3128: Specifies the destination address and port to which incoming packets should be redirected
Note: After executing this command, the administrator should make sure to save the iptables configuration, so that it will persist after a reboot.
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.
linux_admin
Highly Voted 11 months agocopovo
Most Recent 4 weeks, 1 day agoAlizadeh
4 months, 4 weeks agoHuckleberry
11 months, 4 weeks agobjornborg
1 year, 2 months agoNvoid
1 year, 1 month ago