I have the following rule:

iptables -t nat -A PREROUTING -d 93.xxx.61.56 -j DNAT --to-destination 10.8.0.10

Problem is that this rule affects some programs and I want this rule to be active only for a specific port like 443.

Is it possible to do that? I mean, everything else that tries to connect to 93.xxx.61.56 on a different port than 443 should not be affected by this rule.

many thanks.

link|improve this question
feedback

2 Answers

up vote 1 down vote accepted

Try

iptables -t nat -A PREROUTING -d 93.xxx.61.56 --sport 443 -j DNAT --to-destination 10.8.0.10d
link|improve this answer
Damn. The answer above got it before me. – Joseph Redfern Nov 1 '10 at 19:33
thanks mate. seems to fix it – Ian P. Nov 1 '10 at 20:12
Weird that --sport instead of --dport fixed it. That too without -m tcp. – Saurabh Barjatiya Nov 2 '10 at 8:15
feedback

Add -p tcp --dport 443 to your command, and then it will only match TCP packets with destination port = 443.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.