Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

simple question: "need a way to proxify a port"

I have a linux server and have a proxy server on another machine.

My linux server needs connect to port 'x' on ip 'y'

Is it possible to create iptables rule or another way to: when my linux server tries to connect to port 'x' on ip 'y' uses my proxy server on another machine?

In other words, I need to my server's ip changes when it needs to connect port 'x' on ip 'y' by using another proxy server machine.

share|improve this question
1  
    
What kind of proxy (SOCKS, HTTP, FTP, …)? Or do you simply want to redirect TCP traffic? –  Gilles Apr 22 '12 at 23:27
    
@Gilles it is socks. no i need proxify a specific port. –  Metalik Apr 23 '12 at 4:34
    
I'm still unclear on what you're asking. "need to my server's ip changes" seems like it's missing a verb. Need to log? Need to redirect? Need to block? Is the idea that the proxy is not used by linux box unless it is specifically attempting to connect to y:x ? –  ckhan Apr 27 '12 at 2:58
    
@ckhan need a way to proxify a port –  Metalik Apr 27 '12 at 6:14
show 2 more comments

1 Answer

This can't be done at the TCP layer because the application won't be using the SOCKS protocol and so the SOCKS server can't understand the request. You can look into using tsocks to transparently send traffic from certain application(s) via the SOCKS server. You can configure tsocks to select the proxy based on the destination and port number, using the reaches configuration directive.

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.