LoginSignup
9
19

More than 3 years have passed since last update.

Raspberry PiをVPNサーバとする

Last updated at Posted at 2018-09-09

PiVPNのインストール

日本のサイトではSoftEtherをインストールする例がよく紹介されているが、ここではより導入が簡単なPiVPNを、自宅のRaspberry Piにインストールする。Raspberry PiのIPアドレスは固定されているものとする。

以下のコマンドにより、PiVPNのインストール画面が表示される:

$ curl -L https://install.pivpn.io | bash

あとは質問に答えていくだけだ。

  • Do you want to use your current network settings as a static address?
    Yes.

  • Choose a local user that will hold your ovpn configurations.
    piなど、適当に選択する。

  • Do you want to enable unattended upgrades of security patches to this server?
    Yes. (セキュリティ上重要なアップデートを自動で実施する)

  • Choose a protocol (press space to select). Please only choose TCP if you know why you need TCP.
    UDPを選択する。

  • Enter a new value or hit 'Enter' to retain the default
    Enter.

  • Choose your desired level of encryption
    2048.

  • OpenVPN 2.4 brings support for stronger key exchange using Elliptic Curves and encrypted control channel, along with faster LZ4 compression.
    No.

  • Will clients use a Public IP or DNS Name to connect to your server (press space to select)?
    "Use this public IP".

  • Select the DNS Provider for your VPN Clients
    Google.

  • It is strongly recommended you reboot after installation. Would you like to reboot now?
    Yes.

再起動したら以下のコマンドによりovpnプロファイルを作成する:

$ pivpn add
Enter a Name for the Client:  pivpn-client
Enter the password for the client:
Enter the password again to verify:

ovpnsディレクトリの中にプロファイルが作成されているので、VPNを利用するクライアント端末にファイルを移動する。

残りの作業としては、クライアント端末でのプロファイルのインストール、および、ルーター等でのポート転送の設定をおこなえば、スマホなどからVPNで接続可能となる。

9
19
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
19