2016年1月27日星期三

简易配置VPS V2Ray 服务端、客户端

小弟为业余玩家。这里简单记录VPS搭建V2Ray 服务器方式,以及客户端使用方式。
V2Ray可以建立轻量级SOCK5隧道(wiki),你会搭建shadowsocks服务端的话这个就很容易了。

服务端例子:亚马逊AWS EC2主机  64位 Ubuntu Server 14.04 LTS (HVM),
策略组(防火墙)端口临时开‘所有流量’方便调试。



PUTTY登录进去后用root,没有root请参考灰色字

#建立root账户
sudo passwd root     

#root登录
su root

#更新
apt-get update

#安装v2ray
bash <(curl -L -s https://raw.githubusercontent.com/v2ray/v2ray-core/master/release/install-release.sh)

#修改权限,以便用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代表工作正常。

-------------------------------------------------------------

客户端这里用v1.5-v2ray-windows-32,64位用32位也没问题 地址
https://github.com/v2ray/v2ray-core/releases/download/v1.5/v2ray-windows-32.zip

解压,把以下信息覆盖到客户端v2ray\config里

{
  "port": 1095,
  "log": {
    "access": ""
  },
  "inbound": {
    "protocol": "socks",
    "settings": {
      "auth": "noauth",
      "udp": false,
      "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插件
开启127.0.0.1:1095 SOCKS5 代理即可使用





PS:感谢NickyHU指导,上面的配置文件文本可以覆盖上直接用。
需要注意的客户端配置,需要和服务端的这几个信息一致:
"id": "e90162a3-af27-4d68-b4e6-201454bb94a7",  
随机uuid格式,你们改几个数字、字母拿去用可以了
"address": "YOUR SERVER IP ADDRESS" ,address输入vps的公网ip。
"port": "17996-18278",  v2ray支持动态端口,防火墙需要开17995-18278这一段。
其他具体信息请看v2ray wiki

没有评论:

发表评论

openwrt在线编译 插件名字查找

openwrt在线编译 https://firmware-selector.staging.immortalwrt.org/ 插件名字查找 https://downloads.staging.immortalwrt.org/releases/23.05.1/packages/x8...