centos7 使用ss和Privoxy 实现命令行访问google
yum -y upgrade
yum install -y epel-release
yum install -y python-pip
#安装完成后需要更新一下
pip install --upgrade pip
#install ss pip install shadowsocks #install privoxy yum install -y privoxy
vim /etc/shadowsocks.json
添加以下内容
{
"server": "156.12.22.29",
"server_port": "55555",
"local_address": "127.0.0.1",
"local_port": "6666",
"password": "service_password",
"method": "aes-256-cfb",
"timeout": "300",
"workers": "1"
}
每个字段解释
vim /etc/privoxy/config # 确认下面这一行没有被注释掉 listen-address 127.0.0.1:8118 ## 默认端口是8118,不需要修改 # 新增一行 forward-socks5t / 127.0.0.1:6666 . ## 端口必须与 /etc/shadowsocks.json 中 local_port 字段的值相同, ## 注意:行尾有一个英文句号(.)
# 以 daemon 模式启动
[root@centos-linux ~]# sslocal -c /etc/shadowsocks.json -d start
INFO: loading config from /etc/shadowsocks.json
2019-02-26 23:30:12 INFO loading libcrypto from libcrypto.so.10
started
# 确认 sslocal 已监听在预设端口 lsof -i | grep sslocal
[root@centos-linux ~]# lsof -i | grep sslocal
sslocal 24367 root 4u IPv4 53001198 0t0 TCP localhost:ircu-2 (LISTEN)
sslocal 24367 root 5u IPv4 53001199 0t0 UDP localhost:ircu-2
[root@centos-linux ~]# curl --socks5 127.0.0.1:6666 http://httpbin.org/ip
{
"origin": "156.12.22.29, 156.12.22.29" # 注意 :: 必须与 /etc/shadowsocks.json 中 server 字段的值相同
}
systemctl start privoxy
[root@centos-linux ~]# curl --proxy https://127.0.0.1:8118 -Is https://google.com | grep -w 200 HTTP/1.1 200 Connection established
sh -c 'echo "sudo /usr/bin/sslocal -c /etc/shadowsocks.json -d start" >> /etc/rc.d/rc.local' # 如果 rc.local 没有可执行权限就给它加上 systemctl enable privoxy
#启用代理 export http_proxy='127.0.0.1:8118' export https_proxy='127.0.0.1:8118' # 停用代理 export http_proxy='' export https_proxy=''
curl -I https://golang.org/ #执行命令后出现如下信息,说明成功 [root@centos-linux ~]# curl -I https://golang.org/ HTTP/1.1 200 Connection established HTTP/1.1 200 OK Date: Tue, 26 Feb 2019 15:41:47 GMT Content-Type: text/html; charset=utf-8 Vary: Accept-Encoding Strict-Transport-Security: max-age=31536000; includeSubDomains; preload Via: 1.1 google Transfer-Encoding: chunked Alt-Svc: quic=":443"; ma=2592000; v="44,43,39"
#创建文件 /etc/profile.d/vm-proxy.sh,文件内容如下
[root@centos-linux ~]# cat /etc/profile.d/vm-proxy.sh
function cmd-proxy-on {
export no_proxy="127.0.0.1,localhost,localaddress,.localdomain.com,tencentyun.com";
export http_proxy='127.0.0.1:8118';
export https_proxy=$http_proxy;
echo 'HTTP proxy started.'
}
export -f cmd-proxy-on
# 第二种声明函数的方式
cmd-proxy-off() {
unset http_proxy;
unset https_proxy;
echo 'HTTP proxy stopped.'
}
export -f cmd-proxy-off
#source 脚本 chmod +x /etc/profile.d/vm-proxy.sh source /etc/profile.d/vm-proxy.sh
[root@centos-linux ~]# vim /etc/profile.d/vm-proxy.sh [root@centos-linux ~]# chmod +x /etc/profile.d/vm-proxy.sh [root@centos-linux ~]# source /etc/profile.d/vm-proxy.sh [root@centos-linux ~]# cmd-proxy-on HTTP proxy started. [root@centos-linux ~]# curl -I https://golang.org/ HTTP/1.1 200 Connection established HTTP/1.1 200 OK Date: Tue, 26 Feb 2019 15:47:18 GMT Content-Type: text/html; charset=utf-8 Vary: Accept-Encoding Strict-Transport-Security: max-age=31536000; includeSubDomains; preload Via: 1.1 google Transfer-Encoding: chunked Alt-Svc: quic=":443"; ma=2592000; v="44,43,39" [root@centos-linux ~]# cmd-proxy-off HTTP proxy stopped. [root@centos-linux ~]# curl -I https://golang.org/ curl: (7) Failed connect to golang.org:443; 拒绝连接
centos7 使用ss和Privoxy 实现命令行访问google的更多相关文章
- 使用 grpcurl 通过命令行访问 gRPC 服务
原文链接: 使用 grpcurl 通过命令行访问 gRPC 服务 一般情况下测试 gRPC 服务,都是通过客户端来直接请求服务端.如果客户端还没准备好的话,也可以使用 BloomRPC 这样的 GUI ...
- Centos7修改默认启动级别(命令行,图形切换)
方法一: 终端输入以下命令 修改为命令行方式 systemctl set-default multi-user.target 修改为图形界面 systemctl set-default graphic ...
- centos7更改为启动桌面或命令行模式
进入cenos7的命令行模式 终端输入“init 3”回车进入命令行模式 登录成功后 # systemctl get-default //获取当前系统启动模式 查看配置文件 # cat /etc/in ...
- Linux命令行访问网页
找到个好资料,备份行: http://hi.baidu.com/oyvfhp/blog/item/3aa5ced5b40563d351da4bb0.html CURL --- 命令行浏览器 这东西 ...
- Node.js(window)基础(1)——用cmd命令行访问某一文件夹下的js文件
一.安装,从官网上下载安装,安装基本一直点击下一步就行.注意:node.js基于Python的,安装node.js之前电脑上要安装Python,最好是Python2.7或2.6. 二.cmd进入命令行 ...
- 强悍的 ubuntu —— 命令行访问网页
所谓以命令行的方式访问网页,即是在终端下以文本的形式访问网站,这里推荐一个工具:w3m, $ sudo apt-get install w3m $ w3m www.baidu.com
- thinkphp5命令行访问
入口文件后加一个空格就行了 1,首先cd到站点目录public下,我的入口文件是默认的index.php,然后执行以下命令, 2,php要加入环境变量 访问index模块下的index控制器下的tes ...
- 命令行访问远程mysql数据库
命令: mysql -u用户名 -p密码 -h远程数据库IP地址 -P端口 -D数据库名 例子: 使用用root帐号,密码为123456,登录ip地址为192.168.1.110,端口为3306,名称 ...
- Ubuntu下命令行访问网站
第一步,需要安装一个名为w3m的软件工具,打开终端,输入如下命令 sudo apt-get install w3m 第二步,安装好w3m之后,在终端里面启动w3m,打开一个网址,比如w3m www ...
随机推荐
- Tomcat 控制台出现乱码
本地在启动tomcat时,控制台启动显示乱码 这是因为windows默认编码集为GBK,用startup.bat启动tomcat时,它会读取catalina.bat的代码并打开一个新窗口运行,打开的c ...
- LeetCode 102. Binary Tree Level Order Traversal 二叉树的层次遍历 C++
Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, ...
- mvc后台上传
public ActionResult AddEnclosure(HttpPostedFileBase Filedata) { if (Filedata == null || string.IsNul ...
- 视频剪辑软件调研:Adobe Premiere、会声会影、抖音短视频
Adobe Premiere.会声会影.抖音短视频基本功能特点对比: 特点 Adobe Premiere 会声会影 抖音短视频 运行平台 Win7/Win8/Win10.macOS Win7/Win ...
- ios模拟器命令
xcrun simctl list //显示模拟器列表 xcrun simctl boot [模拟器id] //启动模拟器
- mybatis查询如何返回List<Map>类型数据
只要设定resultType而不设定resultMap就可以了: <selectid="selectByPage"parameterType="java.uti ...
- netcore 下加密遇到的问题
KeyedHashAlgorithm algorithm = KeyedHashAlgorithm.Create(algorithmName.ToString().ToUpper(CultureInf ...
- Spring Boot与Docker部署
开启Docker远程访问 首先需要开启docker远程访问功能,以便可以进行远程操作. CentOS 6 修改/etc/default/docker文件,重启后生效(service docker re ...
- echars 图表提示框自定义显示
一 . 显示单条数据时在tooltip里调用formatter函数给自定义提示框内数据. 效果图显示 二 . 当显示多条数据时.为保证和原来的效果相同需要自己实现点的效果.如果不实现,提示框则不限点的 ...
- C/C++控制台接收不到鼠标消息-【解决办法】
控制台编程中,使用了鼠标操作,遇到了控制台无法接收到鼠标消息的问题,可尝试一下办法解决 [win10系统] 在控制台标题栏右键-默认值-选项,将一下对勾取消 然后调用如下函数: HANDLE hIn ...