Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

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

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.