Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

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
share|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
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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