1 首先使用

bash <(curl -L -s https://install.direct/go.sh)

来快捷安装v2ray

2 然后编辑/etc/v2ray/config.json文件,如下设置:

{
    "log": {
        "error": "error.log",
        "loglevel": "warning"
    },
    "outbounds": [
        {
            "protocol": "vmess",
            "settings": {
                "vnext": [
                    {
                        "address": "服务器地址",
                        "port": 服务iqi端口,
                        "users": [
                            {
                                "id": "服务器端ID",  
                                "alterId": 233,
                                "security": "auto"
                            }
                        ]
                    }
                ]
            },
            "streamSettings": {
                "network": "kcp",
                "kcpSettings": {
                    "uplinkCapacity": 100,
                    "downlinkCapacity": 100,
                    "congestion": true,
                    "header": {
                        "type": "none"
                    }
                }
            },
            "mux": {
                "enabled": true
            }
        },
        {
            "protocol": "freedom",
            "settings": {},
            "tag": "direct"
        }
    ],
    "inbounds": [
        {
            "port": 1080,
            "listen": "127.0.0.1",
            "protocol": "socks",
            "settings": {
                "auth": "noauth",
                "udp": true,
                "ip": "127.0.0.1"
            }
        },
        {
            "port": 6666,
            "listen": "127.0.0.1",
            "protocol": "http",
            "settings": {
                "auth": "noauth",
                "udp": true,
                "ip": "127.0.0.1"
            }
        }
    ],
    "dns": {
        "servers": [
            "8.8.8.8",
            "8.8.4.4",
            "localhost"
        ]
    },
    "routing": {
        "domainStrategy": "IPOnDemand",    
        "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"
            }
        ]
    }
}

3 编辑完成后保存,重新启动v2ray

service v2ray stop
service v2ray start
service v2ray status