基于V2ray搭建虚拟私有网络

HaiYang 2 阅读 VPN

基于V2ray搭建虚拟私有网络

购买墙外VPS

racknerd

服务端简单部署

官网手册:
v2fly

使用官方脚本安装最新版

bash <(curl -L https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-dat-release.sh)

编辑配置文件/usr/local/etc/v2ray/config.json

vi /usr/local/etc/v2ray/config.json

将以下配置复制进config.json

{
     "log": {
        "access": "/var/log/v2ray/access.log",
        "error": "/var/log/v2ray/error.log",
        "loglevel": "warning"
    },
    "inbound": {
        "port": 8888,
        "protocol": "vmess",
        "settings": {
            "clients": [
                {
                    "id": "796aaa7-b5f5-46a0-b720-ef2d76e1836a",
                    "level": 0,
                    "alterId": 0 
                }
            ]
        }
    },
    "outbound": {
        "protocol": "freedom",
        "settings": {}
    },
    "inboundDetour": [],
    "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"
                }
            ]
        }
    }
}

启动v2ray

systemctl start v2ray

设置开机自启

systemctl enable v2ray

关闭防火墙

systemctl stop firewalld

禁用防火墙

systemctl disable firewalld

客户端简单配置

依赖下载:
.NET

客户端 v2rayN下载:
v2rayN

打开客户端

点击服务器,新增VMess服务

填下以下配置

地址端口用户ID等信息