Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

So, I want to visit a website that only permits access to computers from certain ip domains. My ip is not from one of the allowed domains, but I've ssh'd into a (linux) machine at another location that is at one of the allowed domains.

How do I launch a web browser on my local machine that visits websites through the ip of the remote machine?

share|improve this question

2 Answers 2

up vote 3 down vote accepted

The SSH tunneling in Clemens' answer will work for one specific website, with caveats... if the site does virtual hosting, where the content depends on your HTTP request pointing at a specific hostname, simple port tunneling won't work. And it will only get you to the one site.

A more robust solution is to use OpenSSH dynamic port forwarding. The command would be:

ssh -D 1080 ssh-server.example.com

Next, set the browser on your client to use a SOCKS proxy at 127.0.0.1, port 1080.

Now, regardless of which site you're visiting, all of your browsing activity (including DNS lookups) will use the remote server.

More detail is here: SSH/OpenSSH/PortForwarding: Dynamic Port Forwarding

If you need to switch frequently between browsing normally and browsing through the remote SSH server, look into installing a plugin for your browser to do fast proxy switching. There are a lot of them.

share|improve this answer

You can use SSH tunneling to build a TCP tunnel from your Client to the SSH server and route your traffic through this tunnel.

If your private IP on the SSH server Side that you want to access is 192.0.2.1 and your ssh server is ssh.example.com, you can use a SSH command like this:

ssh -L 8080:192.0.2.1:80 ssh.example.com

When this ssh connection is established you can point your local browser to http://localhost:8080 and you should see the page that you would have seen when browsing to http://192.0.2.1 in the private net.

share|improve this answer
    
So if I wanted to go to http://www.google.com in my browser but (hypothetically) Google only lets people go to that page if they have an IP from example.com, I'd ssh into the computer I know at example.com, log in, then use the ssh command in your answer, open my browser, and go to http://www.google.com? –  Alexander Nikolas Gruber Jun 15 '13 at 22:10
    
not exactly, you connect to example.com with the command above. Then you would point your browser to http://localhost:8080. But I think the solution provided by Steven is better. I didn't know about this. –  Clemens Bergmann Jun 16 '13 at 5:27

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.