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 have 2 internet connections at home. I surf on both of them: every other connection switches isp.

I already use my VPS as a regular proxy for surfing, ensuring me I always have the same IP address for certain sites.

However: I can not use a proxy for a certain Usenet program, so I would like to set up a port on my VPS as a very specific proxy. How do I do that?

I've tried this rule:

iptables -A FORWARD -p tcp -i eth1 -o eth1 -d --dport 563 -m state --state NEW -j ACCEPT

ACCEPT     tcp  --  anywhere    tcp dpt:nntps state NEW 
ACCEPT     udp  --  anywhere    udp dpt:nntps state NEW 

But they do not work.

share|improve this question

This did the trick:


iptables -t nat -A PREROUTING --dst $YourIP -p tcp --dport $YourPort -j DNAT \
--to-destination $TargetIP:$TargetPort
iptables -t nat -A POSTROUTING -p tcp --dst $TargetIP --dport $TargetPort -j SNAT \
--to-source $YourIP
iptables -t nat -A OUTPUT --dst $YourIP -p tcp --dport $YourPort -j DNAT \
--to-destination $TargetIP:$TargetPort

Lots of thanks to this article:

share|improve this answer

Your Answer


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.