I have been struggling to configure an OpenVPN server for some days.
The server is behind NAT i.e. it is connect via LAN cable after the router.
Basically what I am trying to achieve is the following - I want to set up a VPN server using OpenVPN and EasyRSA 3.0 on a Windows Server 2016 computer. I would like to access the server remotely i.e. access the server from another network in another city.
I followed a tutorial for Windows but unfortunately I cannot connect remotely to the server.
This the tutorial I followed: Tutorial
Below is my client configuration file. I placed the public IP of the server computer here, all the certificates needed and the port.
I allowed the Inbound Traffic in the firewall on port 1175 on the server.
I port forwarded port 1175 to the local IP of the server.
Code: Select all
##############################################
# Sample client-side OpenVPN 2.0 config file #
# for connecting to multi-client server. #
# #
# This configuration can be used by multiple #
# clients, however each client should have #
# its own cert and key files. #
# #
# On Windows, you might want to rename this #
# file so it has a .ovpn extension #
##############################################
# Specify that we are a client and that we
# will be pulling certain config file directives
# from the server.
client
# Use the same setting as you are using on
# the server.
# On most systems, the VPN will not function
# unless you partially or fully disable
# the firewall for the TUN/TAP interface.
;dev tap
dev tun
# Windows needs the TAP-Win32 adapter name
# from the Network Connections panel
# if you have more than one. On XP SP2,
# you may need to disable the firewall
# for the TAP adapter.
;dev-node MyTap
# Are we connecting to a TCP or
# UDP server? Use the same setting as
# on the server.
;proto tcp
proto udp
# The hostname/IP and port of the server.
# You can have multiple remote entries
# to load balance between the servers.
;remote my-server-1 1194
remote #.#.#.# 1175 # Public IP of the server
# Choose a random host from the remote
# list for load-balancing. Otherwise
# try hosts in the order specified.
;remote-random
# Keep trying indefinitely to resolve the
# host name of the OpenVPN server. Very useful
# on machines which are not permanently connected
# to the internet such as laptops.
resolv-retry infinite
# Most clients don't need to bind to
# a specific local port number.
nobind
# Downgrade privileges after initialization (non-Windows only)
;user nobody
;group nobody
# Try to preserve some state across restarts.
persist-key
persist-tun
# If you are connecting through an
# HTTP proxy to reach the actual OpenVPN
# server, put the proxy server/IP and
# port number here. See the man page
# if your proxy server requires
# authentication.
;http-proxy-retry # retry on connection failures
;http-proxy [proxy server] [proxy port #]
# Wireless networks often produce a lot
# of duplicate packets. Set this flag
# to silence duplicate packet warnings.
;mute-replay-warnings
# SSL/TLS parms.
# See the server config file for more
# description. It's best to use
# a separate .crt/.key file pair
# for each client. A single ca
# file can be used for all clients.
;ca ca.crt
;cert client.crt
;key client.key
# Verify server certificate by checking that the
# certificate has the correct key usage set.
# This is an important precaution to protect against
# a potential attack discussed here:
# http://openvpn.net/howto.html#mitm
#
# To use this feature, you will need to generate
# your server certificates with the keyUsage set to
# digitalSignature, keyEncipherment
# and the extendedKeyUsage to
# serverAuth
# EasyRSA can do this for you.
remote-cert-tls server
# If a tls-auth key is used on the server
# then every client must also have the key.
;tls-auth ta.key 1
key-direction 1
# Select a cryptographic cipher.
# If the cipher option is used on the server
# then you must also specify it here.
# Note that v2.4 client/server will automatically
# negotiate AES-256-GCM in TLS mode.
# See also the data-ciphers option in the manpage
cipher AES-256-CBC
# Enable compression on the VPN link.
# Don't enable this unless it is also
# enabled in the server config file.
#comp-lzo
# Set log file verbosity.
verb 3
# Silence repeating messages
;mute 20
<ca>
#### Code Here
</ca>
<cert>
#### Code Here
</cert>
<key>
#### Code Here
</key>
<tls-auth>
#### Code Here
</tls-auth>
Code: Select all
config
Code: Select all
connect
Code: Select all
10.x.x.x
Code: Select all
# Which local IP address should OpenVPN
# listen on? (optional)
;local a.b.c.d
Log file of the client.
Code: Select all
Tue Mar 30 09:58:25 2021 OpenVPN 2.4.6 x86_64-w64-mingw32 [SSL (OpenSSL)] [LZO] [LZ4] [PKCS11] [AEAD] built on Apr 26 2018
Tue Mar 30 09:58:25 2021 Windows version 6.2 (Windows 8 or greater) 64bit
Tue Mar 30 09:58:25 2021 library versions: OpenSSL 1.1.0h 27 Mar 2018, LZO 2.10
Enter Management Password:
Tue Mar 30 09:58:25 2021 MANAGEMENT: TCP Socket listening on [AF_INET]127.0.0.1:25341
Tue Mar 30 09:58:25 2021 Need hold release from management interface, waiting...
Tue Mar 30 09:58:25 2021 MANAGEMENT: Client connected from [AF_INET]127.0.0.1:25341
Tue Mar 30 09:58:25 2021 MANAGEMENT: CMD 'state on'
Tue Mar 30 09:58:25 2021 MANAGEMENT: CMD 'log all on'
Tue Mar 30 09:58:25 2021 MANAGEMENT: CMD 'echo all on'
Tue Mar 30 09:58:25 2021 MANAGEMENT: CMD 'bytecount 5'
Tue Mar 30 09:58:25 2021 MANAGEMENT: CMD 'hold off'
Tue Mar 30 09:58:25 2021 MANAGEMENT: CMD 'hold release'
Tue Mar 30 09:58:27 2021 MANAGEMENT: CMD 'password [...]'
Tue Mar 30 09:58:27 2021 WARNING: this configuration may cache passwords in memory -- use the auth-nocache option to prevent this
Tue Mar 30 09:58:27 2021 Outgoing Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
Tue Mar 30 09:58:27 2021 Incoming Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
Tue Mar 30 09:58:27 2021 TCP/UDP: Preserving recently used remote address: [AF_INET]79.134.183.3:1175
Tue Mar 30 09:58:27 2021 Socket Buffers: R=[65536->65536] S=[65536->65536]
Tue Mar 30 09:58:27 2021 UDP link local: (not bound)
Tue Mar 30 09:58:27 2021 UDP link remote: [AF_INET]79.134.183.3:1175
Tue Mar 30 09:58:27 2021 MANAGEMENT: >STATE:1617087507,WAIT,,,,,,
Tue Mar 30 09:59:27 2021 TLS Error: TLS key negotiation failed to occur within 60 seconds (check your network connectivity)
Tue Mar 30 09:59:27 2021 TLS Error: TLS handshake failed
Tue Mar 30 09:59:27 2021 SIGUSR1[soft,tls-error] received, process restarting
Tue Mar 30 09:59:27 2021 MANAGEMENT: >STATE:1617087567,RECONNECTING,tls-error,,,,,
Tue Mar 30 09:59:27 2021 Restart pause, 5 second(s)
Tue Mar 30 09:59:30 2021 SIGTERM[hard,init_instance] received, process exiting
Tue Mar 30 09:59:30 2021 MANAGEMENT: >STATE:1617087570,EXITING,init_instance,,,,,