Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

iptables port mapping ANY:95 to originalIP:80

Posted on 2005-04-30
6
Medium Priority
?
283 Views
Last Modified: 2010-03-18
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...
0
Comment
Question by:e_berg
6 Comments
 
LVL 14

Expert Comment

by:pablouruguay
ID: 13911732
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
 

Author Comment

by:e_berg
ID: 13915322
This is not what I need.
I need to make something more generic.
Not for a specifics ip.
0
 
LVL 14

Expert Comment

by:pablouruguay
ID: 13917114
replace -d 204.4.28.69 for

-d 0/0
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:e_berg
ID: 13917149
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
 
LVL 25

Expert Comment

by:Cyclops3590
ID: 16375970
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
 

Accepted Solution

by:
CetusMOD earned 0 total points
ID: 16410806
PAQed with points refunded (250)

CetusMOD
Community Support Moderator
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
Integration Management Part 2
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…

572 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question