• 車種別
  • パーツ
  • 整備手帳
  • ブログ
  • みんカラ+

hawthornのブログ一覧

2019年01月19日 イイね!

あー

あけましておめでとうございます。
今年もよろしくお願いします。

年末はスキー行ったりでまあ楽しんでいました。
職場が今年から変わったのでまあまあ、忙しいですが作るものは変わらないですね。

スキー場とかで自宅のPCに入り、色々やる予定でしたが宿やスキー場の通信はそれほど速くなかったのです。SSHとRDPだけだとなかなか難しいですね。

OPENVPNとかで暗号なしの フリーWIFIを捕まえるとセキュリティー的にこわいのでVPNをつかうのですが、やっぱり、VPNGATEとか使うと気まぐれに落とされたりするんで帰ってきてから自前のVPNをたてることにしました。
ただ、自宅メインサーバーをVPNにすると面白くないのとセキュティ的な2重化、3重化でVPNは別に立てることにしました。
PCはあるんですが電気代とか騒音の関係でAstariskと同じでラズパイを使うことに・・・うちのは3でモデルBなんでそこそこ新しい方です。今はB+があるんで今買うならこっちですね。

んで何をやるかというと
まずはともあれ、SDカードと電源とラズパイボードを用意します。

https://www.raspberrypi.org/downloads/raspbian/
んでRaspbian Stretch Liteをダウンロードしておきます。
まあこのへんは初期のセットアップで公式などを見ればいくらでもあります。

sshを有効にしたら、とりあえず、あとはPCで作業します。
VPNのサーバーソフトはSoftEtherを使います。
wgetでダウンロードします。
wget https://github.com/SoftEtherVPN/SoftEtherVPN_Stable/releases/download/v4.28-9669-beta/softether-vpnserver-v4.28-9669-beta-2018.09.11-linux-arm_eabi-32bit.tar.gz
かいとー
tar zxvf softether-vpnserver-v4.28-9669-beta-2018.09.11-linux-arm_eabi-32bit.tar.gz

移動
sudo mv vpnserver /usr/local
cd /usr/local/vpnserver/

ビルド
sudo make
権限
sudo chmod 600 *
sudo chmod 700 vpncmd
sudo chmod 700 vpnserver

sudo vim /etc/systemd/system/softether-vpn.service

[Unit]
Description=Home VPN Server Service
After=network.target
[Service]
Type=forking
User=root
ExecStart=/usr/local/vpnserver/vpnserver start
ExecStop=/usr/local/vpnserver/vpnserver stop
Restart=on-abort
WorkingDirectory=/usr/local/vpnserver/
ExecStartPre=/sbin/ip link set dev eth0 promisc on
[Install]
WantedBy=multi-user.target
権限付与
chmod +x /etc/systemd/system/softether-vpn.service
デーモンロード、起動、ステータス確認
sudo systemctl daemon-reload
sudo systemctl start softether-vpn
sudo systemctl status softether-vpn

自動起動設定
sudo systemctl enable softether-vpn

hoge@xxxxxx:~ $ cd /usr/local/vpnserver/
hoge@xxxxxx:/usr/local/vpnserver $ sudo ./vpncmd

vpncmd command - SoftEther VPN Command Line Management Utility
SoftEther VPN Command Line Management Utility (vpncmd command)
Version 4.28 Build 9669 (English)
Compiled 2018/09/11 12:23:27 by yagi at pc33
Copyright (c) SoftEther VPN Project. All Rights Reserved.

By using vpncmd program, the following can be achieved.

1. Management of VPN Server or VPN Bridge
2. Management of VPN Client
3. Use of VPN Tools (certificate creation and Network Traffic Speed Test Tool)

Select 1, 2 or 3: 1

Specify the host name or IP address of the computer that the destination VPN Server or VPN Bridge is operating on.
By specifying according to the format 'host name:port number', you can also specify the port number.
(When the port number is unspecified, 443 is used.)
If nothing is input and the Enter key is pressed, the connection will be made to the port number 8888 of localhost (this computer).
Hostname of IP Address of Destination: ラズパイのローカルIP

If connecting to the server by Virtual Hub Admin Mode, please input the Virtual Hub name.
If connecting by server admin mode, please press Enter without inputting anything.
Specify Virtual Hub Name:
Connection has been established with VPN Server "xxx.xxx.xxx.xxx" (port 443).

You have administrator privileges for the entire VPN Server.


VPN Server/DEFAULT>usercreate

userpasswordset

psecenable

L2TP over IPsec  だけYES

IPsec 事前共有鍵の文字列:てきとー

ServerPasswordSet
管理者用のパスをセットしておきましょう。デフォルトだと何もないらしいです。

ルーターのポートフォワーディング
isakmp/UDP(ポート番号 500)
ipsec-nat-t/UDP(ポート番号 4500)

ファイヤーウォールはUFWを使いました。
Ubuntuの標準ですね。
基本的にはルータとおなじだけど
esp プロトコル(プロトコル番号 50)
l2tp/UDP(ポート番号 1701)
をいれておきます。

あとはサンバやRDP、SSHも通して置くといいでしょう。
Posted at 2019/01/19 21:59:28 | コメント(0) | トラックバック(0) | 日記

プロフィール

「[整備] #YZF-R1 レギュレーター不調 https://minkara.carview.co.jp/userid/346526/car/796844/7214535/note.aspx
何シテル?   02/02 22:46
コロナ影響下の在宅で時間ができたので運動して15kg以上痩せました。あと10kg痩せたいけど中々難しいね。自炊もアメリカで一人暮らし時並みに積極的に・・うまいも...
みんカラ新規会員登録

ユーザー内検索

<< 2019/1 >>

  12345
6789101112
131415161718 19
20212223242526
2728293031  

愛車一覧

ホンダ CBR600RR ホンダ CBR600RR
CBR600RRからCBR600RRへ、15年登録の13年式から24年登録の24年式へ ...
スバル WRX STI スバル WRX STI
STIコンプリートカーに乗るのもおそらく、これで最後かな?次の車は当分先になると思います ...
モンテッサ COTA-4RT モンテッサ COTA-4RT
超本格トライアル車。。2013年の標準モデルは、すでに売れきれたとの連絡があったので限定 ...
ヤマハ YZF-R1 ヤマハ YZF-R1
09 YZF-R1 北米仕様車です。 2023年 モテギでKTMと走っても結構抜くのに ...
ヘルプ利用規約サイトマップ
© LY Corporation