目前国内gfw越来越严格的形势下, 翻q最稳定的还是socks协议了,然而在ubuntu下,一般用代理的地方是浏览器,但有时候命令行中也需要连google服务器.但ubuntu下我没找到能设置全局socks代理的地方,就想着怎么单独解决命令行下使用socks代理的问题.后来发现了一个命令socksify,有同样问题的可以试试.
安装
sudo apt-get install dante-client配置 /etc/dante.conf , 主要是下面这段去掉注释改一下
# IP address 10.1.1.1, port 1080. Note that unless you have
# specified a direct connection for DNS, or the socksserver is resolvable
# without network traffic, you can't give a hostname for the socksserver,
# you must give a IP address. (the reasons for that are logical enough,
# you would create a loop otherwise.)
route {
from: 0.0.0.0/0 to: 0.0.0.0/0 via: 127.0.0.1 port = 1080
protocol: tcp udp # server supports tcp and udp.
proxyprotocol: socks_v4 socks_v5 # server supports socks v4 and v5.
method: none #username # we are willing to authenticate via
# method "none", not "username".
}
- 配置~/.ssh/config
Host lxxxxxw.com #这里和下一行换成自己vps的域名和ip
Hostname 131.122.221.226
Compression yes
ConnectTimeout 10
DynamicForward 127.0.0.1:1080
+ 使用,和sudo类似的用法,在要用的命令前加socksify就行,(当然,本地用来连接远程的代理得先打开哦)比如
socksify curl https://twitter.com/