Lecture me on SSH tunneling and IP addresses.

Refrozen

123456789 123456789 (123)
Dec 6, 2006
1,607
22
0
Houses
www.refrozen.com
I'm writing a softwares (that does all that) which makes use of an SSH tunnel generated SOCKS proxy with the -D flag in OpenSSH.

My VPS has 4 dedicated IP addresses and I'd like to be able to use all 4 of them (cycling/whatever) with this. How the heck do I control what IP address the socks tunnel connection goes out on?

Perhaps I'm totally misunderstanding how an IP address on a Linux server works. Do I have to bind it to eth0 somehow? Can I not hotswap them? cPanel/WHM allows me to create accounts that use different IP addresses, how the heck does this work?
 


Im not sure what exactly you need, but if you do ssh -d 2001 name@IP you can just use whichever ip to connect to that port.

ssh -d 2001 root@1.1.1.1
ssh -d 2002 root@2.2.2.2
ect.

so there will be a socks proxy to 1.1.1.1 on 2001 and 2.2.2.2 on 2002

donno if that helps, but you dont really need to do anything on set on the server side.

Proxy with SSH Tunnels – View Demos, Watch Porn | Matt Fraser
 
Im not sure what exactly you need, but if you do ssh -d 2001 name@IP you can just use whichever ip to connect to that port.

ssh -d 2001 root@1.1.1.1
ssh -d 2002 root@2.2.2.2
ect.

so there will be a socks proxy to 1.1.1.1 on 2001 and 2.2.2.2 on 2002

donno if that helps, but you dont really need to do anything on set on the server side.

Proxy with SSH Tunnels – View Demos, Watch Porn | Matt Fraser

If you intend on running multiple tunnels you'll likely want to use the -f and -N tags, the f tag fork into the background, and -N tells it no commands will be sent from the CLI, since normally forking complains otherwise.
 
Im not sure what exactly you need, but if you do ssh -d 2001 name@IP you can just use whichever ip to connect to that port.

ssh -d 2001 root@1.1.1.1
ssh -d 2002 root@2.2.2.2
ect.

so there will be a socks proxy to 1.1.1.1 on 2001 and 2.2.2.2 on 2002

donno if that helps, but you dont really need to do anything on set on the server side.

Proxy with SSH Tunnels – View Demos, Watch Porn | Matt Fraser

Hmm. I guess what I was hoping for was a way to connect to the server as 1.1.1.1 (its default/primary/whatever IP address) and be able to have the ssh tunnel go out on 2.2.2.2...

...but I guess doing it that way is pretty simple. No idea why that didn't click in my head.

Edit: + thanks for that Karl. Wasn't aware there was a -N.
 
Sounds like you are trying to connect out of a server that has 4 ip addresses and you want to round robin between them, correct? If this is the case then you just want to bind to the address you want to use: ssh -D 2001 -b 1.2.3.4 <remote ip>
 
  • Like
Reactions: Refrozen
Let me see if i understand you:

Let your home box be 1.1.1.1
and your server has ip address
2.2.2.2
and
3.3.3.3

you want to be able to bind to 2.2.2.2 from 1.1.1.1 and then have the outside world see that you are coming from 2.2.2.2

and if you bind to 3.3.3.3 from 1.1.1.1 you want the outside world to see that you are coming from 3.3.3.3.

ssh -D does not support this. You will want to use the socks proxy squid.

The magic trick is to use the config option acl with myip


Setup squid proxy server to use multiple outgoing IP addresses Azaad Source