V2Ray的官方一键安装脚本,我测试成功,成功用此脚本翻墙.
(或者看此文https://briteming.blogspot.com/2018/07/233boyv2ray.html)
并不要求v2ray的本地版本号和服务器上的版本号一致,我的情况:我的本地版本号是2.41,而服务器上的版本号是2.40 。另外要特别注意的是:本地机器的时间要跟北京时间一致!!误差不能超过2分钟,否则会翻墙失败!!!
这个脚本可以在
Debian系列或者支持Systemd的Linux操作系统里使用。比如说,Centos 6.x非debian系也不带有 Systemd,因此在CentOS 6.x不可使用官方提供的脚本安装V2Ray,但是CentOS 7.x内置有Systemd的所以可以使用脚本安装;Ubuntu 14.04虽然没有Systemd,但属于Debian系列,同样可以使用这个脚本。
现在市面上绝大多数
Linux发行版(centos7/debian8/ubuntu16.04)的最新版本都内置了Systemd,在支持Systemd的系统中,V2Ray的安装脚本会添加一个 Systemd的单元文件可以使得开机后自动运行软件,以及当V2Ray
意外停止运行时自动启动
V2Ray,推荐用户使用带Systemd的系统。
在运行官方的一键安装脚本时,会自动创建/etc/systemd/system/v2ray.service文件,其内容为:
[Unit]
After=network.target
[Service]
ExecStart=/usr/bin/v2ray/v2ray --config /etc/v2ray/config.json
Restart=always
[Install]
WantedBy=multi-user.target
因为服务器端的命令/usr/bin/v2ray/v2ray --config /etc/v2ray/config.json是在前台运行的,容易退出,
所以我们可以使用systemd来使该命令运行为service。
所以我们可以使用systemd来使该命令运行为service。
因为该一键安装脚本已自动创建/etc/systemd/system/v2ray.service文件,所以只需运行
systemctl start v2ray即可。
官方的安装方法:
登陆vps,运行下面命令:wget https://raw.githubusercontent.com/v2ray/v2ray-core/master/release/install-release.sh
bash install-release.sh
主程序为
config.json不太好用。可访问https://htfy96.github.io/v2ray-config-gen/ ,来生成v2ray的服务器端的
配置文件以及v2ray的客户端的配置文件.
/usr/bin/v2ray/v2ray,配置文件为 /etc/v2ray/config.json。不过这个配置文件config.json不太好用。可访问https://htfy96.github.io/v2ray-config-gen/ ,来生成v2ray的服务器端的
配置文件以及v2ray的客户端的配置文件.
https://htfy96.github.io/v2ray-config-gen/ ,v2ray的配置文件生成器,很不错。
值得一试!
值得一试!
注:最好用chrome+switchyomega来翻墙,这样翻墙的速度才快。
真实的服务端的配置文件的内容:
{
"log": {
"access": "/var/log/v2ray/access.log",
"error": "/var/log/v2ray/error.log",
"loglevel": "warning"
},
"inbound": {
"port": 12344,
"protocol": "vmess",
"settings": {
"clients": [
{
"id": "f2707fb2-70fa-6b38-c9b2-81d6f1efa323",
"level": 1,
"alterId": 100
}
]
},
"streamSettings": {
"network": "kcp"
},
"detour": {
"to": "vmess-detour-746765"
}
},
"outbound": {
"protocol": "freedom",
"settings": {}
},
"inboundDetour": [
{
"protocol": "vmess",
"port": "10000-10010",
"tag": "vmess-detour-746765",
"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": {
"access": "/var/log/v2ray/access.log",
"error": "/var/log/v2ray/error.log",
"loglevel": "warning"
},
"inbound": {
"port": 12344,
"protocol": "vmess",
"settings": {
"clients": [
{
"id": "f2707fb2-70fa-6b38-c9b2-81d6f1efa323",
"level": 1,
"alterId": 100
}
]
},
"streamSettings": {
"network": "kcp"
},
"detour": {
"to": "vmess-detour-746765"
}
},
"outbound": {
"protocol": "freedom",
"settings": {}
},
"inboundDetour": [
{
"protocol": "vmess",
"port": "10000-10010",
"tag": "vmess-detour-746765",
"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": 2081,
"protocol": "socks",
"settings": {
"auth": "noauth",
"udp": true,
"ip": "127.0.0.1"
}
},
"outbound": {
"protocol": "vmess",
"settings": {
"vnext": [
{
"address": "my_vps_ip",
"port": 12344,
"users": [
{
"id": "f2707fb2-70fa-6b38-c9b2-81d6f1efa323",
"level": 1,
"alterId": 100
}
]
}
]
},
"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": "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"
}
]
}
}
}
注意:客户端的配置文件里的"protocol"的值可由socks改为http,也就是说:本地的代理
协议既可以是socks协议,也可以是http协议。
在客户机器mac上,
cd ~
把上面的客户端配置文件的内容保存为config.json
cd ~/downloads
wget https://github.com/v2ray/v2ray-core/releases/download/v3.8/v2ray-macos.zip
unzip v2ray-macos.zip
cd v2ray-v3.8-macos
chmod 755 v2ray
./v2ray --config ~/config.json
保持这个terminal窗口不要关闭,然后设置本地机器的浏览器的socks5代理服务器为
127.0.0.1:2081 ,浏览器即可翻墙。
---------------------
shadowrocket,Pepi (ShadowRay).推荐shadowrocket。
等类型。缺点是不支持 Vmess KCP,国区无售。
如何使用:
1,手动填写服务器配置 ( 推荐 )
shadowrocket 不支持扫入一键脚 本或 V2rayN 生成的二维码。
2,扫码导入服务器配置 ( 不推荐 )
正如之前所说,shadowrocket 不支持扫入一键脚本或 V2rayN 生成的二维码,只能扫入 shadowrocket 导出的 vmess 服务器设置,所以这种导入方式没有泛用性.
----------------
由github.com/233boy/v2ray里面的一键安装脚本所生成的真实的服务器端的配置文件
的内容:(network协议为tcp,所以配置文件里没有network项)
{
"log": {
"access": "/var/log/v2ray/access.log",
"error": "/var/log/v2ray/error.log",
"loglevel": "warning"
},
"inbound": {
"port": 13204,
"protocol": "vmess",
"settings": {
"udp": true,
"clients": [
{
"id": "fdac48fc-6b17-434e-877a-95280869d6f8",
"level": 1,
"alterId": 233
}
]
}
},
"outbound": {
"protocol": "freedom",
"settings": {}
},
"inboundDetour": [
{
"protocol": "shadowsocks",
"port": 13205,
"settings": {
"method": "aes-128-cfb",
"password": "你的密码",
"udp": true,
"level": 1,
"ota": false
}
}
],
"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"
}
]
}
}
}
由github.com/233boy/v2ray里面的一键安装脚本所生成的真实的客户端的配置文件
的内容: (network协议为tcp,所以配置文件里没有network项)
{
"log": {
"error": "error.log",
"loglevel": "warning"
},
"inbound": {
"port": 2333,
"listen": "127.0.0.1",
"protocol": "socks",
"settings": {
"auth": "noauth",
"udp": true,
"ip": "127.0.0.1"
}
},
"outbound": {
"protocol": "vmess",
"settings": {
"vnext": [
{
"address": "your-vps-ip",
"port": 13204,
"users": [
{
"id": "fdac48fc-6b17-434e-877a-95280869d6f8",
"alterId": 233,
"security": "auto"
}
]
}
]
},
"mux": {
"enabled": true
}
},
"inboundDetour": [
{
"port": 6666,
"listen": "127.0.0.1",
"protocol": "http",
"settings": {
"auth": "noauth",
"udp": true,
"ip": "127.0.0.1"
}
}
],
"outboundDetour": [
{
"protocol": "freedom",
"settings": {},
"tag": "direct"
}
],
"dns": {
"servers": [
"8.8.8.8",
"8.8.4.4",
"localhost"
]
},
"routing": {
"strategy": "rules",
"settings": {
"domainStrategy": "IPIfNonMatch",
"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",
"geoip:cn"
],
"domain": [
"geosite:cn"
],
"outboundTag": "direct"
},
{
"type": "chinasites",
"outboundTag": "direct"
},
{
"type": "chinaip",
"outboundTag": "direct"
}
]
}
}
}
如何在 iOS 系统下使用 V2Ray
虽然 V2Ray 官方没有 iOS 客户端,但是有第三方客户端,例如 kitsunebi,shadowrocket,Pepi (ShadowRay).推荐shadowrocket。
Shadowrocket
泛用性极高的代理软件,俗称小火箭。除 vmess 外也支持 ss、ssR、socks5、HTTP、Lua等类型。缺点是不支持 Vmess KCP,国区无售。
如何使用:
1,手动填写服务器配置 ( 推荐 )
shadowrocket 不支持扫入一键脚 本或 V2rayN 生成的二维码。
2,扫码导入服务器配置 ( 不推荐 )
正如之前所说,shadowrocket 不支持扫入一键脚本或 V2rayN 生成的二维码,只能扫入 shadowrocket 导出的 vmess 服务器设置,所以这种导入方式没有泛用性.
----------------
由github.com/233boy/v2ray里面的一键安装脚本所生成的真实的服务器端的配置文件
的内容:(network协议为tcp,所以配置文件里没有network项)
{
"log": {
"access": "/var/log/v2ray/access.log",
"error": "/var/log/v2ray/error.log",
"loglevel": "warning"
},
"inbound": {
"port": 13204,
"protocol": "vmess",
"settings": {
"udp": true,
"clients": [
{
"id": "fdac48fc-6b17-434e-877a-95280869d6f8",
"level": 1,
"alterId": 233
}
]
}
},
"outbound": {
"protocol": "freedom",
"settings": {}
},
"inboundDetour": [
{
"protocol": "shadowsocks",
"port": 13205,
"settings": {
"method": "aes-128-cfb",
"password": "你的密码",
"udp": true,
"level": 1,
"ota": false
}
}
],
"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"
}
]
}
}
}
由github.com/233boy/v2ray里面的一键安装脚本所生成的真实的客户端的配置文件
的内容: (network协议为tcp,所以配置文件里没有network项)
{
"log": {
"error": "error.log",
"loglevel": "warning"
},
"inbound": {
"port": 2333,
"listen": "127.0.0.1",
"protocol": "socks",
"settings": {
"auth": "noauth",
"udp": true,
"ip": "127.0.0.1"
}
},
"outbound": {
"protocol": "vmess",
"settings": {
"vnext": [
{
"address": "your-vps-ip",
"port": 13204,
"users": [
{
"id": "fdac48fc-6b17-434e-877a-95280869d6f8",
"alterId": 233,
"security": "auto"
}
]
}
]
},
"mux": {
"enabled": true
}
},
"inboundDetour": [
{
"port": 6666,
"listen": "127.0.0.1",
"protocol": "http",
"settings": {
"auth": "noauth",
"udp": true,
"ip": "127.0.0.1"
}
}
],
"outboundDetour": [
{
"protocol": "freedom",
"settings": {},
"tag": "direct"
}
],
"dns": {
"servers": [
"8.8.8.8",
"8.8.4.4",
"localhost"
]
},
"routing": {
"strategy": "rules",
"settings": {
"domainStrategy": "IPIfNonMatch",
"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",
"geoip:cn"
],
"domain": [
"geosite:cn"
],
"outboundTag": "direct"
},
{
"type": "chinasites",
"outboundTag": "direct"
},
{
"type": "chinaip",
"outboundTag": "direct"
}
]
}
}
}
------------------------------
网上的一对配置文件(我没试过这对配置文件)
服务器端的配置文件内容:
{
"log": {
"access": "/var/log/v2ray/access.log",
"error": "/var/log/v2ray/error.log",
"loglevel": "warning"
},
"inbound": {
"port": 1111,
"protocol": "vmess",
"settings": {
"clients": [
{
"id": "UUID1",
"level": 1,
"alterId": 64
},
{
"id": "UUID2",
"level": 1,
"alterId": 64
}
],
"detour": {
"to": "detour-kcp"
}
},
"streamSettings": {
"network": "kcp"
}
},
"inboundDetour": [
{
"protocol": "shadowsocks",
"port": 20001,
"settings": {
"method": "aes-256-cfb",
"password": "key1",
"udp": true
}
},
{
"port": 20002,
"protocol": "vmess",
"settings": {
"clients": [
{
"id": "UUID3",
"level": 1,
"alterId": 64
}
]
}
},
{
"port": 21003,
"protocol": "vmess",
"settings": {
"clients": [
{
"id": "UUID4",
"level": 1,
"alterId": 64
}
],
"detour": {
"to": "detour-kcp"
}
},
"streamSettings": {
"network": "kcp"
}
},
{
"port": 22004,
"protocol": "vmess",
"settings": {
"clients": [
{
"id": "UUID5",
"level": 1,
"alterId": 64
}
],
"detour": {
"to": "detour-tcp"
}
}
},
{
"protocol": "vmess",
"port": "50001-50100",
"tag": "detour-kcp",
"settings": {},
"allocate": {
"strategy": "random",
"concurrency": 3,
"refresh": 360
},
"streamSettings": {
"network": "kcp"
}
},
{
"protocol": "vmess",
"port": "51001-51100",
"tag": "detour-tcp",
"settings": {},
"allocate": {
"strategy": "random",
"concurrency": 3,
"refresh": 360
}
}
],
"outbound": {
"protocol": "freedom",
"settings": {}
},
"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": {
"port": 1081,
"listen": "127.0.1.1",
"protocol": "socks",
"settings": {
"auth": "noauth",
"udp": true,
"ip": "127.0.1.1"
}
},
"outbound": {
"protocol": "vmess",
"settings": {
"vnext": [
{
"address": "vpsip",
"port": 1111,
"users": [
{
"id": "uuid1",
"alterId": 64,
"security": "auto"
}
]
}
]
},
"streamSettings":{
"network":"kcp"
},
"mux": {
"enabled": true
}
},
"inbounddetour": [
{
"port": 1082,
"listen": "127.0.2.1",
"protocol": "http",
"settings": {
"timeout": 0
}
}
],
"outboundDetour": [
{
"protocol": "freedom",
"settings": {},
"tag": "direct"
}
],
"dns": {
"servers": [
"8.8.8.8",
"8.8.4.4",
"localhost"
]
},
"routing": {
"strategy": "rules",
"settings": {
"domainStrategy": "IPIfNonMatch",
"rules": [
{
"type": "field",
"port": "1-52",
"outboundTag": "direct"
},
{
"type": "field",
"port": "54-79",
"outboundTag": "direct"
},
{
"type": "field",
"port": "81-442",
"outboundTag": "direct"
},
{
"type": "field",
"port": "444-65535",
"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"
}
]
}
}
}
注意客户端和服务端配置文件中的服务器地址
address,端口port,alterId,id等保持一致。
配置文件说明:
服务端:
服务端:
- 我的这个配置文件,服务短配置的主入口:
kcp+vemss。 - 因为手机软件不支持
kcp加速,又设了2个不使用kcp的vemss入口。 - 备用设立了一个
SS入口。 - 同时设置了动态端口,主入口支持动态端口,其中一个
vemss的支持动态端口。
客户端:
- 考虑到部分电脑软件只支持
http协议,本地监测的端口有socks和http这俩。 - 127.0.1.1+1081是
socks。 - 127.0.2.1+1082是
http。
使用方法:
修改协议后然后运行
修改协议后然后运行
V2ray,打开本地浏览器代理服务器设置,设置代理为SOCKS代理或者http代理,代理服务器地址:127.0.1/2.1,代理端口为1081/1082。
----------
http://www.jianshu.com/p/b59150fd8f47