这个脚本可以在Debian
系列或者支持Systemd
的Linux
操作系统使用。比如说,Centos 6.x
非debian
系也不带有 Systemd
,因此在CentOS 6.x
不可使用官方提供的脚本安装V2Ray
,但是CentOS 7.x
内置有Systemd
的所以可以使用脚本安装;Ubuntu 14.04
虽然没有Systemd
,但属于Debian
系列,同样可以使用这个脚本。
现在市面上绝大多数Linux
发行版的最新版本都内置了Systemd
,在支持Systemd
的系统中,V2Ray
的安装脚本会添加一个 Systemd
的单元文件可以使得开机后自动运行软件,以及当V2Ray
意外停止运行时自动启动V2Ray
(应该类似于 supervisord
托管服务),推荐用户使用带Systemd
的系统。
wget https://raw.githubusercontent.com/v2ray/v2ray-core/master/release/install-release.sh
bash install-release.sh
注:最好用chrome+switchyomega来翻墙,这样翻墙的速度才快。
真实的服务端的配置文件的内容:
{
"log": {
"access": "/var/log/v2ray/access.log",
"error": "/var/log/v2ray/error.log",
"loglevel": "warning"
},
"inbound": {
"port": 12345,
"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": 3080,
"protocol": "socks",
"settings": {
"auth": "noauth",
"udp": true,
"ip": "127.0.0.1"
}
},
"outbound": {
"protocol": "vmess",
"settings": {
"vnext": [
{
"address": "my_vps_ip",
"port": 12345,
"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"
}
]
}
}
}
------------------------------
网上的一对配置文件(我没试过这对配置文件)
服务器端的配置文件内容:
{
"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
http://archive.is/r4HPI
----------