原文:

https://thomashunter.name/blog/really-simple-ssh-proxy-socks5/

SOCKS5 is a simple, eloquent method for getting yourself a proxified connection to the internet. All you need to get a proxy connection working is to run an SSH server somewhere, run a single command locally, and configure your software (or OS) to use this proxy. Why would you want to run a proxy? Well, all traffic sent between your client machine (e.g. a wireless laptop at a coffee shop), and the remote machine (e.g. your home server located on your trusted network) will be encrypted. Also, your external IP address will be that of the SSH server, which can be useful for various other reasons.

For this tutorial I will show screenshots for setting up an OS level proxy in OS X. Linux should have some similar GUI tools involved, or you can always configure it on the command line. I’m not sure if Windows has similar tools. I’m assuming you are familiar with networking basics and have a linux server setup with internet connectivity.

The first thing you will need to do is install an SSH daemon on your Linux server. Depending on your OS, it is usually as simple as running the following command (most distro’s allow all normal users SSH access by default, save for the root user).

sudo apt-get install sshd

You’ll also need to have port forwarding setup for the SSH port (22) so that external requests to this port are forwarded to your server. I can’t show you how to do that though since I don’t know how your router works!

Next, you’ll need to run the following command on your client machine. What the command does it executes SSH as a background process, and sets up port 1080 to listen locally for connection requests (you can change that number). It also doesn’t display errors if there are any (useful for running automatically when you login to your client). It will prompt you for a username and password though… What you should do is setup your client and server to authenticate without a password, this will make your life a lot easier and allow the command to be executed without your intervention.

ssh -D 1080 -f -C -q -N -p 22 username@servername

Easy, huh? You can now configure software to connect to a SOCKS5 proxy at localhost:1080. If you browse toip.thomashunter.name both before and after running this, you should see that your external IP address will change.

You may be wondering how to do that last part… I’ll now show you a bunch of screenshots for enabling this on the OS level using Apple OS X’s network manager.

OS X: Enabling SOCKS5 Proxy

First, open up OS X’s system preferences. You can usually do this by hitting Cmd + Space, and typing Preferences and pressing enter.

OS X System Preferences

Next, click the Network icon under Internet & Wireless. You will see a bunch of tabs, click the one titled Proxies.

Network Proxy Settings in OS X

Now, enable the SOCKS5 Proxy option. This will bring up the configuration settings to the right. You’ll want to enter localhost for the server name and 1080 for the port number. You won’t need to use a username or password with this proxy so leave them blank (the authentication happened earlier with the command we executed).

Network Proxy Settings in OS X

You can enable the Exclude simple hostnames option if you plan on doing anything regarding other machines on the local network (local to the client). This is so that if you want to access a machine by it’s DNS name, the proxy doesn’t steal that request. This is useful if you want to do work at a corporate office, for example.

Really simple SSH proxy (SOCKS5)的更多相关文章

  1. How to write simple HTTP proxy with Boost.Asio

    How to write simple HTTP proxy with Boost.Asio How to write simple HTTP proxy with Boost.Asio Russia ...

  2. SSH proxy

    # for Linux ssh nobody@guoliangwu.com -P 22 -C -N -D 127.0.0.1:6500 # for windows(PuTTY) plink nobod ...

  3. openshif ssh proxy

    最近google又被墙了.没办法 1:注册一个openshift账号.申请注册一个app,获取一个免费主机.   https://www.openshift.com/ 2:去PuTTY官方网站下载pL ...

  4. ssh proxy配置

    在.ssh目录下新建config文件,并添加以下内容: Host 10.100.101.123 ProxyCommand=nc -X 5 -x [proxyip:proxyport] %h %p

  5. github配置SSH proxy

    在windows users 用户目录下生成config文件,如在C:\Users\your_user_name\.ssh 目录下,找到config文件,如果没有新建一个,写入如下内容: Host g ...

  6. Setup a Simple HTTP Proxy Server

    The host 10.21.3.69 has no H3C client, so it can't access the internet. With Tinyproxy, we can setuu ...

  7. Turn any Linux computer into SOCKS5 proxy in one command

    src: http://www.catonmat.net/blog/linux-socks5-proxy/ I thought I'd do a shorter article on catonmat ...

  8. Socks5代理Socks5 Proxy

    Socks5代理Socks5 Proxy   Socks5代理是基于Socks协议的一种代理模式.其中,5表示该协议的版本号.它可以让局域网的计算机通过socks5代理服务器,访问外网的内容.由于它工 ...

  9. How to Setup a Private Proxy Server on EC2 in Under 10 Minutes

    How to Setup a Private Proxy Server on EC2 in Under 10 Minutes I’ve been slacking a bit with regular ...

随机推荐

  1. expect的安装与使用

    expect的安装与使用 是什么 expect 是用来进行自动化控制和测试的工具.主要是和交互式软件telnet ftp ssh 等进行自动化的交互. 如何安装 1.检测是否安装 ls /usr/bi ...

  2. java nio的一个严重BUG

    java nio的一个严重BUG Posted on 2009-09-28 19:27 dennis 阅读(4588) 评论(5)  编辑  收藏 所属分类: java .源码解读      这个BU ...

  3. IOS中延时执行方式

    本文列举了四种延时执行某函数的方法及其一些区别.假如延时1秒时间执行下面的方法. - (void)delayMethod { NSLog(@"execute"); } 1.perf ...

  4. [Selenium] 操作 HTML5 中的 Canvas 绘制图形

    测试 http://literallycanvas.com/ 以 Chrome Driver 为例阐述,通过 Actions 在 Canvas 上绘制一个封闭图形.对于 Canvas 上的操作,推荐 ...

  5. NFS (网络文件系统)

    NFS (网络文件系统) https://www.cnblogs.com/wahaha02/p/9559345.html Linux网络文件系统的实现与调试 NFS协议 NFS (网络文件系统)不是传 ...

  6. COCOS2DX场景切换特效

    cocos2d-x 3.0中场景切换特效比较多,而且游戏开发中也经常需要用到这些特效,来使场景切换时不至于那么干巴,遂这里汇总一下,开发中使用. 百牛信息技术bainiu.ltd整理发布于博客园 场景 ...

  7. DebugView 使用

    最近遇到带加密狗的工程项目,无法使用控制台调试,尝试使用DebugView进行辅助调试. DebugView是一个系统调试信息输出的捕获工具,可以捕获程序中由TRACE(debug版本)和Output ...

  8. eclipse快捷键设置

    文章斋词水电费 55 48 Eclipse中10个最有用的快捷键组合  一个Eclipse骨灰级开发者总结了他认为最有用但又不太为人所知的快捷键组合.通过这些组合可以更加容易的浏览源代码,使得整体的开 ...

  9. 爱奇艺面试Python,竟然挂在第5轮……

    今天给大家分享我曾经在爱奇艺的面试,过程还是比较有意思的,可以给大家一些参考 聊骚阶段 嗲妹妹:你好,我是爱奇艺的HR,我们正在招聘运维开发岗位,请问您最近有在看工作机会吗? 我:(这声音也太酥了吧我 ...

  10. ObjectARX学习笔记

    http://blog.csdn.net/jangdong/article/category/1642265/3 http://blog.csdn.net/u011331383/article/cat ...