以Azure的Debian 7为例,登陆后
sudo su
切换到root用户
因为Azure的Debian 7系统没有安装curl所以需要先手动安装
apt-git install curl
手动安装curl先
bash <(curl -L -s https://install.direct/go.sh)
来安装V2Ray
此脚本会自动安装以下文件:
/usr/bin/v2ray/v2ray:V2Ray 程序;/etc/v2ray/config.json:配置文件;
脚本运行完成后,你需要:
- 编辑 /etc/v2ray/config.json 文件来配置你需要的代理方式;
- 运行 service v2ray start 来启动 V2Ray 进程;
- 之后可以使用 service v2ray start|stop|status|reload|restart|force-reload 控制 V2Ray 的运行。
动态端口简易配置服务端
#修改权限,以便用WinSCP.exe修改etc/v2ray/config.json
sudo chmod 777 /etc/v2ray/config.json
#WinSCP.exe打开etc/v2ray/config.json,
把以下信息覆盖进去
{
"port": 17995,
"log" : {
"access": "/var/log/v2ray/access.log",
"error": "/var/log/v2ray/error.log",
"loglevel": "warning"
},
"inbound": {
"protocol": "vmess",
"settings": {
"clients": [
{
"id": "e90162a3-af27-4d68-b4e6-201454bb94a7",
"level": 1,
"alterId": 100
}
],
"features": {
"detour": {
"to": "detourHandler"
}
}
}
},
"outbound": {
"protocol": "freedom",
"settings": {}
},
"inboundDetour": [
{
"protocol": "vmess",
"port": "17996-18278",
"tag": "detourHandler",
"settings": {
"clients": [
{
"id": "e90162a3-af27-4d68-b4e6-201454bb94a7",
"level": 1,
"alterId": 100
}
]
},
"allocate": {
"strategy": "random",
"concurrency": 2,
"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"
}
]
}
}
}
保存之后ssh输入
service v2ray start
启动服务
输入 service v2ray status
看服务状态,提示running代表工作正常。
动态端口简易配置客户端 点击下载V2Ray客户端
解压,把以下信息覆盖到客户端v2ray\config里
{
"port": 1095,
"log": {
"access": ""
},
"inbound": {
"protocol": "socks",
"settings": {
"auth": "noauth",
"udp": true,
"ip": "127.0.0.1"
}
},
"outbound": {
"protocol": "vmess",
"settings": {
"vnext": [
{
"address": "YOUR SERVER IP ADDRESS",
"port": 17995,
"users": [
{
"id": "e90162a3-af27-4d68-b4e6-201454bb94a7",
"alterId": 100
}
]
}
]
}
},
"outboundDetour": [
{
"protocol": "freedom",
"settings": {},
"tag": "direct"
}
],
"routing": {
"strategy": "rules",
"settings": {
"rules": [
{
"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填入服务端公网ip
保存退出,然后运行v2ray.exe
chrome配合SwitchyOmega插件
Windows可以配合SSTap来使用
Windows可以配合SSTap来使用
开启127.0.0.1:1095 SOCKS5 代理即可使用
需要注意的客户端配置,需要和服务端的这几个信息一致:
"id": "e90162a3-af27-4d68-b4e6-201454bb94a7",
随机uuid格式,你们改几个数字、字母拿去用可以了
"address": "YOUR SERVER IP ADDRESS" ,address输入vps的公网ip。
"port": "17996-18278", v2ray支持动态端口,防火墙需要开17995-18278这一段。
转载自https://ntgeralt.blogspot.ch/2016/01/vps-v2ray.html
=====Shadowsocks 服务器端=====
V2Ray 在服务器端支持 Shadowsocks 协议。服务器端可以同时开启 V2Ray 和 Shadowsocks 两种协议,以减少维护成本。
配置完毕后,请在防火墙中做相应配置,以保证端口的可用性。
=====Shadowsocks 服务器端=====
V2Ray 在服务器端支持 Shadowsocks 协议。服务器端可以同时开启 V2Ray 和 Shadowsocks 两种协议,以减少维护成本。
下面是一个以 VMess 为主,同时开放 Shadowsocks 端口的配置:
{
"log" : { // [日志](../chapter_02/01_overview.md)
"access": "/var/log/v2ray/access.log", // 访问日志文件
"error": "/var/log/v2ray/error.log", // 错误日志文件
"loglevel": "warning" // 错误日志等级
},
"inbound": { // 主传入协议
"port": 12345, // 主端口
"protocol": "vmess", // 在这里使用 [VMess 协议](../chapter_02/protocols/vmess.md)
"settings": {
"clients": [
{
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", // UUID
"level": 1, // 用户等级
"alterId": 64 // 额外ID
}
// 在这里添加更多用户,注意UUID不能重复
,{
"id": "yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy", // UUID
"level": 0, // 用户等级
"alterId": 32 // 额外ID
}
]
}
},
"outbound": { // 主传出协议
"protocol": "freedom", // 在这里使用“直接传出至互联网”
"settings": {}
},
// ========== BEGIN ==========
// 增加传入绕路,开启 Shadowsocks 协议
"inboundDetour": [
{
"protocol": "shadowsocks", // 开启 Shadowsocks 协议支持
"port": 30001, // 监听 30001 端口
"settings": {
"method": "aes-256-cfb", // 加密方式,支持 aes-256-cfb 和 aes-128-cfb
"password": "v2ray", // 密码,客户端必须与此相同
"udp": false // 是否开启 UDP 转发
}
},
{
"protocol": "shadowsocks", // 开启 Shadowsocks 协议支持
"port": 30002, // 监听 30002 端口,由于 Shadowsocks 的限制,多用户的时候只能开多个端口
"settings": { // 配置和上述类似
"method": "aes-256-cfb",
"password": "v2ray-2",
"udp": false
}
}
],
// ========== END ==========
"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"
}
]
}
}
}
这样的话可以直接使用shadowsocks客户端了,同时也可以使用V2Ray来连接,V2Ray的配置内容如下
{
"port": 1095, // 本地端口
"log": {
"access": ""
},
"inbound": {
"protocol": "socks",
"settings": {
"auth": "noauth",
"udp": true,
"ip": "127.0.0.1"
}
},
"outbound": {
"protocol": "vmess",
"settings": {
"vnext": [
{
"address": "YOUR SERVER IP ADDRESS", // 服务器VPS的公网IP地址
"port": 12345, // 必须与服务器的监听端口相同
"users": [
{
"id": "yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy", // UUID
"alterId": 64
}
]
}
]
}
},
"outboundDetour": [
{
"protocol": "freedom",
"settings": {},
"tag": "direct"
}
],
"routing": {
"strategy": "rules",
"settings": {
"rules": [
{
"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"
}
]
}
}
}
开启127.0.0.1:1095 SOCKS5 代理即可使用V2Ray协议
详情参考https://www.v2ray.com/chapter_05/00_config/06_shadowsocks.html
0 评论