linux使用代理

文章目录
  1. 1. 下载v2ray的安装包
  2. 2. 解压安装包
  3. 3. 修改配置文件(最好直接在其他机器上生成一份)
  4. 4. 执行脚本启动服务
  5. 5. 实现开机启动
  6. 6. 使用deepin自带的代理工具进行上网
  7. 7. 使用switchyomega插件上网
  8. 8. 完结撒花

下载v2ray的安装包

因为是正常软件使用,发布的版本基本上是很稳定的,所以可以下载最新发布版本,地址:https://github.com/v2ray/v2ray-core/releases

下载linux版本:v2ray-linux-64.zip

1
wget https://github.com/v2ray/v2ray-core/releases/download/v4.28.2/v2ray-linux-64.zip

解压安装包

1
2
unzip v2ray-linux-64.zip
cd v2ray

修改配置文件(最好直接在其他机器上生成一份)

修改里面的配置文件:config.json

主要修改outbounds节点下面的settings节点下面的vnext节点配置,这个相当于要连接到远端的配置。

还有一个要看的是inbounds节点下的配置,这个相当于在本地开启的端口,如果使用代理工具的话,可以直接连接到本地的这个端口,实现上网。

比较重要的就是上面的两个节点配置。其他的默认就可以。

下面我贴上我正在使用的配置文件,目前还是可以使用的。2020年03月18日21:29:50

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
{
"policy": null,
"log": {
"access": "",
"error": "",
"loglevel": "warning"
},
"inbounds": [
{
"tag": "proxy",
"port": 10808,
"listen": "127.0.0.1",
"protocol": "socks",
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
},
"settings": {
"auth": "noauth",
"udp": true,
"ip": null,
"address": null,
"clients": null
},
"streamSettings": null
}
],
"outbounds": [
{
"tag": "proxy",
"protocol": "vmess",
"settings": {
"vnext": [
{
"address": "23.225.57.210",
"port": 443,
"users": [
{
"id": "418048af-a293-4b99-9b0c-98ca3580dd23",
"alterId": 64,
"email": "t@t.tt",
"security": "auto"
}
]
}
],
"servers": null,
"response": null
},
"streamSettings": {
"network": "ws",
"security": "tls",
"tlsSettings": {
"allowInsecure": true,
"serverName": "www.2604919.xyz"
},
"tcpSettings": null,
"kcpSettings": null,
"wsSettings": {
"connectionReuse": true,
"path": "/footers",
"headers": {
"Host": "www.2604919.xyz"
}
},
"httpSettings": null,
"quicSettings": null
},
"mux": {
"enabled": true,
"concurrency": 8
}
},
{
"tag": "direct",
"protocol": "freedom",
"settings": {
"vnext": null,
"servers": null,
"response": null
},
"streamSettings": null,
"mux": null
},
{
"tag": "block",
"protocol": "blackhole",
"settings": {
"vnext": null,
"servers": null,
"response": {
"type": "http"
}
},
"streamSettings": null,
"mux": null
}
],
"stats": null,
"api": null,
"dns": null,
"routing": {
"domainStrategy": "IPIfNonMatch",
"rules": [
{
"type": "field",
"port": null,
"inboundTag": [
"api"
],
"outboundTag": "api",
"ip": null,
"domain": null
}
]
}
}

执行脚本启动服务

1
./v2ray

实现开机启动

这边我是按照自己的目录来的,读者可以按照自己的软件目录配置:

1
2
3
4
# 这里配置的是当前登录用户的脚本,如果想全局开启,可以放到/etc/profile
echo "nohup /root/v2ray/v2ray > /dev/null 2>&1 &" >> ~/.bashrc
# 使配置生效
source ~/.bashrc

命令行代理:

1
2
3
4
5
6
7
8
9
10
11
vi /etc/profile

# 添加如下代理脚本
alias proxy='export all_proxy=socks5://127.0.0.1:1080 https_proxy=http://127.0.0.1:1081 http_proxy=http://127.0.0.1:1081'
alias unproxy='unset all_proxy https_proxy http_proxy'

# 开启代理
source /etc/profile

# 检查是否生效
curl cip.cc

命令行想走代理的时候,直接使用proxy开启。不用可以使用unproxy关闭

使用deepin自带的代理工具进行上网

设置-》网络-》系统代理-》手动-》然后根据上面我们配置的inbounds中的配置来进行配置,主要看协议和端口-》点击确定完成

使用switchyomega插件上网

首先需要自己想办法下载一个离线版的switchyomega插件,或者在可以上外网的情况下去应用商店下载该插件。

然后配置插件:

  • 选项-》proxy-》配置inbounds中的ip、端口、协议-》点左边的应用选项
  • auto switch-》选中规则列表规则-》情景模式选择proxy-》默认情景模式选择直连模式-》规则列表设置选择autoproxy-》规则列表网址填https://raw.githubusercontent.com/gfwlist/gfwlist/master/gfwlist.txt-》立即更新情景模式-》点左边的应用选项

完结撒花