0

I have two servers: A and B.

Server A is my main server which hosts my website (in my country). Server B is a server in the US.

I have limit to connect to some websites via server A, so I want to create a tunnel or proxy (not sure which one is suitable) from A to B, so that, sending request from A to blocked-site.com is proxied to B. So:

server A proxies request to B
server B sends request to blocked-site.com
the website answers to B
B answers to A

I tried this command:

ssh -vL 1080:blocked-site.com:1080 root@server-b

Bit when I run nslookup blocked-site.com I do not get any answers.

1 Answer 1

0

The command ssh -vL 1080:blocked-site.com:1080 root@server-b will create a local port 1080 that will be tunneled to blocked-site.com:1080. With this tunnel you can access blocked-site.com:1080 using localhost:1080. So to be able to access blocked-site.com:1080 you have to replace blocked-site.com:1080 by localhost:1080 (e.g. telnet localhost:1080).

nslookup does not know that localhost:1080 is tunneled to blocked-site.com:1080 so it still tries to directly access blocked-site.com:1080

Take into account that the set up tunnel only works if server B allows it. Because this is a security risk this is not always (usually) not the case.

One way to be able to access blocked-site.com:1080 without changing the client call is (assuming server A is a Linux machine):

Add the following line to /etc/hosts:

127.0.0.2 blocked-site.com

Even with the above line added to /etc/hosts nslookup will still not work, but you will see that ping blocked-site.com will now ping 127.0.0.2.

The reason that the nslookup will not be effected by the set up SSH tunnel is that nslookup sends a request to the DNS server using UDP port 53 while localhost TCP port 1080 is tunneled.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .