由网络副手--寻路人于2024.09.11 23:19:28发布在服务器运维 Linux Centos 安装科学代理v2ray 阅读178 评论1 喜欢0 1、无法访问github, 先用如下方式试一下 https://www.ipaddress.com/website/github.com/ 输入github.com 查看国内可以访问IP 140.82.113.3 github.com 140.82.113.3 gist.github.com 199.232.69.194 github.global.ssl.fastly.net 2、安装 v2ray 原文档: https://www.v2ray.com/chapter_00/install.html 新版迁移后 https://dolorhunter.com/migrate-to-the-new-v2ray-install-script/ 配置模板: https://techlayman.com/posts/web/v2ray/#%e5%ae%a2%e6%88%b7%e7%ab%af%e9%85%8d%e7%bd%ae 安装: ``` curl -O https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh sudo bash install-release.sh ``` 安装后输出: info: Systemd service files have been installed successfully! warning: The following are the actual parameters for the v2ray service startup. warning: Please make sure the configuration file path is correctly set. ~~~~~~~~~~~~~~~~ [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 # In case you have a good reason to do so, duplicate this file in the same directory and make your customizes there. # Or all changes you made will be lost! # Refer: https://www.freedesktop.org/software/systemd/man/systemd.unit.html [Service] ExecStart= ExecStart=/usr/local/bin/v2ray run -config /usr/local/etc/v2ray/config.json ~~~~~~~~~~~~~~~~ warning: The systemd version on the current operating system is too low. warning: Please consider to upgrade the systemd or the operating system. installed: /usr/local/bin/v2ray installed: /usr/local/share/v2ray/geoip.dat installed: /usr/local/share/v2ray/geosite.dat installed: /var/log/v2ray/access.log installed: /var/log/v2ray/error.log installed: /etc/systemd/system/v2ray.service installed: /etc/systemd/system/v2ray@.service removed: /tmp/tmp.STcrbZkCGe info: V2Ray v5.17.1 is installed. You may need to execute a command to remove dependent software: yum remove curl unzip Please execute the command: systemctl enable v2ray; systemctl start v2ray 启动: 1、配置文件 ``` /usr/local/etc/v2ray/config.json ``` 2、服务管理 ``` sudo systemctl start v2ray sudo systemctl stop v2ray sudo systemctl restart v2ray ``` 服务端配置文件: ``` { "log": { "access": "/var/log/v2ray/access.log", "error": "/var/log/v2ray/error.log", "loglevel": "warning" }, "inbound": { "port": 13800, "protocol": "vmess", "settings": { "clients": [ { "id": "385a42f6-6ff8-133e-1d2c-08de6f5e0bf7", "level": 1, "alterId": 0 } ] }, "streamSettings": { "network": "kcp" }, "detour": { "to": "vmess-detour-492690" } }, "outbound": { "protocol": "freedom", "settings": {} }, "inboundDetour": [ { "protocol": "vmess", "port": "10000-11000", "tag": "vmess-detour-492690", "settings": {}, "allocate": { "strategy": "random", "concurrency": 5, "refresh": 5 }, "streamSettings": { "network": "kcp" } } ], "outboundDetour": [ { "protocol": "blackhole", "settings": {}, "tag": "blocked" } ], "routing": { "strategy": "rules", "settings": { "rules": [ { "type": "field", "ip": [ "0.0.0.0/8", "10.0.0.0/8", "100.64.0.0/10", "127.0.0.0/8", "169.254.0.0/16", "172.16.0.0/12", "192.0.0.0/24", "192.0.2.0/24", "192.168.0.0/16", "198.18.0.0/15", "198.51.100.0/24", "203.0.113.0/24", "::1/128", "fc00::/7", "fe80::/10" ], "outboundTag": "blocked" } ] } } } ``` 客户端配置: ``` { "log": { "loglevel": "warning" }, "inbound": { "listen": "127.0.0.1", "port": 10808, "protocol": "socks", "settings": { "auth": "noauth", "udp": true, "ip": "127.0.0.1" } }, "outbound": { "protocol": "vmess", "settings": { "vnext": [ { "address": "10.14.186.18", "port": 13800, "users": [ { "id": "385a42f6-6ff8-133e-1d2c-08de6f5e0bf7", "level": 1, "alterId": 0 } ] } ] }, "streamSettings": { "network": "kcp" } }, "outboundDetour": [ { "protocol": "freedom", "settings": {}, "tag": "direct" } ], "routing": { "strategy": "rules", "settings": { "rules": [ { "type": "field", "port": "54-79", "outboundTag": "direct" }, { "type": "field", "port": "81-442", "outboundTag": "direct" }, { "type": "field", "port": "444-65535", "outboundTag": "direct" }, { "type": "field", "domain": [ "gc.kis.scr.kaspersky-labs.com" ], "outboundTag": "direct" }, { "type": "field", "ip": [ "0.0.0.0/8", "10.0.0.0/8", "100.64.0.0/10", "127.0.0.0/8", "169.254.0.0/16", "172.16.0.0/12", "192.0.0.0/24", "192.0.2.0/24", "192.168.0.0/16", "198.18.0.0/15", "198.51.100.0/24", "203.0.113.0/24", "::1/128", "fc00::/7", "fe80::/10" ], "outboundTag": "direct" } ] } } } ``` 测试: ``` curl -x socks5://127.0.0.1:10808 -k https://www.google.com -v 测试后看服务端日志 ``` 防火墙配置: ``` [root@1zwUPcjkss ~]# sudo firewall-cmd --zone=public --add-port=13800/tcp --permanent Warning: ALREADY_ENABLED: 13800:tcp success [root@1zwUPcjkss ~]# sudo firewall-cmd --zone=public --add-port=13800/udp --permanent success [root@1zwUPcjkss ~]# sudo firewall-cmd --zone=public --add-port=10000-11000/tcp --permanent success [root@1zwUPcjkss ~]# sudo firewall-cmd --zone=public --add-port=10000-11000/udp --permanent success [root@1zwUPcjkss ~]# sudo firewall-cmd --reload ``` GIT 配置: ``` #GIT配置 git config --global https.proxy http://127.0.0.1:10808 git config --global https.proxy https://127.0.0.1:10808 ``` #------相关工具、参考----- 配置生成器: https://intmainreturn0.com/v2ray-config-gen/# 问题集锦: https://github.com/Jrohy/multi-v2ray/issues/561 赞 0 分享 赏 您可以选择一种方式赞助本站 支付宝扫码赞助 BraveDu 署名: 网络副手~寻路人
文章紧扣主题,观点鲜明,展现出深刻的思考维度。