v2ray-core
v2ray-core client proxy run
Ubuntu-24.04 配置v2ray-core 客户端代理上网
默认已经配置好,一键配置v2ray服务器 (注意更新最新,服务器、客户端以及配置文件格式)
1、下载 v2ray-linux-arm64-v8a.zip
https://github.com/v2fly/v2ray-core/releases/tag/v5.47.0
https://github.com/v2fly/v2ray-core
GitHub – v2fly/v2ray-core: A platform for building proxies to bypass network restrictions. · GitHub
2、配置文件config.json,
cd /usr/local/etc/v2ray
nano config.jscon
或直接编辑配置文件
sudo nano /usr/local/etc/v2ray/config.json
config.json编辑内容如下:
{
"log": {
"loglevel": "warning"
},
"inbounds": [
{
"port": 10808,
"listen": "0.0.0.0",
"protocol": "socks",
"settings": {
"auth": "noauth",
"udp": true
}
},
{
"port": 10809,
"listen": "0.0.0.0",
"protocol": "http",
"settings": {}
}
],
"outbounds": [
{
"protocol": "trojan",
"settings": {
"servers": [
{
"address": "v2ray.XXXXX.com",
"port": 443,
"password": "del password"
}
]
},
"streamSettings": {
"network": "ws",
"security": "tls",
"tlsSettings": {
"serverName": "v2ray.XXXXX.com",
"allowInsecure": false
},
"wsSettings": {
"path": "/efe51121-4350-4872-a443-dbb61f488c77"
}
}
}
]
}
3、v2ray、ip规则文件 把下列文件复制到 /usr/local/bin
geosite.dat
geoip.dat
geoip.metadb
geoip-only-cn-private.dat
v2ray
cd /usr/local/bin
4、系统自动启动服务文件
cd /etc/systemd/system/
sudo nano /etc/systemd/system/v2ray.service
[Unit]
Description=V2Ray Service
Documentation=https://www.v2fly.org/
After=network.target nss-lookup.target
[Service]
User=nobody
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
NoNewPrivileges=true
ExecStart=/usr/local/bin/v2ray run -config /usr/local/etc/v2ray/config.json
Restart=on-failure
RestartPreventExitStatus=23
[Install]
WantedBy=multi-user.target
5、v2ray 运行 及查看报错
sudo systemctl daemon-reload
sudo systemctl enable v2ray
sudo systemctl status v2ray
sudo journalctl -u v2ray -n 30 –no-pager
第一步:查看完整报错信息(最关键!)
6、下载Google chrome 浏览器proxy插件
SwitchyOmega (V3)
Google chrome 浏览器开启 develop模式,直接拖 ***.CRX插件到浏览器中
三、全局代理命令配置,局部代理,取消代理详细配置如下
1、临时生效(当前终端)
export all_proxy=socks5h://127.0.0.1:10808
export HTTP_PROXY=socks5h://127.0.0.1:10808
export HTTPS_PROXY=socks5h://127.0.0.1:10808
export http_proxy=socks5h://127.0.0.1:10808
export https_proxy=socks5h://127.0.0.1:10808
2、临时生效
export all_proxy=socks5h://127.0.0.1:10808 HTTP_PROXY=socks5h://127.0.0.1:10808 HTTPS_PROXY=socks5h://127.0.0.1:10808 http_proxy=socks5h://127.0.0.1:10808 https_proxy=socks5h://127.0.0.1:10808
#临时白名单
export NO_PROXY=”localhost,127.0.0.1,192.168.0.0/16,10.0.0.0/8,172.16.0.0/12,tailscale.com,*.tailscale.com,100.64.0.0/10″
export no_proxy=$NO_PROXY
2、永久生效
echo ‘export all_proxy=socks5h://127.0.0.1:10808’ >> ~/.bashrc
echo ‘export HTTP_PROXY=socks5h://127.0.0.1:10808’ >> ~/.bashrc
echo ‘export HTTPS_PROXY=socks5h://127.0.0.1:10808’ >> ~/.bashrc
echo ‘export http_proxy=socks5h://127.0.0.1:10808’ >> ~/.bashrc
echo ‘export https_proxy=socks5h://127.0.0.1:10808’ >> ~/.bashrc
echo ‘export NO_PROXY=”localhost,127.0.0.0/8,::1,192.168.0.0/16,10.0.0.0/8,172.16.0.0/12,tailscale.com,*.tailscale.com,controlplane.tailscale.com,login.tailscale.com,derp.tailscale.com,*.derp.tailscale.com,100.64.0.0/10″‘ >> ~/.bashrc
echo ‘export no_proxy=$NO_PROXY’ >> ~/.bashrc
source ~/.bashrc
3、 # SOCKS5 http代理测试
curl –socks5-hostname 127.0.0.1:10808 https://www.google.com -I
curl -x socks5h://127.0.0.1:10808 -k -X GET https://www.google.com -I
curl -x socks5h://127.0.0.1:10808 -k -X GET https://www.google.com -I
curl -x http://127.0.0.1:10809 -k -X GET https://www.google.com -I
核心区别(一句话)
socks5h://:域名在你本地 Ubuntu 机器上解析(h = host 本机)
socks5://:域名交给代理服务器解析
4、# SOCKS5代理测试
curl –socks5-hostname 127.0.0.1:10808 https://www.google.com -I
curl -x socks5h://localhost:1080 -k -X GET http://info.cern.ch:80
curl -x socks5h://127.0.0.1:10808 -k -X GET https://www.google.com -I
curl -x socks5h://127.0.0.1:10808 -k -X GET https://www.google.com -I
curl -x http://127.0.0.1:10809 -k -X GET https://www.google.com -I
返回代理IP地址
stevenroc@stevenroc:~ $ curl -x socks5h://127.0.0.1:10808 -k http://icanhazip.com
curl: /opt/openAI/Lib64U/lib/libcurl.so.4: no version information available (required by curl)
8.210.132.194
stevenroc@stevenroc:~ $ curl -k http://icanhazip.com
curl: /opt/openAI/Lib64U/lib/libcurl.so.4: no version information available (required by curl)
8.210.132.194
一、取消全局代理
1、取消全局代理
stevenroc@stevenroc:~ $ unset all_proxy HTTP_PROXY HTTPS_PROXY http_proxy https_proxy
2、测试无相应
stevenroc@stevenroc:~ $ curl https://www.google.com -I
curl: /opt/openAI/Lib64U/lib/libcurl.so.4: no version information available (required by curl)
返回主机本地真实IP地址
stevenroc@stevenroc:~ $ unset all_proxy HTTP_PROXY HTTPS_PROXY http_proxy https_proxy
stevenroc@stevenroc:~ $ curl -k http://icanhazip.com
curl: /opt/openAI/Lib64U/lib/libcurl.so.4: no version information available (required by curl)
180.226.270.209
stevenroc@stevenroc:~ $ curl -k http://icanhazip.com
二、
1、临时全局代理
stevenroc@stevenroc:~ $ export all_proxy=socks5h://127.0.0.1:10808 HTTP_PROXY=socks5h://127.0.0.1:10808 HTTPS_PROXY=socks5h://127.0.0.1:10808 http_proxy=socks5h://127.0.0.1:10808 https_proxy=socks5h://127.0.0.1:10808
2、测试相应如下
stevenroc@stevenroc:~ $ curl https://www.google.com -I
curl: /opt/openAI/Lib64U/lib/libcurl.so.4: no version information available (required by curl)
HTTP/1.1 200 OK
Content-Type: text/html; charset=ISO-8859-1
Content-Security-Policy-Report-Only: object-src ‘none’;base-uri ‘self’;script-src ‘nonce-JV6d0JXK_O6iFzaW_3lLqg’ ‘strict-dynamic’ ‘report-sample’ ‘unsafe-eval’ ‘unsafe-inline’ https: http:;report-uri https://csp.withgoogle.com/csp/gws/other-hp
Reporting-Endpoints: default=”//www.google.com/httpservice/retry/jserror?ei=e4i-acaLFPOk2roPiaL5yAI&cad=crash&error=Page%20Crash&jsel=1&bver=2405&dpf=uE1tmzNAwr24O98b6vELSzBL4R40xPOqRm7_iHjXuew”
Accept-CH: Sec-CH-Prefers-Color-Scheme
P3P: CP=”This is not a P3P policy! See g.co/p3phelp for more info.”
Date: Sat, 21 Mar 2026 12:00:59 GMT
自适应IP