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 am trying to forward the outbound traffic to another server. Current rule is:

/sbin/iptables -A OUTPUT -p tcp -s localhost -o 91.xxx.xxx.xxx --dport 65000:65010 -j ACCEPT

but when I do a iptables -L, the rule its showed like this:

ACCEPT tcp -- localhost.localdomain anywhere tcp dpts:65000:65010

So I guess my rule is bad written since the "destination" column shows "anywhere"

Can you help me with this?

share|improve this question
add comment

2 Answers

Based on what it looks like you're trying to do, you're probably better off with a route.

/sbin/route add default gw 91.xxx.xxx.xxx

You would use iptables for Network Address Translation.

share|improve this answer
add comment

maybe this:

iptables -t nat -A PREROUTING -p tcp --dport 65000:65010 -j DNAT --to ip.of.other.host

i assume your FORWARD policy is allow or otherwise such traffic is permitted.

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.