V2ray 라는 프로그램을 통해 VPN 환경을 구성해본다. v2ray는 vmess와 shadowsocks를 지원한다.
V2ray 서버는 아래의 플랫폼을 지원한다.
-
Windows 7 and later (x86 / amd64)
-
Mac OS X 10.10 Yosemite and later (amd64)
-
Linux 2.6.23 and later (x86 / amd64 / arm / arm64 / mips64 / mips)
-
Including but not limited to Debian 7 / 8, Ubuntu 12.04 / 14.04 and later, CentOS 6 / 7, Arch Linux
-
FreeBSD (x86 / amd64)
-
OpenBSD (x86 / amd64)
-
Dragonfly BSD (amd64)
1. 설치
bash <(curl -L -s https://install.direct/go.sh)
위 스크립트를 설치하면 바로 v2ray가 설치 된다.
그리고 리부팅 시 자동 실행을 위해 v2ray를 enable해준다.
sudo systemctl enable v2ray
그리고 나서 실행을 하면 아래와 같이 정상적으로 수행이 된다.
sudo systemctl start v2ray
2. 설정
/etc/v2ray/config.json 파일을 아래와 같이 생성한다.
참고로 아래 vmess를 사용하려면 아래 링크에서 id를 생성할 수 있다.
https://www.uuidgenerator.net/
/etc/v2ray/config.json
============================================
{
"log":{
"access":"/var/log/v2ray/access.log",
"error":"/var/log/v2ray/error.log",
"loglevel":"warning"
},
"inbounds":[
{
"port":<사용할 포트>,
"protocol":"vmess",
"settings":{
"clients":[
{
"id":"<생성한 id>"
}
]
}
},
{
"port":<shadowsocks용 포트>,
"protocol":"shadowsocks",
"settings":{
"method":"chacha20-ietf-poly1305",
"password":"<사용할 패스워드>"
}
}
],
"outbounds":[
{
"protocol":"freedom",
"settings":{
}
},
{
"protocol":"blackhole",
"settings":{
},
"tag":"blocked"
}
],
"routing":{
"rules":[
{
"type":"field",
"ip":[
"geoip:private"
],
"outboundTag":"blocked"
}
]
}
}
============================================
3. 방화벽 설정
만약 클라우드나 공유기 포트포워딩을 사용한다면 위에서 사용한 포트를 해당 서버로 허용 혹은 포트 포워딩을 해준다.
4. 클라이언트 설정
안드로이드는 shadowsocks(무료), 아이폰은 shadowrocket(유료)를 사용할 수 있다.
아이폰의 경우 무료 shadowsocks app을 사용하는 경우 위의 설정에서 shadowsocks method를 method":"chacha20-ietf-poly1305"에서 aes-256-cfb로 변경해서 설정해야 한다.