iptables port mapping ANY:95 to originalIP:80

Hi,
I'm using my linux box as a router and I have an application that is make all the request in port 95.
I need to make an iptables rule that will change the original port of any destination ip addres to 80.
I know how to do it for a specific destination ip but I could not find the way to do it for any destination ip.

iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 95 -j DNAT --to 66.249.87.99:80

66.249.87.99 is the Google ip, but I need the rule to work for any ip. Something like:

iptables -t nat -A PREROUTING -i eth0 -p tcp -d ANY --dport 95 -j DNAT --to ANY:80

I know that it is possible to do in checkpoint firewall but it is a little expensive...
e_bergAsked:
Who is Participating?
 
CetusMODCommented:
PAQed with points refunded (250)

CetusMOD
Community Support Moderator
0
 
pablouruguayCommented:
i have this in my iptables

iptables -t nat -A PREROUTING  -p tcp -d 204.4.28.69  --dport 81 -j DNAT  --to 192.168.1.79:80
iptables -t nat -A PREROUTING  -p tcp -d 204.4.28.69  --dport 82 -j DNAT  --to 192.168.1.79:443
0
 
e_bergAuthor Commented:
This is not what I need.
I need to make something more generic.
Not for a specifics ip.
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

 
pablouruguayCommented:
replace -d 204.4.28.69 for

-d 0/0
0
 
e_bergAuthor Commented:
This will not work.
I found it.  It mast be:
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 95 -j DNAT --to-destination :80
0
 
Cyclops3590Commented:
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.
I will leave the following recommendation for this question in the Cleanup topic area:
PAQ/Refund

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

Cyclops3590
EE Cleanup Volunteer
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.