V2Ray的官方一键安装脚本,我测试成功,成功用此脚本翻墙

 

并不要求v2ray的本地版本号和服务器上的版本号一致,我的情况:我的本地版本号是2.41,而服务器上的版本号是2.40 。另外要特别注意的是:本地机器的时间要跟北京时间一致!!误差不能超过2分钟,否则会翻墙失败!!
这个脚本可以在Debian系列或者支持SystemdLinux操作系统使用。比如说,Centos 6.xdebian系也不带有 Systemd,因此在CentOS 6.x不可使用官方提供的脚本安装V2Ray,但是CentOS 7.x内置有Systemd的所以可以使用脚本安装;Ubuntu 14.04虽然没有Systemd,但属于Debian系列,同样可以使用这个脚本。
现在市面上绝大多数Linux发行版的最新版本都内置了Systemd,在支持Systemd的系统中,V2Ray的安装脚本会添加一个 Systemd的单元文件可以使得开机后自动运行软件,以及当V2Ray意外停止运行时自动启动V2Ray(应该类似于 supervisord托管服务),推荐用户使用带Systemd的系统。
Github地址:https://github.com/v2ray/v2ray-core
系统环境:本教程测试系统为Ubuntu 16.04 x64

官方的安装方法:

登陆vps,运行下面命令:
wget https://raw.githubusercontent.com/v2ray/v2ray-core/master/release/install-release.sh
bash install-release.sh
主程序为/usr/bin/v2ray/v2ray,配置文件为 /etc/v2ray/config.json。不过这个配置文件config.json不太好用。可访问https://htfy96.github.io/v2ray-config-gen/ ,来生成v2ray的配置文件。
 我用https://htfy96.github.io/v2ray-config-gen/ 生成的v2ray的配置文件翻墙成功。
 https://htfy96.github.io/v2ray-config-gen/ ,v2ray的配置文件生成器,很不错。值得一试.
 
注:最好用chrome+switchyomega来翻墙,这样翻墙的速度才快。
 
真实的服务端的配置文件的内容:
{
"log": {
"access": "/var/log/v2ray/access.log",
"error": "/var/log/v2ray/error.log",
"loglevel": "warning"
},
"inbound": {
"port": 12345,
"protocol": "vmess",
"settings": {
"clients": [
{
"id": "f2707fb2-70fa-6b38-c9b2-81d6f1efa323",
"level": 1,
"alterId": 100
}
]
},
"streamSettings": {
"network": "kcp"
},
"detour": {
"to": "vmess-detour-746765"
}
},
"outbound": {
"protocol": "freedom",
"settings": {}
},
"inboundDetour": [
{
"protocol": "vmess",
"port": "10000-10010",
"tag": "vmess-detour-746765",
"settings": {},
"allocate": {
"strategy": "random",
"concurrency": 5,
"refresh": 5
},
"streamSettings": {
"network": "kcp"
}
}
],
"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"
}
]
}
}
}
 
真实的客户端的配置文件的内容:
{
"log": {
"loglevel": "warning"
},
"inbound": {
"listen": "127.0.0.1",
"port": 3080,
"protocol": "socks",
"settings": {
"auth": "noauth",
"udp": true,
"ip": "127.0.0.1"
}
},
"outbound": {
"protocol": "vmess",
"settings": {
"vnext": [
{
"address": "my_vps_ip",
"port": 12345,
"users": [
{
"id": "f2707fb2-70fa-6b38-c9b2-81d6f1efa323",
"level": 1,
"alterId": 100
}
]
}
]
},
"streamSettings": {
"network": "kcp"
}
},
"outboundDetour": [
{
"protocol": "freedom",
"settings": {},
"tag": "direct"
}
],
"routing": {
"strategy": "rules",
"settings": {
"rules": [
{
"type": "field",
"port": "54-79",
"outboundTag": "direct"
},
{
"type": "field",
"port": "81-442",
"outboundTag": "direct"
},
{
"type": "field",
"port": "444-65535",
"outboundTag": "direct"
},
{
"type": "field",
"domain": [
"gc.kis.scr.kaspersky-labs.com"
],
"outboundTag": "direct"
},
{
"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"
}
]
}
}
}
------------------------------
 
网上的一对配置文件(我没试过这对配置文件)
 
服务器端的配置文件内容:
{
  "log": {
    "access": "/var/log/v2ray/access.log",
    "error": "/var/log/v2ray/error.log",
    "loglevel": "warning"
  },
  "inbound": {
    "port": 1111,
    "protocol": "vmess",
    "settings": {
      "clients": [
        {
          "id": "UUID1",
          "level": 1,
          "alterId": 64
        },
        {
          "id": "UUID2",
          "level": 1,
          "alterId": 64
        }
      ],
      "detour": {
         "to": "detour-kcp"
      }
    },
    "streamSettings": {
      "network": "kcp"
    }
  },
  "inboundDetour": [
    {
      "protocol": "shadowsocks",
      "port": 20001,
      "settings": {
        "method": "aes-256-cfb",
        "password": "key1",
        "udp": true
      }
    },
    {
      "port": 20002,
      "protocol": "vmess",
      "settings": {
        "clients": [
          {
            "id": "UUID3",
            "level": 1,
            "alterId": 64
          }
        ]
      }
    },
    {
      "port": 21003,
      "protocol": "vmess",
      "settings": {
        "clients": [
          {
            "id": "UUID4",
            "level": 1,
            "alterId": 64
          }
        ],
        "detour": {
          "to": "detour-kcp"
        }
      },
      "streamSettings": {
        "network": "kcp"
      }
    },
    {
      "port": 22004,
      "protocol": "vmess",
      "settings": {
        "clients": [
          {
            "id": "UUID5",
            "level": 1,
            "alterId": 64
          }
        ],
        "detour": {
          "to": "detour-tcp"
        }
      } 
    },
    {
      "protocol": "vmess",
      "port": "50001-50100",
      "tag": "detour-kcp",
      "settings": {},
      "allocate": {
        "strategy": "random",
        "concurrency": 3,
        "refresh": 360
      },
      "streamSettings": {
        "network": "kcp"
      }
    },
    {
      "protocol": "vmess",
      "port": "51001-51100", 
      "tag": "detour-tcp",
      "settings": {},
      "allocate": {
        "strategy": "random",
        "concurrency": 3,
        "refresh": 360
      }
    }
  ],
  "outbound": {
    "protocol": "freedom",
    "settings": {}
  },
  "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"
        }
      ]
    }
  }
}

客户端的配置文件的内容:
{
  "log": {
    "loglevel": "warning"
  },
  "inbound": {
    "port": 1081,
    "listen": "127.0.1.1",
    "protocol": "socks",
    "settings": {
      "auth": "noauth",
      "udp": true,
      "ip": "127.0.1.1"
    }
  },
  "outbound": {
    "protocol": "vmess",
    "settings": {
      "vnext": [
        {
          "address": "vpsip",
          "port": 1111,
          "users": [
            {
              "id": "uuid1",
              "alterId": 64,
              "security": "auto"
            }
          ]
        }
      ]
    },
    "streamSettings":{
      "network":"kcp"
    },
    "mux": {
      "enabled": true
    }
  },
  "inbounddetour": [
    {
          "port": 1082,
    "listen": "127.0.2.1",
    "protocol": "http",
    "settings": {
      "timeout": 0
    } 
    }
  ],
  "outboundDetour": [
    {
      "protocol": "freedom",
      "settings": {},
      "tag": "direct"
    }
  ],
  "dns": {
    "servers": [
      "8.8.8.8",
      "8.8.4.4",
      "localhost"
    ]
  },
  "routing": {
    "strategy": "rules",
    "settings": {
      "domainStrategy": "IPIfNonMatch",
      "rules": [
        {
          "type": "field",
          "port": "1-52",
          "outboundTag": "direct"
        },
        {
          "type": "field",
          "port": "54-79",
          "outboundTag": "direct"
        },
        {
          "type": "field",
          "port": "81-442",
          "outboundTag": "direct"
        },
        {
          "type": "field",
          "port": "444-65535",
          "outboundTag": "direct"
        },
        {
          "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,端口portalterIdid等保持一致。

配置文件说明:
服务端:

  1. 我的这个配置文件,服务短配置的主入口:kcp+vemss
  2. 因为手机软件不支持kcp加速,又设了2个不使用kcpvemss入口。
  3. 备用设立了一个SS入口。
  4. 同时设置了动态端口,主入口支持动态端口,其中一个vemss的支持动态端口。

客户端:

  1. 考虑到部分电脑软件只支持http协议,本地监测的端口有sockshttp这俩。
  2. 127.0.1.1+1081是socks
  3. 127.0.2.1+1082是http

使用方法:
修改协议后然后运行V2ray,打开本地浏览器代理服务器设置,设置代理为SOCKS代理或者http代理,代理服务器地址:127.0.1/2.1,代理端口为1081/1082。

----------

http://www.jianshu.com/p/b59150fd8f47

http://archive.is/r4HPI

----------