- Feb 17, 2006
- 61
- 0
- 0
I have a problem where I want to RDP to my windows box at home from my work computer. I can get it to work fine using Hamachi, except that Hamachi keeps disconnecting/reconnecting every 30 minutes or so.
I want to use ssh, but I'm stuck for a few reasons. I can configure putty to use my work's proxy. This enables me to ssh directly into my university account, but I cannot ssh directly to my home computer (a problem). The port forwarding on my router at home is guaranteed working, since I can ssh into my windows box from my university ssh without a problem.
So far, here's the layout.
WORKS...
work compy <-(ssh through proxy)-> university acct. <-(ssh without any port forwards)-> home
DOESN'T WORK... (but this is what i want)
work compy <-(ssh through proxy)-> home
Everything sound good so far? okay... moving on...
So from here I figured a few ssh port forwards would do the trick. So what I've already tried is using a bunch of "ssh -L" tricks to get anything to work... the problem is is I can't figure out how to use my proxy correctly.
I've tried ssh -L 3389:myHomeCompy:3389 me@universityAcctCompy on my workComputer, which should take workcomputer port 3389 and send it to myHomeCompy port 3389 through the universityAcctCompy, yes? But when I try "localhost:3389" in RDP that doesn't work (error: The client could not connect. You are already connected to the console of this computer. A new console session cannot be established).
I've also tried (on university computer) ssh -L 3389:myHomeCompy:3389 me@myHomeCompy, and when I try to RDP on my work computer with "universityCompy:3389", (which should try to go to the university, where it then gets sent to my computer using the ssh tunnel), but I get the same error.
Below is the code for the proxy script (.js file) used in my work's browsers. Maybe something is wrong with my putty proxy configuration, or maybe there's something that needs to be changed here (actual IP addresses and ports changed for ID safety).
function ip2int(ip)
{
var iv = ip.split('.');
var rv = (iv[0] &0xff) << 24 | (iv[1] &0xff) << 16 | (iv[2] &0xff) <<8 | (iv[3] &0xff);
return rv;
}
function xisInNet(ip, net, mask)
{
var ip = ip2int(ip);
var net = ip2int(net);
var mask = ip2int(mask);
if ((ip & mask) == (net & mask)) return 1;
return 0;
}
function FindProxyForURL(url, host)
{
me = myIpAddress();
if(dnsDomainIs(host,"fakeName.com")
{
if(isResolvable(host))
return "DIRECT";
else
x = me.substring(me.lastIndexOf('.')+1) % 2;
if (x == 1) return "PROXY 0.0.1.0:1; PROXY 0.0.2.0:1";
return "PROXY 0.0.2.0:1; PROXY 0.0.1.0:1";
};
if ( isPlainHostName(host) ||
shExpMatch( host, "0.*" ))
return "DIRECT";
if (xisInNet(me,"1.0.0.0","255.255.0.0"))
{
x = me.substring(me.lastIndexOf('.')+1) % 2;
if (x == 1) return "PROXY 0.0.42.0:1; PROXY 0.0.10.0:1";
return "PROXY 0.0.10.0:1; PROXY 0.0.42.0:1";
};
if (xisInNet(me,"0.0.0.0","255.255.0.0"))
{
x = me.substring(me.lastIndexOf('.')+1) % 4;
if (x == 1) return "PROXY 0.0.0.11:1; PROXY 0.0.0.14:1";
if (x == 2) return "PROXY 0.0.0.14:1; PROXY 0.0.0.11:1";
if (x == 3) return "PROXY 0.0.0.13:1; PROXY 0.0.0.12:1";
return "PROXY 0.0.0.12:1; PROXY 0.0.0.13:1";
};
x = me.substring(me.lastIndexOf('.')+1) % 2;
if (x == 1) return "PROXY 0.0.1.0:1; PROXY 0.0.2.0:1";
return "PROXY 0.0.2.0:1; PROXY 0.0.1.0:1";
};
What I want to ultimately do is ssh from my work computer like this... ssh -L 3389:myCompy:3389 me@universityCompy. Is this possible? And does this even make any sense?
Thanks in advance for any help.
I want to use ssh, but I'm stuck for a few reasons. I can configure putty to use my work's proxy. This enables me to ssh directly into my university account, but I cannot ssh directly to my home computer (a problem). The port forwarding on my router at home is guaranteed working, since I can ssh into my windows box from my university ssh without a problem.
So far, here's the layout.
WORKS...
work compy <-(ssh through proxy)-> university acct. <-(ssh without any port forwards)-> home
DOESN'T WORK... (but this is what i want)
work compy <-(ssh through proxy)-> home
Everything sound good so far? okay... moving on...
So from here I figured a few ssh port forwards would do the trick. So what I've already tried is using a bunch of "ssh -L" tricks to get anything to work... the problem is is I can't figure out how to use my proxy correctly.
I've tried ssh -L 3389:myHomeCompy:3389 me@universityAcctCompy on my workComputer, which should take workcomputer port 3389 and send it to myHomeCompy port 3389 through the universityAcctCompy, yes? But when I try "localhost:3389" in RDP that doesn't work (error: The client could not connect. You are already connected to the console of this computer. A new console session cannot be established).
I've also tried (on university computer) ssh -L 3389:myHomeCompy:3389 me@myHomeCompy, and when I try to RDP on my work computer with "universityCompy:3389", (which should try to go to the university, where it then gets sent to my computer using the ssh tunnel), but I get the same error.
Below is the code for the proxy script (.js file) used in my work's browsers. Maybe something is wrong with my putty proxy configuration, or maybe there's something that needs to be changed here (actual IP addresses and ports changed for ID safety).
function ip2int(ip)
{
var iv = ip.split('.');
var rv = (iv[0] &0xff) << 24 | (iv[1] &0xff) << 16 | (iv[2] &0xff) <<8 | (iv[3] &0xff);
return rv;
}
function xisInNet(ip, net, mask)
{
var ip = ip2int(ip);
var net = ip2int(net);
var mask = ip2int(mask);
if ((ip & mask) == (net & mask)) return 1;
return 0;
}
function FindProxyForURL(url, host)
{
me = myIpAddress();
if(dnsDomainIs(host,"fakeName.com")
{
if(isResolvable(host))
return "DIRECT";
else
x = me.substring(me.lastIndexOf('.')+1) % 2;
if (x == 1) return "PROXY 0.0.1.0:1; PROXY 0.0.2.0:1";
return "PROXY 0.0.2.0:1; PROXY 0.0.1.0:1";
};
if ( isPlainHostName(host) ||
shExpMatch( host, "0.*" ))
return "DIRECT";
if (xisInNet(me,"1.0.0.0","255.255.0.0"))
{
x = me.substring(me.lastIndexOf('.')+1) % 2;
if (x == 1) return "PROXY 0.0.42.0:1; PROXY 0.0.10.0:1";
return "PROXY 0.0.10.0:1; PROXY 0.0.42.0:1";
};
if (xisInNet(me,"0.0.0.0","255.255.0.0"))
{
x = me.substring(me.lastIndexOf('.')+1) % 4;
if (x == 1) return "PROXY 0.0.0.11:1; PROXY 0.0.0.14:1";
if (x == 2) return "PROXY 0.0.0.14:1; PROXY 0.0.0.11:1";
if (x == 3) return "PROXY 0.0.0.13:1; PROXY 0.0.0.12:1";
return "PROXY 0.0.0.12:1; PROXY 0.0.0.13:1";
};
x = me.substring(me.lastIndexOf('.')+1) % 2;
if (x == 1) return "PROXY 0.0.1.0:1; PROXY 0.0.2.0:1";
return "PROXY 0.0.2.0:1; PROXY 0.0.1.0:1";
};
What I want to ultimately do is ssh from my work computer like this... ssh -L 3389:myCompy:3389 me@universityCompy. Is this possible? And does this even make any sense?
Thanks in advance for any help.