GNU/Linux >> Linux の 問題 >  >> Debian

Debian11にOpenVPNサーバーをインストールする方法

このチュートリアルでは、Debian 11にOpenVPNサーバーをインストールする方法を紹介します。知らない人のために、OpenVPNは仮想プライベートネットワークの作成に使用されるサービスです。 、インターネット経由で接続されているが同じ場所にない2つのノードをリンクできます。仮想プライベートネットワークに接続されているすべてのデバイスは、ローカルエリアネットワークにリンクされているかのように動作します。VPNトンネルを介して送信されるパケット256ビットのAES暗号化で暗号化されているため、データの盗難は不可能です。

この記事は、少なくともLinuxの基本的な知識があり、シェルの使用方法を知っていること、そして最も重要なこととして、サイトを独自のVPSでホストしていることを前提としています。インストールは非常に簡単で、ルートアカウントで実行されていますが、そうでない場合は、'sudoを追加する必要があります。 ‘ルート権限を取得するコマンドに。 Debian 11(Bullseye)にOpenVPNサーバーを段階的にインストールする方法を紹介します。

前提条件

  • 次のオペレーティングシステムのいずれかを実行しているサーバー:Debian 11(Bullseye)。
  • 潜在的な問題を防ぐために、OSの新規インストールを使用することをお勧めします。
  • non-root sudo user またはroot userへのアクセス 。 non-root sudo userとして行動することをお勧めします ただし、ルートとして機能するときに注意しないと、システムに害を及ぼす可能性があるためです。

Debian11BullseyeにOpenVPNサーバーをインストールする

ステップ1.ソフトウェアをインストールする前に、次のaptを実行して、システムが最新であることを確認することが重要です。 ターミナルのコマンド:

sudo apt update
sudo apt upgrade

ステップ2.Debian11にOpenVPNサーバーをインストールします。

次に、curlを使用してGitHubからスクリプトインストーラーOpenVPNサーバーをダウンロードします。 コマンド:

curl -O https://raw.githubusercontent.com/angristan/openvpn-install/master/openvpn-install.sh

ダウンロード後、スクリプトへのアクセス許可を実行して実行します:

chmod +x openvpn-install.sh
sudo ./openvpn-install.sh

いくつかの情報を入力するように求められます:

Welcome to the OpenVPN installer!
The git repository is available at: https://github.com/angristan/openvpn-install

I need to ask you a few questions before starting the setup.
You can leave the default options and just press enter if you are ok with them.

I need to know the IPv4 address of the network interface you want OpenVPN listening to.
Unless your server is behind NAT, it should be your public IPv4 address.
IP address:

デフォルトで無効になっているIPv6を有効にするかどうかを尋ねられます:

Checking for IPv6 connectivity...

Your host appears to have IPv6 connectivity.

Do you want to enable IPv6 support (NAT)? [y/n]: y

デフォルトでは、OpenVPNはポート1194を使用します。特定のポートを使用する場合は、2を押してから:

を押します。
What port do you want OpenVPN to listen to?
   1) Default: 1194
   2) Custom
   3) Random [49152-65535]
Port choice [1-3]: 1

次に、OpenVPNが使用するプロトコルを設定します:

What protocol do you want OpenVPN to use?
UDP is faster. Unless it is not available, you shouldn't use TCP.
   1) UDP
   2) TCP
Protocol [1-2]: 2

ここで、DNSプロバイダーを選択する必要があります:

What DNS resolvers do you want to use with the VPN?
   1) Current system resolvers (from /etc/resolv.conf)
   2) Self-hosted DNS Resolver (Unbound)
   3) Cloudflare (Anycast: worldwide)
   4) Quad9 (Anycast: worldwide)
   5) Quad9 uncensored (Anycast: worldwide)
   6) FDN (France)
   7) DNS.WATCH (Germany)
   8) OpenDNS (Anycast: worldwide)
   9) Google (Anycast: worldwide)
   10) Yandex Basic (Russia)
   11) AdGuard DNS (Anycast: worldwide)
   12) NextDNS (Anycast: worldwide)
   13) Custom
DNS [1-12]: 9

ここで、圧縮を使用するかどうかを尋ねられます。推奨されていないことが通知されますが、選択してください:

Do you want to use compression? It is not recommended since the VORACLE attack make use of it.
Enable compression? [y/n]: n

OpenVPNの操作方法を本当に知っている場合は、暗号化オプションをカスタマイズできます。そうでない場合は、行わないでください:

Do you want to customize encryption settings?
Unless you know what you're doing, you should stick with the default parameters provided by the script.
Note that whatever you choose, all the choices presented in the script are safe. (Unlike OpenVPN's defaults)
See https://github.com/angristan/openvpn-install#security-and-encryption to learn more.

Customize encryption settings? [y/n]: n

次に、インストールプロセス全体が開始されます。その後、新しいクライアントを追加すると、クライアント名を定義する必要がある次の出力画面が表示されます。

Okay, that was all I needed. We are ready to setup your OpenVPN server now.
You will be able to generate a client at the end of the installation.
Press any key to continue...

Tell me a name for the client.
The name must consist of alphanumeric character. It may also include an underscore or a dash.
Client name: idroot

次に、構成ファイルをパスワードで保護するかどうかを尋ねられます:

Do you want to protect the configuration file with a password?
(e.g. encrypt the private key with a password)
   1) Add a passwordless client
   2) Use a password for the client
Select an option [1-2]: 1

最後に、プロセスが成功したことが通知されます:

Client idroot added.

The configuration file has been written to /home/user/idroot.ovpn.
Download the .ovpn file and import it in your OpenVPN client.

セットアップのインストールが完了したら、idroot.ovpnをダウンロードする必要があります。 ファイルを作成してクライアントにコピーし、接続マネージャーのGUIから、または以下のコマンドを使用してターミナル経由で接続できるようにします。

openvpn [openvpnfile]

手順3.ファイアウォールを構成します。

デフォルトでは、OpenVPNはポート1194を使用します。必要なポート1194を開く必要があります:

sudo ufw allow 1194
sudo ufw enable

おめでとうございます!OpenVPNが正常にインストールされました。このチュートリアルを使用してDebian 11 Bullseyeに最新バージョンのOpenVPNサーバーをインストールしていただきありがとうございます。追加のヘルプや役立つ情報については、公式を確認することをお勧めしますOpenVPNWebサイト。


Debian
  1. Debian11にRedisサーバーをインストールする方法

  2. Debian8にProFTPDをインストールする方法

  3. Ubuntu18.04にOpenVPNをインストールする方法

  1. Debian10にOpenVPNサーバーをインストールして設定する方法

  2. MySQL 8.0/5.7をDebian11/Debian10にインストールする方法

  3. Debian9にOdoo12をインストールする方法

  1. MySQLサーバーをDebian9にインストールする方法

  2. Nextcloud14をDebian9にインストールする方法

  3. ClickHouseをDebian9にインストールする方法