利用Putty建立SSH通道实现socket5代理

利用Putty建立SSH通道实现socket5代理设置putty很简单,打开putty,找到左边的SSH,选择Tunnels,然后在Source port上填入你想要的端口号,然后Add一下,下面选择Dynamic即可。现在你机

利用Putty建立SSH通道实现socket5代理

设置putty

很简单,打开putty,找到左边的SSH,选择Tunnels,然后在Source port上填入你想要的端口号,然后Add一下,下面选择Dynamic即可。现在你机器的127.0.0.1:端口号(例如:127.0.0.1:9999)就是代理服务器了,你通过putty登录到远程服务器的时候,浏览器就可以通过这个代理上网。



设置FireFox

工具-->选项-->高级-->网络,在SOCKS主机填入本机的IP以及刚才设置的代理端口号即可。

这样设置之后,大部分的国外网站都可以访问了,但是Facebook和Twitter等还不行,在Firefox的地址栏输入about:config ,找到network.proxy.socks_remote_dns,双击改成true即可。

该选项是使用远程代理服务器来解析DNS,避免DNS欺骗。


====================================


Using Firefox with a Putty SSH tunnel as a SOCKS proxy

The reason I wanted to do this one was viewing a site from an American IP address rather than an Australian. I tested this on my Bluehost account, and it worked perfectly. Here are the instructions:

1. Work out how to connect to your server. You’ll need Putty (available at http://www.chiark.greenend.org.uk/~sgtatham/putty/) – from the Session screen, put in your hostname, most likely port 22 for SSH, make sure SSH is selected as the connection type and click ‘Open’ at the bottom of the screen. If you can log in to that, then the SSH component works and you’re good to go for the rest of this.

2. From Putty, go down to Connection > SSH > Tunnels. From this area, add in a source port (I’ve chosen 9870 but this can be any unused port), and choose ‘Dynamic’. Then click ‘Add’ and you’ll get an entry under “Forwarded Ports”:


3. Go back to Session and connect to SSH. You can save your session to load later rather than retyping the details:

putty2
4. Click “Open” and log onto your SSH session. You only need to log on with your credentials and get to a bash prompt.

5. Open Firefox, and go to the website http://whatismyip.com – take note of your external IP address, because this should change once you’re tunnelling through SSH.

6. In Firefox, press the ‘alt’ key to bring up the top menu and go into Tools > Options. Under the “Advanced” area, go to the “Network” tab and in the “Connection” area click the “Settings” button.

firefox17. Choose the “Manual proxy configuration” radio button, and under SOCKS Host enter “127.0.0.1” and the port you entered into Putty (in my case it’s 9870). Make sure SOCKS v5 is selected.

firefox2

8. Press OK twice to get back to the main view of the Firefox Browser. Try again to get to http://whatismyip.com – if all is working, you’ll see a different IP address which is from the server you’re SSH’d to. If something isn’t configured correctly, you’ll more likely see a browser error like “The proxy server is refusing connections”.

That’s it! Handy for Australians to get access to different web content and pricing.

Update: BobGrrl on twitter has mentioned another two options, free but requiring someone you know to help you at the other end. http://openvpn.net is where you can get it, so a good free opensource solution pending you’re nice enough to someone in another country!

If you want to do this with BlueHost yourself, sign up here:

There’s a bunch of other stuff you get, not just proxy access :)

Update 19/11/2013: This has been tested under Windows 8.1 and worked perfectly. If you do any of the above settings wrong (like putting in 127.0.0.1 as your HTTP proxy rather than SOCKS Host) it probably won’t work. Also make sure your forwarded port from the very first step is still there, if you close putty and re-open it may not remember those settings.



相关推荐

[!--temp.pl--]