Linux 使用 V2ray 作为客户端
一、下载V2ray
在这里下载适合系统的压缩包,并解压到 ~path/v2ray 文件夹中。
wget https://github.com/v2ray/v2ray-core/releases/download/v4.28.2/v2ray-linux-64.zip
解压后的目录:
[root@k8s-master v2ray]# pwd
/opt/modules/v2ray
[root@k8s-master v2ray]# ls -l
总用量 33560
-rw-r--r--. 1 root root 4221 1月 1 2010 config.json
-rw-r--r--. 1 root root 5108110 1月 1 2010 geoip.dat
-rw-r--r--. 1 root root 907782 1月 1 2010 geosite.dat
drwxr-xr-x. 3 root root 20 1月 1 2010 systemd
-r-xr-xr-x. 1 root root 11669504 1月 1 2010 v2ctl
-r-xr-xr-x. 1 root root 0 1月 1 2010 v2ctl.sig
-r-xr-xr-x. 1 root root 16658432 1月 1 2010 v2ray
-r-xr-xr-x. 1 root root 0 1月 1 2010 v2ray.sig
-rw-r--r--. 1 root root 391 1月 1 2010 vpoint_socks_vmess.json
-rw-r--r--. 1 root root 537 1月 1 2010 vpoint_vmess_freedom.json
[root@k8s-master v2ray]#
二、配置config.json文件
V2Ray采用的Vmess协议下, 客户端要能连上服务器必须设置与服务器一致的配置, 并且系统时间与服务器时间差不能超过一分钟。此前在网上直接找到的配置文件与我的服务提供方配置不完全一致, 所以直接借用是无法联通的。这篇文章2中提到了一个巧妙的方法:
复制windows下的配置文件到Linux下。
Windows下的配置文件为软件根目录下的config.json文件。
Windows下的config.json配置文件,将windows下对应的同名配置文件内容复制替换Linux下的配置文件内容即可。
config.json
文件:
{
"log": {
"access": "",
"error": "",
"loglevel": "warning"
},
"inbounds": [
{
"tag": "socks",
"port": 10808,
"listen": "127.0.0.1",
"protocol": "socks",
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
},
"settings": {
"auth": "noauth",
"udp": true,
"allowTransparent": false
}
},
{
"tag": "http",
"port": 10809,
"listen": "127.0.0.1",
"protocol": "http",
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
},
"settings": {
"udp": false,
"allowTransparent": false
}
}
],
"outbounds": [
{
"tag": "proxy",
"protocol": "trojan",
"settings": {
"servers": [
{
"address": "www.zhmxxxxxxxxxxxxxxxxx",
"method": "chacha20",
"ota": false,
"password": "haohaoxxxxxxxxxxxxxxx",
"port": 443,
"level": 1
}
]
},
"streamSettings": {
"network": "tcp",
"security": "tls",
"tlsSettings": {
"allowInsecure": false
}
},
"mux": {
"enabled": false,
"concurrency": -1
}
},
{
"tag": "direct",
"protocol": "freedom",
"settings": {}
},
{
"tag": "block",
"protocol": "blackhole",
"settings": {
"response": {
"type": "http"
}
}
}
],
"routing": {
"domainStrategy": "IPIfNonMatch",
"rules": [
{
"type": "field",
"inboundTag": [
"api"
],
"outboundTag": "api"
},
{
"type": "field",
"outboundTag": "proxy",
"domain": [
"geosite:google"
]
},
{
"type": "field",
"outboundTag": "direct",
"domain": [
"domain:example-example.com",
"domain:example-example2.com"
]
},
{
"type": "field",
"outboundTag": "block",
"domain": [
"geosite:category-ads-all"
]
},
{
"type": "field",
"outboundTag": "direct",
"domain": [
"domain:example-example.com",
"domain:example-example2.com"
]
},
{
"type": "field",
"outboundTag": "block",
"domain": [
"geosite:category-ads-all"
]
},
{
"type": "field",
"outboundTag": "direct",
"domain": [
"geosite:cn"
]
},
{
"type": "field",
"outboundTag": "direct",
"ip": [
"geoip:private",
"geoip:cn"
]
},
{
"type": "field",
"port": "0-65535",
"outboundTag": "proxy"
}
]
}
}
相关文章:
V2Ray Ubuntu/Linux Mint 客户端
linux使用v2ray作为客户端
为者常成,行者常至
自由转载-非商用-非衍生-保持署名(创意共享3.0许可证)