본문 바로가기
서버/리눅스 서버

V2Ray 설치하기 (중국 만리장성 뚫기)

by ㅋㅋ잠자 2019. 9. 29.
반응형

안녕하세요? 이번에 중국직구 업체 VPN 작업을 하면서 했던 것을 기록으로 남기고 있습니다.


이전에 shadowsocks 도 잘 쓰고 있었지만, 아무래도 장기간 사용하다보니 IP자체가 블락되는 증상이 있었습니다.


이런 부분을 피하려면 패킷 감청을 피해야하는데 이런 부분에서 vmess 를 사용해보면 혹시 개선될까 하여 설치를 진행해 보았고 잘 되고 있다는 회신을 받았습니다.





1. V2Ray


V2Ray 는 vmess 프로토콜과 shadowsocks 방식을 지원하는 멀티 서버입니다. shadowsocks-libev 의 경우 socks5 프록시만 가능했지만, vmess 를 써보기 위해서는 V2Ray 를 설치해야합니다.


(참고로 지금 설명하는 정보는 조금 정확하지 않을 수 있습니다.)


vmess 프로토콜이 지원하는 방식이 많습니다. 웹소켓 방식이나 웹소켓에 웹서버를 통해 TLS 암호화를 추가적으로 하는 등의 많은 방식이 있고 만리장성을 속이기 위해서 요청 헤더를 위챗으로 위장하거나 이러한 방법도 동원이 가능합니다.


이런 부분에 대해서, 중국 만리장성이 AI를 도입하고 패킷을 일일이 까본다는 느낌도 크게 들기 시작했습니다.


V2Ray 를 통해서 한 서버에 vmess + shadowsocks 를 두개 운영하고 때에 따라 되는 것을 골라 연결하시면 되는 구조입니다. 그런데 IP 블락이 발생했다면, 흠... 다른 서버를 파야되는 부분이 있습니다.





2. 설치 스크립트


기존 중국 스크립트의 내용을 한글화 하였습니다.


--> 취소.. 너무 많습니다. 스크립트를 간편화 했습니다.


# 스크립트 받고 실행권한 주고 실행합니다.

root@debian:~# wget https://github.com/djjproject/android_over_linux/raw/master/installer/v2ray.sh

root@debian:~# chmod a+x v2ray.sh


root@debian:~# ./v2ray.sh 


root@AOL-Debian:~/android_over_linux/installer# ./v2ray.sh 

--2019-09-29 16:41:35--  https://git.io/v2ray.sh

Resolving git.io (git.io)... 3.223.119.4, 52.73.84.118, 3.212.234.252, ...

Connecting to git.io (git.io)|3.223.119.4|:443... connected.

HTTP request sent, awaiting response... 302 Found

Location: https://raw.githubusercontent.com/233boy/v2ray/master/install.sh?v [following]

--2019-09-29 16:41:36--  https://raw.githubusercontent.com/233boy/v2ray/master/install.sh?v

Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.0.133, 151.101.64.133, 151.101.128.133, ...

Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.0.133|:443... connected.

HTTP request sent, awaiting response... 200 OK

Length: 29802 (29K) [text/plain]

Saving to: ‘/tmp/v2ray.sh’


/tmp/v2ray.sh                  100%[====================================================>]  29.10K  89.8KB/s    in 0.3s    


2019-09-29 16:41:38 (89.8 KB/s) - ‘/tmp/v2ray.sh’ saved [29802/29802]


# 포트 설정과 비번 설정을 합니다.

vmess port > 55000

shadowsocks port > 55001

shadowsocks password > 1234


 V2Ray 端口 = 51000

 Shadowsocks 端口 = 51001

 Shadowsocks 密码 = 1234

 Shadowsocks 加密协议 = chacha20-ietf-poly1305

---------- END -------------



Hit:1 http://debian-archive.trafficmanager.net/debian buster InRelease
Hit:2 http://debian-archive.trafficmanager.net/debian buster-updates InRelease
Hit:3 http://security.debian.org/debian-security buster/updates InRelease
Reading package lists... Done
Reading package lists... Done
Building dependency tree       
Reading state information... Done
curl is already the newest version (7.64.0-4).
dbus is already the newest version (1.12.16-1).
git is already the newest version (1:2.20.1-2).
libcap2-bin is already the newest version (1:2.25-2).
lrzsz is already the newest version (0.12.21-10).
qrencode is already the newest version (4.0.2-1).
unzip is already the newest version (6.0-23+deb10u1).
wget is already the newest version (1.20.1-1.1).
zip is already the newest version (3.0-11+b1).
0 upgraded, 0 newly installed, 0 to remove and 43 not upgraded.

已将你的主机设置为Asia/Shanghai时区并通过systemd-timesyncd自动同步时间。


主机时间:
               Local time: Sun 2019-09-29 16:42:54 CST
                Time zone: Asia/Shanghai (CST, +0800)

/tmp ~
Cloning into '/etc/v2ray/233boy/v2ray'...

# 하기 정보를 메모해 주시길 바랍니다.
 地址 (Address) = 211.49.151.200

 端口 (Port) = 51000

 用户ID (User ID / UUID) = 6265d8ad-2508-41f8-89c6-092ebedea397

 额外ID (Alter Id) = 233

 传输协议 (Network) = ws

 伪装类型 (header type) = none

---------- END -------------

V2Ray 客户端使用教程: https://233v2.com/post/4/

提示: 输入 v2ray url 可生成 vmess URL 链接 / 输入 v2ray qr 可生成二维码链接


---------- Shadowsocks 配置信息 -------------

 服务器地址 = 211.49.151.200

 服务器端口 = 51001

 密码 = 1234

 加密协议 = chacha20-ietf-poly1305

 SS 链接 = ss://Y2hhY2hhMjAtaWV0Zi1wb2x5MTMwNToxMjM0QDIxMS40OS4xNTEuMjk6NTEwMDE=#233v2.com_ss_211.49.151.29

 备注: Shadowsocks Win 4.0.6 客户端可能无法识别该 SS 链接

提示: 输入 v2ray ssqr 可生成 Shadowsocks 二维码链接

 [v2ray] installation finished...
 please check above connection information.


혹시 삭제하고 싶을 때에는 아래와 같이 하시면 됩니다.


root@debian:~# ./v2ray.sh remove


........... V2Ray 一键安装脚本 & 管理脚本 by 233v2.com ..........


帮助说明: https://233v2.com/post/1/


搭建教程: https://233v2.com/post/2/


 1. 安装


 2. 卸载




 卸载 V2Ray = 是





 V2Ray 卸载完成啦 ....


如果你觉得这个脚本有哪些地方不够好的话...请告诉我


反馈问题: https://github.com/233boy/v2ray/issues




 [v2ray] remove finished...





3. sysv-init 추가하기


systemd 로 실행이 되는 시스템은 문제가 없겠지만, sysv-init 을 쓰는 시스템에서는 아래의 스크립트가 추가가 되어야 합니다.


AoL 은 호환성 모드로 동작되는 시스템이기 때문에 systemd 지원이 어렵습니다.


# init.d 파일을 받습니다.

root@AOL-Debian:~# wget https://github.com/djjproject/android_over_linux/raw/master/init.d/v2ray -O /etc/init.d/v2ray

--2019-09-29 16:53:42--  https://github.com/djjproject/android_over_linux/raw/master/init.d/v2ray

Resolving github.com (github.com)... 15.164.81.167

Connecting to github.com (github.com)|15.164.81.167|:443... connected.

HTTP request sent, awaiting response... 302 Found

Location: https://raw.githubusercontent.com/djjproject/android_over_linux/master/init.d/v2ray [following]

--2019-09-29 16:53:42--  https://raw.githubusercontent.com/djjproject/android_over_linux/master/init.d/v2ray

Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.0.133, 151.101.64.133, 151.101.128.133, ...

Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.0.133|:443... connected.

HTTP request sent, awaiting response... 200 OK

Length: 1062 (1.0K) [text/plain]

Saving to: ‘/etc/init.d/v2ray’


/etc/init.d/v2ray              100%[====================================================>]   1.04K  --.-KB/s    in 0s      


2019-09-29 16:53:43 (5.97 MB/s) - ‘/etc/init.d/v2ray’ saved [1062/1062]


# 실행권한 주고 기본 서비스로 설정합니다.

root@AOL-Debian:~# chmod a+x /etc/init.d/v2ray && update-rc.d v2ray defaults



# 테스트를 진행합니다.
root@AOL-Debian:~# service v2ray stop
Stopping v2ray: v2ray.
root@AOL-Debian:~# service v2ray start
Starting v2ray: v2ray.
root@AOL-Debian:~# ps -ef | grep v2ray
root      7493     1  1 16:54 ?        00:00:00 /usr/bin/v2ray/v2ray -config /etc/v2ray/config.json
root      8046  6765  0 16:54 pts/0    00:00:00 grep v2ray





4. 모바일에서 연결하기


https://play.google.com/store/apps/details?id=com.v2ray.ang&hl=en_US



앱에서 상단 메뉴를 누르고 vmess shadowsocks 를 선택하신 다음에 아래와 같이 입력합니다.


서버 설치 때 정보를 참고하겠습니다.


 地址 (Address) = 211.49.151.200

 端口 (Port) = 51000

 用户ID (User ID / UUID) = 6265d8ad-2508-41f8-89c6-092ebedea397

 额外ID (Alter Id) = 233

 传输协议 (Network) = ws

 伪装类型 (header type) = none

------------------------------------------------------------------------------

 服务器地址 = 211.49.151.200

 服务器端口 = 51001

 密码 = 1234

 加密协议 = chacha20-ietf-poly1305






상기처럼 편리하게 사용이 가능합니다.





5. PC에서는??


1. vmess

https://github.com/Cenmrev/V2RayW


상기 프로그램을 사용하여 연결하고 설정은 아래와 같이 하시면 됩니다.



2. shadowsocks

https://github.com/shadowsocks/shadowsocks-windows/releases


상기 프로그램을 사용하여 연결하고 설정은 아래와 같이 하시면 됩니다.



감사합니다.


반응형

댓글