v2ray

ShadowsocksRを使っていたが、携帯のデータ通信で繋がらなくなったので、v2rayにトライ。
Altus上のubuntu 18.04.4 LTSに設定。

まず、UUIDの作成。
# uuidgen
または
# cat /proc/sys/kernel/random/uuid

# wget install.direct/go.sh
# bash < go.sh
v4.23.1がインストールされた。
# vi /etc/v2ray/config.json
portとidを変更。
# chmod o-r /etc/v2ray/config.json
一応隠しておく。

# systemctl enable v2ray
# systemctl start v2ray
# systemctl status v2ray
# ufw allow port番号/tcp
# ufw status
VPSのポートも開けておく

Androidのクライアントは、BifrostVとv2rayNGがあるが、前者は広告が煩い。
設定は、vmessのプロトコルで、設定はサーバのconfig.jsonにあわせる。inbound sniffingはオン。securityはauto。settingsでspeed displayをオン。
Settingsの,Predefined rulesを bypassing LAN and mainland address

Windowsのクライアントは、V2RayNを選んだ。
Githubのreleaseから、V3.18のv2rayN-Core.zipをダウンロード。
https://github.com/2dust/v2rayN/releases
解凍後に、v2rayN.exeを起動し、トップボタンの?から言語を英語に変更して、再起動する。
あとは、Serversメニューで、add VMess serverを選択し、サーバ情報を入力。
タスクバーのアイコンを右クリックして、http proxyから、global modeまたはPAC modeを選択する。

ShadowsocksR+obfsより倍ぐらい早くなった。
これでブロックされずに使い続けることができれば最高なのだが。

ブロックされたが如く遅くなることがあるので、WebSocket+TLSを試した。
サーバのドメイン名を取得し、Let”s Encryptで証明を得る。acmeクライアントは多くあるが、サーバなしのstandaloneモードがあるモノは限られている。今回はCerbotではなく、スクリプトのacme.shを使用。
# apt install socat
# curl https://get.acme.sh | sh
# cd ~/.acme.sh/
# ufw allow 80/tcp
# ./acme.sh –issue -d domain.work –standalone -k ec-256

更新用にcronから毎日起動するようになっているが、手動で更新もできる。
# ./acme.sh –renew -d domain.work –force –ecc
証明書をv2rayにコピー
# ./acme.sh –installcert -d domain.work –fullchainpath /etc/v2ray/v2ray.crt –keypath /etc/v2ray/v2ray.key –ecc
/etc/v2ray/config.jsonのinboundに下記を追記。
“streamSettings”: {
“network”:”ws”,
“security”: “tls”,
“tlsSettings”: {
“certificates”: [{
“certificateFile”: “/etc/v2ray/v2ray.crt”,
“keyFile”: “/etc/v2ray/v2ray.key”
}]
}
}
ポートに443を使ったが、sshdも使っていたので、止めないとエラーになる。
ポートの使用状況を確認。
# lsof -i -P
クライアントからサーバの指定にドメイン名ではなくIPアドレスを使うとエラーになる。

ウエブサーバは使わなくてもGFWからの隠蔽には関係ないと思うので、これでだめならCDNかな。

ログを出力するために、下記を/etc/v2ray/config.jsonに追記
“log”: {
“loglevel”: “warning”,
“access”: “D:\v2ray\access.log”,
“error”: “D:\v2ray\error.log”
}

Rloginはproxy実行後に再起動しないとだめだが、Chromeは再起動しなくても、proxyを認識しているので便利。

コメント