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

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 256.256.256.256 --dport 563 -m state --state NEW -j ACCEPT

ACCEPT     tcp  --  anywhere             usenet-server.com tcp dpt:nntps state NEW 
ACCEPT     udp  --  anywhere             usenet-server.com udp dpt:nntps state NEW 

But they do not work.

share|improve this question

1 Answer 1

This did the trick:

YourIP=1.2.3.4
YourPort=80
TargetIP=2.3.4.5
TargetPort=22

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: http://www.debian-administration.org/articles/595

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.