红联Linux门户
Linux帮助

Ubuntu 16.04通过proxychains让命令行实现Socks代理联网

发布时间:2017-06-20 15:07:11来源:linux网站作者:embedded online
当Ubuntu配置好代理之后,你会发现虽然浏览器可以正常畅游,但是命令行却无法自由,这个时候就需要配置命令行支持畅游,让命令行实现Socks代理,这里用的socks代理是shadowsocks,所以配置前提是已经正常安装配置Shadowsocks的服务器和客户端。
 
安装proxychains
sudo apt install proxychains
 
配置proxychains
sudo vim /etc/proxychains.conf
##################################
strict_chain
proxy_dns
remote_dns_subnet 224
tcp_read_time_out 15000
tcp_connect_time_out 8000
localnet 127.0.0.0/255.0.0.0
quiet_mode
[ProxyList]
socks5 192.168.1.4 1080
注意:192.168.1.4是shadowsocks的客户端的IP地址,1080是端口号
 
使用方法
单条命令使用proxychains
proxychains wget http://www.google.com
 
测试结果:
jun@ubuntu:~$ proxychains wget http://www.google.com
ProxyChains-3.1 (http://proxychains.sf.net)
–2017-06-19 08:55:18– http://www.google.com/
Resolving www.google.com (www.google.com)… 74.125.203.104
Connecting to www.google.com (www.google.com)|74.125.203.104|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: unspecified [text/html]
Saving to: ‘index.html’
index.html [ <=> ] 11.43K –.-KB/s in 0s
2017-06-19 08:55:19 (146 MB/s) - ‘index.html’ saved [11707]
 
代理Bash,所有在这个终端的命令都走proxychins
proxychains bash
 
测试结果:
jun@ubuntu:~/w3m-0.5.3$ proxychains bash
ProxyChains-3.1 (http://proxychains.sf.net)
jun@ubuntu:~/w3m-0.5.3$ wget https://www.google.com
–2017-06-19 08:58:36– https://www.google.com/
Resolving www.google.com (www.google.com)… 108.177.97.103
Connecting to www.google.com (www.google.com)|108.177.97.103|:443… connected.
HTTP request sent, awaiting response… 200 OK
Length: unspecified [text/html]
Saving to: ‘index.html’
index.html [ <=> ] 10.14K –.-KB/s in 0s
2017-06-19 08:58:38 (64.7 MB/s) - ‘index.html’ saved [10388]
 
本文永久更新地址:http://www.linuxdiyf.com/linux/31618.html