Quote:
Originally Posted by sanjay87
Need help how can i redirect the incoming traffic 8080 443 of server example.com to port 8080 of xxx.com.I tried out below rule but not seems to be working
iptables -t nat -I PREROUTING --src example.com --dst xxx.com -p tcp --dport 8080
Need help how can i redirect traffic via iptables
|
I use lines like the one below to redirect inbound Web traffic to a set of aliases on the "dirty" side of the firewall to specific boxes on the "clean" side:
Code:
iptables --table nat --append PREROUTING --in-interface ${EXTERNAL_IF} \
--destination ${EXTERNAL_IPADDR} --source 0/0 --protocol tcp \
--destination-port 80 --jump DNAT --to-destination ${INTERNAL_IP}:80
If you need to redirect traffic intended for two ports (8080 & 443) you might need two lines; I'm not certain if you could specify a comma-delimited list of ports in a single command line. Note: The shell variables would, obviously, need to be set to whatever is appropriate for your network and the port numbers would need to be changed as well. Plus... it's been years since I wrote that Iptables rule so I'm not sure if all of those options are needed for your situation. You could comment out your line and add the one above (after tweaking) and see if that solves your problem.
Hope this helped...
--
Rick