Hanlen
11/29/2019 - 2:53 AM

v2ray

v2ray config

一、安装

1. 先同步时间

ntpdate time1.aliyun.com

2. 安装

bash https://install.direct/go.sh

二、 配置

1. 生成UUID

cat /proc/sys/kernel/random/uuid

2. 服务端配置

{
    "inbounds": [
        {
            "port": 29875,
            "protocol": "vmess",
            "settings": {
                "clients": [
                    {
                        "id": "b831381d-6324-4d53-ad4f-8cda48b30811",
                        "alterId": 64
                    }
                ],
                "detour": { // 动态端口配置1(共2点)
                    "to": "dynamicPort"
                }
            },
            "streamSettings": {
                // http 伪装
                "network": "tcp",
                "tcpSettings": {
                    "header": {
                        "type": "http",
                        "response": {
                            "version": "1.1",
                            "status": "200",
                            "reason": "OK",
                            "headers": {
                                "Content-Type": [
                                    "application/octet-stream",
                                    "application/x-msdownload",
                                    "text/html",
                                    "application/x-shockwave-flash"
                                ],
                                "Transfer-Encoding": [
                                    "chunked"
                                ],
                                "Connection": [
                                    "keep-alive"
                                ],
                                "Pragma": "no-cache"
                            }
                        }
                    }
                }
            }
        },
        {
            // 动态端口配置2(共2点)
            "protocol": "vmess",
            "port": "10000-20000",
            "tag": "dynamicPort",
            "settings": {
                "default": {
                    "alterId": 64
                }
            },
            "allocate": {
                "strategy": "random",
                "concurrency": 2,
                "refresh": 3
            }
        }
    ],
    "outbounds": [
        {
            "protocol": "freedom",
            "settings": {}
        }
    ]
}

3. 客户端配置

{
    "inbounds": [
        {
            "port": 1080,
            "protocol": "socks",
            "settings": {
                "auth": "noauth",
                "udp": true,
                "userLevel": 8
            },
            "sniffing": {
                "destOverride": [
                    "http",
                    "tls"
                ],
                "enabled": true
            },
            "tag": "socks"
        },
        {
            "port": 1081,
            "protocol": "http",
            "settings": {
                "userLevel": 8
            },
            "tag": "http"
        }
    ],
    "log": {
        "loglevel": "warning",
        "access": "/etc/v2rayL/v2ray_access.log",
        "error": "/etc/v2rayL/v2ray_error.log"
    },
    "outbounds": [
        {
            "mux": {
                "enabled": true
            },
            "protocol": "vmess",
            "settings": {
                "vnext": [
                    {
                        "address": "server.com",
                        "port": 29875,
                        "users": [
                            {
                                "id": "1824d4fb-84e2-475c-9144-10b1f462f8c7",
                                "alterId": 64,
                                "security": "auto",
                                "level": 8
                            }
                        ]
                    }
                ]
            },
            "streamSettings": {
                "network": "tcp",
                "security": "",
                "tlssettings": {
                    "allowInsecure": true,
                    "serverName": ""
                },
                "tcpsettings": {
                    "connectionReuse": true,
                    "header": {
                        "request": {
                            "version": "1.1",
                            "method": "GET",
                            "path": [
                                ""
                            ],
                            "headers": {
                                "User-Agent": [
                                    "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36"
                                ],
                                "Accept-Encoding": [
                                    "gzip, deflate"
                                ],
                                "Connection": [
                                    "keep-alive"
                                ],
                                "Pragma": "no-cache",
                                "Host": [
                                    "www.amazon.com"
                                ]
                            }
                        },
                        "type": "http"
                    }
                }
            },
            "tag": "proxy"
        },
        {
            "protocol": "freedom",
            "settings": {},
            "tag": "direct"
        },
        {
            "protocol": "blackhole",
            "settings": {
                "response": {
                    "type": "http"
                }
            },
            "tag": "block"
        }
    ],
    "policy": {
        "levels": {
            "8": {
                "connIdle": 300,
                "downlinkOnly": 1,
                "handshake": 4,
                "uplinkOnly": 1
            }
        },
        "system": {
            "statsInboundUplink": true,
            "statsInboundDownlink": true
        }
    },
    "dns": {},
    "routing": {
        "domainStrategy": "IPOnDemand",
        "rules": []
    },
    "stats": {}
}

三、详细参见

https://toutyrater.github.io/