V2Ray 项目是一个免费的跨平台工具,可以助你加密网络流量,绕过网络供应商的干扰。y8a免费翻墙网

这是一个较新的上网工具,主要目的就是上谷歌、推特等网站。由于在今天推出的新版本支持shadowsocks协议,暂时弥补了目前没有手机端的缺 陷。这个工具目前还比较小众,所以不会成为研究对象,也正因为比较小众,目前还没有比较多而详细的教程供参考,所以就提高了初学者使用门槛。这里写下我的 搭建过程供后人参考。y8a免费翻墙网

需要工具:

  • vps一台
  • 加油+努力+勇气

一、服务端搭建过程

这里列出主要过程,下面是详细解说:y8a免费翻墙网

wget 下载链接 unzip v2ray*.zip cd v2ray* chmod +x v2ray ./v2ray -config vpoint_vmess_freedom.json 

首先ssh连接上自己的vps,然后到这里找到适合自己vps的版本,直接在下载链接上右键复制链接。然后切回ssh窗口,输入命令 wget 粘贴之前复制的链接进行下载,下载完成后使用 unzip xxx.zip以解压文件。使用cd命令进入解压出的文件夹。y8a免费翻墙网

首先使用vim vpoint_vmess_freedom.json命令编辑配置文件,其实id和端口换不换都可以,如果想要换掉id可以通过Online UUID Generator这给网站生成。y8a免费翻墙网

不过想要需要支持shadownsocks,还需要再进行配置。顺便一提,shadowsocks的端口配置支持1000-1010这种的多端口配置。可以参考官方文档shadoowsocks配置样例y8a免费翻墙网

  "inboundDetour": [     {       "protocol": "shadowsocks",   // 开启 Shadowsocks       "port": 30001, // 监听 30001 端口       "settings": {         "method": "aes-256-cfb", // 加密方式,支持 aes-256-cfb 和 aes-128-cfb         "password": "v2ray",     // 密码,必须和客户端相同         "udp": false             // 是否开启 UDP 转发       }     },   ], 

注意需要删掉注释,然后把这段配置粘贴进配置文件中,端口、密码可以适当修改。修改好后保存,使用chmod +x v2ray给它加上执行权限,这样就完成了。之后可以通过./v2ray -h查看使用方法,或者直接通过 sudo ./v2ray -config vpoint_vmess_freedom.json执行就成了。不过这样在关闭ssh窗口时,v2ray也就关闭了,所以需要让它维持后台运行。这里的官方教程讲的非常详细,y8a免费翻墙网

sudo vim /etc/init.d/v2ray #创建配置文件并粘贴下列内容   #!/bin/sh ### BEGIN INIT INFO # Provides:          v2ray # Required-Start:    $network $local_fs $remote_fs # Required-Stop:     $remote_fs # Default-Start:     2 3 4 5 # Default-Stop:      0 1 6 # Short-Description: socksv5 based proxy written by go. # Description:       v2ray is a socksv5 proxy written by go. Connection can be crypto by aes or #            des. this might help for people in China to corss GFW. ### END INIT INFO  # Author: Shell Xu <shell909090@gmail.com> # Modify: Isulew Li <netcookies@gmail.com>  # PATH should only include /usr/* if it runs after the mountnfs.sh script PATH=/sbin:/usr/sbin:/bin:/usr/bin   DESC=v2ray             # Introduce a short description here   NAME=v2ray             # Introduce the short server's name here   DAEMON=/usr/bin/v2ray  #这里改成v2ray程序的完整位置   PIDFILE=/var/run/$NAME.pid   LOGFILE=/var/log/$NAME.log   SCRIPTNAME=/etc/init.d/$NAME  DAEMON_OPTS="-config /etc/v2ray/config.json" #这里改成配置文件完整位置  # Exit if the package is not installed [ -x $DAEMON ] || exit 0  # Read configuration variable file if it is present [ -r /etc/default/$NAME ] && . /etc/default/$NAME  # Load the VERBOSE setting and other rcS variables . /lib/init/vars.sh  # Define LSB log_* functions. # Depend on lsb-base (>= 3.0-6) to ensure that this file is present. . /lib/lsb/init-functions  # # Function that starts the daemon/service # do_start()   {     # Return     #   0 if daemon has been started     #   1 if daemon was already running     #   2 if daemon could not be started     #   3 if configuration file not ready for daemon     start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \         || return 1     start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --background \          --no-close -m -- $DAEMON_OPTS >> $LOGFILE 2>&1 \         || return 2     chmod -f 600 $LOGFILE     # Add code here, if necessary, that waits for the process to be ready     # to handle requests from services started subsequently which depend     # on this one.  As a last resort, sleep for some time. }  # # Function that stops the daemon/service # do_stop()   {     # Return     #   0 if daemon has been stopped     #   1 if daemon was already stopped     #   2 if daemon could not be stopped     #   other if a failure occurred     start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE     RETVAL="$?"     [ "$RETVAL" = 2 ] && return 2     # Wait for children to finish too if this is a daemon that forks     # and if the daemon is only ever run from this initscript.     # If the above conditions are not satisfied then add some other code     # that waits for the process to drop all resources that could be     # needed by services started subsequently.  A last resort is to     # sleep for some time.     start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON     [ "$?" = 2 ] && return 2     # Many daemons don't delete their pidfiles when they exit.     rm -f $PIDFILE     return "$RETVAL" }  # # Function that sends a SIGHUP to the daemon/service # do_reload() {       #     # If the daemon can reload its configuration without     # restarting (for example, when it is sent a SIGHUP),     # then implement that here.     #     start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE     return 0 }  case "$1" in     start)     [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC " "$NAME"     do_start     case "$?" in         0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;         2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;     esac   ;;   stop)     [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"     do_stop     case "$?" in         0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;         2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;     esac     ;;   status)        status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?        ;;   reload|force-reload)     #     # If do_reload() is not implemented then leave this commented out     # and leave 'force-reload' as an alias for 'restart'.     #     log_daemon_msg "Reloading $DESC" "$NAME"     do_reload     log_end_msg $?     ;;   restart|force-reload)     #     # If the "reload" option is implemented then remove the     # 'force-reload' alias     #     log_daemon_msg "Restarting $DESC" "$NAME"     do_stop     case "$?" in       0|1)         do_start         case "$?" in             0) log_end_msg 0 ;;             1) log_end_msg 1 ;; # Old process is still running             *) log_end_msg 1 ;; # Failed to start         esac         ;;       *)         # Failed to stop         log_end_msg 1         ;;     esac     ;;   *)     #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2     echo "Usage: $SCRIPTNAME {start|stop|status|reload|restart|force-reload}" >&2     exit 3     ;; esac