GNU/Linux >> Linux Esercitazione >  >> Debian

Come installare il server OpenVPN su Debian 11

In questo tutorial, ti mostreremo come installare OpenVPN Server su Debian 11. Per chi non lo sapesse, OpenVPN è un servizio utilizzato per creare reti private virtuali. , ti permette di collegare due nodi che sono connessi su Internet ma non nello stesso posto. Tutti i dispositivi connessi a una rete privata virtuale si comportano come se fossero collegati alla tua rete locale. I pacchetti inviati attraverso il tunnel VPN sono crittografati con crittografia AES a 256 bit che rende impossibile il furto dei dati.

Questo articolo presuppone che tu abbia almeno una conoscenza di base di Linux, sappia come usare la shell e, soprattutto, che ospiti il ​​tuo sito sul tuo VPS. L'installazione è abbastanza semplice e presuppone che tu sono in esecuzione nell'account root, in caso contrario potrebbe essere necessario aggiungere 'sudo ' ai comandi per ottenere i privilegi di root. Ti mostrerò passo dopo passo l'installazione del server OpenVPN su una Debian 11 (Bullseye).

Prerequisiti

  • Un server che esegue uno dei seguenti sistemi operativi:Debian 11 (Bullseye).
  • Si consiglia di utilizzare una nuova installazione del sistema operativo per evitare potenziali problemi.
  • Un non-root sudo user o accedere all'root user . Ti consigliamo di agire come non-root sudo user , tuttavia, poiché puoi danneggiare il tuo sistema se non stai attento quando agisci come root.

Installa il server OpenVPN su Debian 11 Bullseye

Passaggio 1. Prima di installare qualsiasi software, è importante assicurarsi che il sistema sia aggiornato eseguendo il seguente apt comandi nel terminale:

sudo apt update
sudo apt upgrade

Passaggio 2. Installazione del server OpenVPN su Debian 11.

Ora scarichiamo il server OpenVPN del programma di installazione degli script da GitHub usando curl comando:

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

Dopo il download, esegui i permessi per lo script ed eseguilo:

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

Ti verrà chiesto di inserire alcune informazioni:

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:

Ci verrà chiesto se vogliamo abilitare IPv6 che è disabilitato per impostazione predefinita:

Checking for IPv6 connectivity...

Your host appears to have IPv6 connectivity.

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

Per impostazione predefinita, OpenVPN utilizza la porta 1194, se desideri utilizzare una porta specifica, premi 2 e poi:

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

Quindi, imposta il protocollo che OpenVPN utilizzerà:

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

Ora devi selezionare un provider 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

Ora ti verrà chiesto se desideri utilizzare la compressione. Verrai informato che non è consigliato ma è una tua scelta:

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

Se sai davvero come manipolare OpenVPN puoi personalizzare le opzioni di crittografia. Se non lo fai, non farlo:

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

Quindi inizierà l'intero processo di installazione. Dopodiché, aggiungi un nuovo client, vedrai la seguente schermata di output in cui dovrai definire il Nome del Cliente:

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

Successivamente, ti verrà chiesto se vuoi proteggere il file di configurazione con una password:

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

Infine, sarai informato che il processo è andato a buon fine:

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.

Una volta completata l'installazione del setup, non devi far altro che scaricare idroot.ovpn file e copialo sul client in modo che possa connettersi dalla GUI del tuo gestore di connessione o tramite il terminale utilizzando il comando seguente:

openvpn [openvpnfile]

Passaggio 3. Configura Firewall.

Per impostazione predefinita, OpenVPN utilizza la porta 1194, devi aprire le porte richieste 1194:

sudo ufw allow 1194
sudo ufw enable

Congratulazioni! Hai installato con successo OpenVPN. Grazie per aver utilizzato questo tutorial per installare l'ultima versione del server OpenVPN su Debian 11 Bullseye. Per ulteriore aiuto o informazioni utili, ti consigliamo di controllare il Sito Web OpenVPN.


Debian
  1. Come installare Redis Server su Debian 11

  2. Come installare MySQL 8.0 / 5.7 su Debian 11 / Debian 10

  3. Come installare ProFTPD su Debian 8

  4. Come installare OpenVPN su Ubuntu 18.04

  5. Come installare ClickHouse su Debian 9

Come installare FastPanel su Debian 11

Come installare I2P su Debian Server:

Come installare OpenVPN su Debian 9 Stretch

Come installare VNC su Debian 10

Come installare OpenVPN su Debian 10

Come installare il server VNC su Debian 11