centos7安装v2ray及客户端设置
vps 为centos7
登录vps,运行下面命令:
wget https://raw.githubusercontent.com/v2ray/v2ray-core/master/release/install-release.sh
bash install-release.sh
查看当前的时区
date -R
设置时区
tzselect
设置和客户端一致的时间
主程序为/usr/bin/v2ray/v2ray,配置文件为/etc/v2ray/config.json。访问 https://intmainreturn0.com/v2ray-config-gen/,可生产新丢配置文件,替换掉老的。
{ "log": { "access": "/var/log/v2ray/access.log", "error": "/var/log/v2ray/error.log", "loglevel": "warning" }, "inbound": { "port": 22336, "protocol": "vmess", "settings": { "clients": [ { "id": "用户uuid", "level": 1, "alterId": 100 } ] }, "detour": { "to": "vmess-detour-650603" } }, "outbound": { "protocol": "freedom", "settings": {} }, "inboundDetour": [ { "protocol": "vmess", "port": "10000-10010", "tag": "vmess-detour-650603", "settings": {}, "allocate": { "strategy": "random", "concurrency": 5, "refresh": 5 } } ], "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" } ] } } }
编辑文件,把"listen":"公网ip" 加进config.json里面。
[root@eevaa v2ray]# cat /etc/v2ray/config.json { "log": { "access": "/var/log/v2ray/access.log", "error": "/var/log/v2ray/error.log", "loglevel": "warning" }, "inbound": { "port": 22336, "protocol": "vmess", "listen":"公网ip", "settings": { "clients": [ { "id": "用户uuid", "level": 1, "alterId": 100 } ] }, "detour": { "to": "vmess-detour-458125" } }, "outbound": { "protocol": "freedom", "settings": {} }, "inboundDetour": [ { "protocol": "vmess", "port": "10000-10010", "tag": "vmess-detour-458125", "settings": {}, "allocate": { "strategy": "random", "concurrency": 5, "refresh": 5 } } ], "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" } ] } } }
Linux 客户端和服务器一样安装,删除/etc/v2ray/里的vpoint_vmess_freedom.json文件
新增一个config.json文件,旧的不要。我这个设置的端口号10888。.文件如下
cat /etc/v2ray/config.json { "log": { "loglevel": "warning" }, "inbound": { "listen": "127.0.0.1", "port": 10888, "protocol": "socks", "settings": { "auth": "noauth", "udp": true, "ip": "127.0.0.1" } }, "outbound": { "protocol": "vmess", "settings": { "vnext": [ { "address": "外网ip", "port": 22336, "users": [ { "id": "用户uuid", "level": 1, "alterId": 100 } ] } ] }, "mux": { "enabled": true, "concurrency": 8 } }, "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": "chinasites", "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" }, { "type": "chinaip", "outboundTag": "direct" } ] } } }
注:
如果装好没有加入systemctl
systemctl enable v2ray
switchyomega设置
"local_address":"127.0.0.1" "local_port":10888 #你自己丢端口号
规则地址https://raw.githubusercontent.com/gfwlist/gfwlist/master/gfwlist.txt
参考:
http://briteming.hatenablog.com/entry/2017/10/25/122814
https://toutyrater.github.io/basic/vmess.html
https://www.linodovultr.com/post/resolve-v2ray-after-install-can-not-connect.html
最后更新于 2018-11-05 15:15:08 并被添加「 centos7, v2ray」标签,已有 2480 位童鞋阅读过。
本站使用「署名 4.0 国际」创作共享协议,可自由转载、引用,但需署名作者且注明文章出处