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?


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.


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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