¿Cómo estais? aquí Fran. Os traigo un nuevo post sobre el sistema operativo mas molón. Encantado linuxeros.
Suponiendo que uno de sus clientes quiera asegurar la conexión a su servidor. El cliente ha configurado el servidor OpenVPN en su red y le ha suministrado el archivo de configuración del cliente. En este caso, sólo tiene que instalar la aplicación cliente OpenVPN en su ordenador y conectarse a una red VPN remota.
Este tutorial le ayudará a instalar el software del cliente OpenVPN y conectarse a una red vpn remota.
requisitos previos
- Debe tener el servidor OpenVPN ejecutado a distancia
- Debe tener un archivo de configuración del cliente OpenVPN
Paso 1: instalar el cliente OpenVPN
En primer lugar, inicie sesión en la máquina cliente y el correspondiente paquete OpenVPN con el orden siguiente:
sudo apt update sudo apt install openvpn -y
Paso 2: conéctese al servidor OpenVPN
Copie el archivo de configuración del cliente en la máquina y ejecute el siguiente para conectarse al servidor OpenVPN:
openvpn --config client.ovpn
Debería ver la salida siguiente:
Sat Feb 29 15:39:18 2020 TCP/UDP: Preserving recently used remote address: [AF_INET]69.87.218.145:1194 Sat Feb 29 15:39:18 2020 Socket Buffers: R=[212992->212992] S=[212992->212992] Sat Feb 29 15:39:18 2020 UDP link local: (not bound) Sat Feb 29 15:39:18 2020 UDP link remote: [AF_INET]69.87.218.145:1194 Sat Feb 29 15:39:18 2020 TLS: Initial packet from [AF_INET]69.87.218.145:1194, sid=6d27e1cb 524bd8cd Sat Feb 29 15:39:18 2020 VERIFY OK: depth=1, CN=Easy-RSA CA Sat Feb 29 15:39:18 2020 VERIFY OK: depth=0, CN=linux-server Sat Feb 29 15:39:18 2020 Control Channel: TLSv1.3, cipher TLSv1.3 TLS_AES_256_GCM_SHA384, 2048 bit RSA Sat Feb 29 15:39:18 2020 [linux-server] Peer Connection Initiated with [AF_INET]69.87.218.145:1194 Sat Feb 29 15:39:19 2020 SENT CONTROL [linux-server]: 'PUSH_REQUEST' (status=1) Sat Feb 29 15:39:19 2020 PUSH: Received control message: 'PUSH_REPLY,redirect-gateway def1,dhcp-option DNS 208.67.222.222,dhcp-option DNS 208.67.220.220,route 10.8.0.1,topology net30,ping 20,ping-restart 60,ifconfig 10.8.0.6 10.8.0.5,peer-id 0,cipher AES-256-GCM' Sat Feb 29 15:39:19 2020 OPTIONS IMPORT: timers and/or timeouts modified Sat Feb 29 15:39:19 2020 OPTIONS IMPORT: --ifconfig/up options modified Sat Feb 29 15:39:19 2020 OPTIONS IMPORT: route options modified
Paso 3: Verificar la conexión
Después de una conexión exitosa, OpenVPN asignará una dirección IP en su sistema. Puede comprobarlo con el siguiente orden:
ip a show tun0
salida:
4: tun0: mtu 1500 qdisc fq_codel state UNKNOWN group default qlen 100 link/none inet 10.8.0.6 peer 10.8.0.5/32 scope global tun0 valid_lft forever preferred_lft forever inet6 fe80::7226:57b1:f101:313b/64 scope link stable-privacy valid_lft forever preferred_lft forever
También puede consultar el registro del servidor OpenVPN para verificar el estado de la conexión:
tail -f /var/log/openvpn.log
Debería ver la salida siguiente:
Fri Feb 21 15:39:18 2020 45.58.34.83:37445 Control Channel: TLSv1.3, cipher TLSv1.3 TLS_AES_256_GCM_SHA384, 2048 bit RSA Fri Feb 21 15:39:18 2020 45.58.34.83:37445 [client] Peer Connection Initiated with [AF_INET]45.58.34.83:37445 Fri Feb 21 15:39:18 2020 client/45.58.34.83:37445 MULTI_sva: pool returned IPv4=10.8.0.6, IPv6=(Not enabled) Fri Feb 21 15:39:18 2020 client/45.58.34.83:37445 MULTI: Learn: 10.8.0.6 -> client/45.58.34.83:37445 Fri Feb 21 15:39:18 2020 client/45.58.34.83:37445 MULTI: primary virtual IP for client/45.58.34.83:37445: 10.8.0.6 Fri Feb 21 15:39:19 2020 client/45.58.34.83:37445 PUSH: Received control message: 'PUSH_REQUEST' Fri Feb 21 15:39:19 2020 client/45.58.34.83:37445 SENT CONTROL [client]: 'PUSH_REPLY,redirect-gateway def1,dhcp-option DNS 208.67.222.222,dhcp-option DNS 208.67.220.220,route 10.8.0.1,topology net30,ping 20,ping-restart 60,ifconfig 10.8.0.6 10.8.0.5,peer-id 0,cipher AES-256-GCM' (status=1) Fri Feb 21 15:39:19 2020 client/45.58.34.83:37445 Data Channel: using negotiated cipher 'AES-256-GCM' Fri Feb 21 15:39:19 2020 client/45.58.34.83:37445 Outgoing Data Channel: Cipher 'AES-256-GCM' initialized with 256 bit key Fri Feb 21 15:39:19 2020 client/45.58.34.83:37445 Incoming Data Channel: Cipher 'AES-256-GCM' initialized with 256 bit key
conclusión
Todo hecho, su sistema está conectado a la red remota OpenVPN. Ahora, no necesita una IP pública de las máquinas de red remotas, ahora puede acceder directamente a sistemas de red remotos con IP LAN.
Este Blog lo escribimos para colaborar y servir de ayuda a la gente Linux. Esperamos que os guste.