Ok, so I am BRAND NEW to trying to do anything like this, so please bear with me...
First of all, my goal is to simply setup the VPN so I can access my server shares remotely from anywhere I have an internet connection. That said, I have stumbled my way through setting up OpenVPN to the point where it is connected, it seems to be working correctly other than the fact that I feel like I had to do a LOT of tweaks to Windows, and of course the biggest problem, it doesn't work unless the Windows firewall on the server is turned off. Both the client laptop and the server desktop are running Windows 7 ultimate. I have read through so many internet posts and forums trying different things it's ridiculous...
So, here is what I have done so far:
- Router has port 1194 forwarded to the local IP of the server machine, that is all I changed on the router.
- I read through the example here: https://forums.openvpn.net/topic7806.html and made all the Windows 7 tweaks on BOTH client and server since I wasn't sure where they were supposed to be made. Do I need to do the tweaks on both server and client, just one, or what?
- Internet connection sharing is enabled on both the client and server between the VPN network and the internet connection, and all services are checked and enabled. Is this actually necessary to do at all?
- I had to push "route 0.0.0.0 0.0.0.0" to the client in order to allow me to change the "network type" to a work network, and I had to set a default gateway on the server (10.8.0.2) to allow me to do the same on the server machine.
- I created firewall rules on both firewalls for inbound connections to allow ICMPv4 on all networks - this is the only way I can ping between the client and server and vice versa. Without these rules I cannot ping anything. Are they necessary or is this a work around for another problem I am fighting?
Below are my config files and logs when I connect (half stripped of comments as I work through the various options). Let me know if you see anything that shouldn't be there/could be done better or different. Obviously my biggest concern is why I can't access the shares on the server when the firewall is turned on...
Server:
local 192.168.1.5
port 1194
proto udp
dev tun
ca "C:\\Program Files\\OpenVPN\\config\\ca.crt"
cert "C:\\Program Files\\OpenVPN\\config\\server.crt"
key "C:\\Program Files\\OpenVPN\\config\\server.key"
dh "C:\\Program Files\\OpenVPN\\config\\dh1024.pem"
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "route 0.0.0.0 0.0.0.0"
push "route remote_host 255.255.255.255 net_gateway"
push "route 192.168.1.5 255.255.255.255 10.8.0.5"
# To assign specific IP addresses to specific
# clients or if a connecting client has a private
# subnet behind it that should also have VPN access,
# use the subdirectory "ccd" for client-specific
# configuration files (see man page for more info).
# EXAMPLE: Suppose the client
# having the certificate common name "Thelonious"
# also has a small subnet behind his connecting
# machine, such as 192.168.40.128/255.255.255.248.
# First, uncomment out these lines:
;client-config-dir ccd
;route 192.168.40.128 255.255.255.248
# Then create a file ccd/Thelonious with this line:
# iroute 192.168.40.128 255.255.255.248
# This will allow Thelonious' private subnet to
# access the VPN. This example will only work
# if you are routing, not bridging, i.e. you are
# using "dev tun" and "server" directives.
# EXAMPLE: Suppose you want to give
# Thelonious a fixed VPN IP address of 10.9.0.1.
# First uncomment out these lines:
;client-config-dir ccd
;route 10.9.0.0 255.255.255.252
# Then add this line to ccd/Thelonious:
# ifconfig-push 10.9.0.1 10.9.0.2
# Suppose that you want to enable different
# firewall access policies for different groups
# of clients. There are two methods:
# (1) Run multiple OpenVPN daemons, one for each
# group, and firewall the TUN/TAP interface
# for each group/daemon appropriately.
# (2) (Advanced) Create a script to dynamically
# modify the firewall in response to access
# from different clients. See man
# page for more info on learn-address script.
;learn-address ./script
# If enabled, this directive will configure
# all clients to redirect their default
# network gateway through the VPN, causing
# all IP traffic such as web browsing and
# and DNS lookups to go through the VPN
# (The OpenVPN server machine may need to NAT
# or bridge the TUN/TAP interface to the internet
# in order for this to work properly).
;push "redirect-gateway def1 bypass-dhcp"
# Certain Windows-specific network settings
# can be pushed to clients, such as DNS
# or WINS server addresses. CAVEAT:
# http://openvpn.net/faq.html#dhcpcaveats
# The addresses below refer to the public
# DNS servers provided by opendns.com.
;push "dhcp-option DNS 208.67.222.222"
;push "dhcp-option DNS 208.67.220.220"
# Uncomment this directive to allow different
# clients to be able to "see" each other.
# By default, clients will only see the server.
# To force clients to only see the server, you
# will also need to appropriately firewall the
# server's TUN/TAP interface.
;client-to-client
# Uncomment this directive if multiple clients
# might connect with the same certificate/key
# files or common names. This is recommended
# only for testing purposes. For production use,
# each client should have its own certificate/key
# pair.
#
# IF YOU HAVE NOT GENERATED INDIVIDUAL
# CERTIFICATE/KEY PAIRS FOR EACH CLIENT,
# EACH HAVING ITS OWN UNIQUE "COMMON NAME",
# UNCOMMENT THIS LINE OUT.
;duplicate-cn
# The keepalive directive causes ping-like
# messages to be sent back and forth over
# the link so that each side knows when
# the other side has gone down.
# Ping every 10 seconds, assume that remote
# peer is down if no ping received during
# a 120 second time period.
keepalive 10 120
# For extra security beyond that provided
# by SSL/TLS, create an "HMAC firewall"
# to help block DoS attacks and UDP port flooding.
#
# Generate with:
# openvpn --genkey --secret ta.key
#
# The server and each client must have
# a copy of this key.
# The second parameter should be '0'
# on the server and '1' on the clients.
;tls-auth ta.key 0 # This file is secret
# Select a cryptographic cipher.
# This config item must be copied to
# the client config file as well.
;cipher BF-CBC # Blowfish (default)
;cipher AES-128-CBC # AES
;cipher DES-EDE3-CBC # Triple-DES
# Enable compression on the VPN link.
# If you enable it here, you must also
# enable it in the client config file.
comp-lzo
# The maximum number of concurrently connected
# clients we want to allow.
;max-clients 100
# It's a good idea to reduce the OpenVPN
# daemon's privileges after initialization.
#
# You can uncomment this out on
# non-Windows systems.
;user nobody
;group nobody
# The persist options will try to avoid
# accessing certain resources on restart
# that may no longer be accessible because
# of the privilege downgrade.
persist-key
persist-tun
# Output a short status file showing
# current connections, truncated
# and rewritten every minute.
status openvpn-status.log
# By default, log messages will go to the syslog (or
# on Windows, if running as a service, they will go to
# the "\Program Files\OpenVPN\log" directory).
# Use log or log-append to override this default.
# "log" will truncate the log file on OpenVPN startup,
# while "log-append" will append to it. Use one
# or the other (but not both).
;log openvpn.log
;log-append openvpn.log
# Set the appropriate level of log
# file verbosity.
#
# 0 is silent, except for fatal errors
# 4 is reasonable for general usage
# 5 and 6 can help to debug connection problems
# 9 is extremely verbose
verb 3
# Silence repeating messages. At most 20
# sequential messages of the same message
# category will be output to the log.
;mute 20
Client:
client
dev tun
proto udp
remote myhost.domain.org 1194
resolv-retry infinite
nobind
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
ca "C:\\Program Files\\OpenVPN\\config\\ca.crt"
cert "C:\\Program Files\\OpenVPN\\config\\client1.crt"
key "C:\\Program Files\\OpenVPN\\config\\client1.key"
ns-cert-type server
# If a tls-auth key is used on the server
# then every client must also have the key.
;tls-auth ta.key 1
# Select a cryptographic cipher.
# If the cipher option is used on the server
# then you must also specify it here.
;cipher x
# 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
Server Log:
Mon Jan 13 20:23:32 2014 OpenVPN 2.3.2 i686-w64-mingw32 [SSL (OpenSSL)] [LZO] [PKCS11] [eurephia] [IPv6] built on Aug 22 2013
Enter Management Password:
Mon Jan 13 20:23:32 2014 MANAGEMENT: TCP Socket listening on [AF_INET]127.0.0.1:25340
Mon Jan 13 20:23:32 2014 Need hold release from management interface, waiting...
Mon Jan 13 20:23:32 2014 MANAGEMENT: Client connected from [AF_INET]127.0.0.1:25340
Mon Jan 13 20:23:32 2014 MANAGEMENT: CMD 'state on'
Mon Jan 13 20:23:32 2014 MANAGEMENT: CMD 'log all on'
Mon Jan 13 20:23:32 2014 MANAGEMENT: CMD 'hold off'
Mon Jan 13 20:23:32 2014 MANAGEMENT: CMD 'hold release'
Mon Jan 13 20:23:32 2014 NOTE: your local LAN uses the extremely common subnet address 192.168.0.x or 192.168.1.x. Be aware that this might create routing conflicts if you connect to the VPN server from public locations such as internet cafes that use the same subnet.
Mon Jan 13 20:23:33 2014 Diffie-Hellman initialized with 1024 bit key
Mon Jan 13 20:23:33 2014 Socket Buffers: R=[8192->8192] S=[8192->8192]
Mon Jan 13 20:23:34 2014 do_ifconfig, tt->ipv6=0, tt->did_ifconfig_ipv6_setup=0
Mon Jan 13 20:23:34 2014 MANAGEMENT: >STATE:1389673414,ASSIGN_IP,,10.8.0.1,
Mon Jan 13 20:23:34 2014 open_tun, tt->ipv6=0
Mon Jan 13 20:23:34 2014 TAP-WIN32 device [VPN Connection] opened: \\.\Global\{8A80BB40-239E-4401-ACDD-4E42175FE0B4}.tap
Mon Jan 13 20:23:34 2014 TAP-Windows Driver Version 9.9
Mon Jan 13 20:23:34 2014 Notified TAP-Windows driver to set a DHCP IP/netmask of 10.8.0.1/255.255.255.252 on interface {8A80BB40-239E-4401-ACDD-4E42175FE0B4} [DHCP-serv: 10.8.0.2, lease-time: 31536000]
Mon Jan 13 20:23:34 2014 Sleeping for 10 seconds...
Mon Jan 13 20:23:44 2014 Successful ARP Flush on interface [17] {8A80BB40-239E-4401-ACDD-4E42175FE0B4}
Mon Jan 13 20:23:44 2014 MANAGEMENT: >STATE:1389673424,ADD_ROUTES,,,
Mon Jan 13 20:23:44 2014 C:\Windows\system32\route.exe ADD 10.8.0.0 MASK 255.255.255.0 10.8.0.2
Mon Jan 13 20:23:44 2014 ROUTE: CreateIpForwardEntry succeeded with dwForwardMetric1=30 and dwForwardType=4
Mon Jan 13 20:23:44 2014 Route addition via IPAPI succeeded [adaptive]
Mon Jan 13 20:23:44 2014 UDPv4 link local (bound): [AF_INET]192.168.1.5:1194
Mon Jan 13 20:23:44 2014 UDPv4 link remote: [undef]
Mon Jan 13 20:23:44 2014 MULTI: multi_init called, r=256 v=256
Mon Jan 13 20:23:44 2014 IFCONFIG POOL: base=10.8.0.4 size=62, ipv6=0
Mon Jan 13 20:23:44 2014 ifconfig_pool_read(), in='Client1,10.8.0.4', TODO: IPv6
Mon Jan 13 20:23:44 2014 succeeded -> ifconfig_pool_set()
Mon Jan 13 20:23:44 2014 IFCONFIG POOL LIST
Mon Jan 13 20:23:44 2014 Client1,10.8.0.4
Mon Jan 13 20:23:44 2014 Initialization Sequence Completed
Mon Jan 13 20:23:44 2014 MANAGEMENT: >STATE:1389673424,CONNECTED,SUCCESS,10.8.0.1,
Mon Jan 13 20:23:53 2014 X.X.X.X:49158 TLS: Initial packet from [AF_INET]X.X.X.X:49158, sid=6a1ef608 b3f723f8
Mon Jan 13 20:23:53 2014 X.X.X.X:49158 VERIFY OK: depth=1, C=US, ST=State, L=Location, O=OpenVPN, CN=host.domain, emailAddress=email@email.com
Mon Jan 13 20:23:53 2014 X.X.X.X:49158 VERIFY OK: depth=0, C=US, ST=State, O=OpenVPN, CN=Client1, emailAddress=email@email.com
Mon Jan 13 20:23:53 2014 X.X.X.X:49158 Data Channel Encrypt: Cipher 'BF-CBC' initialized with 128 bit key
Mon Jan 13 20:23:53 2014 X.X.X.X:49158 Data Channel Encrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
Mon Jan 13 20:23:53 2014 X.X.X.X:49158 Data Channel Decrypt: Cipher 'BF-CBC' initialized with 128 bit key
Mon Jan 13 20:23:53 2014 X.X.X.X:49158 Data Channel Decrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
Mon Jan 13 20:23:53 2014 X.X.X.X:49158 Control Channel: TLSv1, cipher TLSv1/SSLv3 DHE-RSA-AES256-SHA, 1024 bit RSA
Mon Jan 13 20:23:53 2014 X.X.X.X:49158 [Client1] Peer Connection Initiated with [AF_INET]X.X.X.X:49158
Mon Jan 13 20:23:53 2014 Client1/X.X.X.X:49158 MULTI_sva: pool returned IPv4=10.8.0.6, IPv6=(Not enabled)
Mon Jan 13 20:23:53 2014 Client1/X.X.X.X:49158 MULTI: Learn: 10.8.0.6 -> Client1/X.X.X.X:49158
Mon Jan 13 20:23:53 2014 Client1/X.X.X.X:49158 MULTI: primary virtual IP for Client1/X.X.X.X:49158: 10.8.0.6
Mon Jan 13 20:23:55 2014 Client1/X.X.X.X:49158 PUSH: Received control message: 'PUSH_REQUEST'
Mon Jan 13 20:23:55 2014 Client1/X.X.X.X:49158 send_push_reply(): safe_cap=940
Mon Jan 13 20:23:55 2014 Client1/X.X.X.X:49158 SENT CONTROL [Client1]: 'PUSH_REPLY,route 0.0.0.0 0.0.0.0,route remote_host 255.255.255.255 net_gateway,route 192.168.1.5 255.255.255.255 10.8.0.5,route 10.8.0.1,topology net30,ping 10,ping-restart 120,ifconfig 10.8.0.6 10.8.0.5' (status=1)
Client Log:
Mon Jan 13 20:23:17 2014 OpenVPN 2.3.2 x86_64-w64-mingw32 [SSL (OpenSSL)] [LZO] [PKCS11] [eurephia] [IPv6] built on Aug 22 2013
Enter Management Password:
Mon Jan 13 20:23:17 2014 MANAGEMENT: TCP Socket listening on [AF_INET]127.0.0.1:25340
Mon Jan 13 20:23:17 2014 Need hold release from management interface, waiting...
Mon Jan 13 20:23:18 2014 MANAGEMENT: Client connected from [AF_INET]127.0.0.1:25340
Mon Jan 13 20:23:18 2014 MANAGEMENT: CMD 'state on'
Mon Jan 13 20:23:18 2014 MANAGEMENT: CMD 'log all on'
Mon Jan 13 20:23:18 2014 MANAGEMENT: CMD 'hold off'
Mon Jan 13 20:23:18 2014 MANAGEMENT: CMD 'hold release'
Mon Jan 13 20:23:18 2014 Socket Buffers: R=[8192->8192] S=[8192->8192]
Mon Jan 13 20:23:18 2014 MANAGEMENT: >STATE:1389673398,RESOLVE,,,
Mon Jan 13 20:23:18 2014 UDPv4 link local: [undef]
Mon Jan 13 20:23:18 2014 UDPv4 link remote: [AF_INET]X.X.X.X:1194
Mon Jan 13 20:23:18 2014 MANAGEMENT: >STATE:1389673398,WAIT,,,
Mon Jan 13 20:23:18 2014 MANAGEMENT: >STATE:1389673398,AUTH,,,
Mon Jan 13 20:23:18 2014 TLS: Initial packet from [AF_INET]X.X.X.X:1194, sid=76ba19a4 f607202c
Mon Jan 13 20:23:18 2014 VERIFY OK: depth=1, C=US, ST=State, L=Location, O=OpenVPN, CN=host.domain, emailAddress=email@email.com
Mon Jan 13 20:23:18 2014 VERIFY OK: nsCertType=SERVER
Mon Jan 13 20:23:18 2014 VERIFY OK: depth=0, C=US, ST=State, O=OpenVPN, CN=Server, emailAddress=email@email.com
Mon Jan 13 20:23:18 2014 Data Channel Encrypt: Cipher 'BF-CBC' initialized with 128 bit key
Mon Jan 13 20:23:18 2014 Data Channel Encrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
Mon Jan 13 20:23:18 2014 Data Channel Decrypt: Cipher 'BF-CBC' initialized with 128 bit key
Mon Jan 13 20:23:18 2014 Data Channel Decrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
Mon Jan 13 20:23:18 2014 Control Channel: TLSv1, cipher TLSv1/SSLv3 DHE-RSA-AES256-SHA, 1024 bit RSA
Mon Jan 13 20:23:18 2014 [Server] Peer Connection Initiated with [AF_INET]X.X.X.X:1194
Mon Jan 13 20:23:19 2014 MANAGEMENT: >STATE:1389673399,GET_CONFIG,,,
Mon Jan 13 20:23:20 2014 SENT CONTROL [Server]: 'PUSH_REQUEST' (status=1)
Mon Jan 13 20:23:20 2014 PUSH: Received control message: 'PUSH_REPLY,route 0.0.0.0 0.0.0.0,route remote_host 255.255.255.255 net_gateway,route 192.168.1.5 255.255.255.255 10.8.0.5,route 10.8.0.1,topology net30,ping 10,ping-restart 120,ifconfig 10.8.0.6 10.8.0.5'
Mon Jan 13 20:23:20 2014 OPTIONS IMPORT: timers and/or timeouts modified
Mon Jan 13 20:23:20 2014 OPTIONS IMPORT: --ifconfig/up options modified
Mon Jan 13 20:23:20 2014 OPTIONS IMPORT: route options modified
Mon Jan 13 20:23:20 2014 do_ifconfig, tt->ipv6=0, tt->did_ifconfig_ipv6_setup=0
Mon Jan 13 20:23:20 2014 MANAGEMENT: >STATE:1389673400,ASSIGN_IP,,10.8.0.6,
Mon Jan 13 20:23:20 2014 open_tun, tt->ipv6=0
Mon Jan 13 20:23:20 2014 TAP-WIN32 device [VPN Connection] opened: \\.\Global\{1F843A3B-448F-4885-9E8E-724A0BDEE729}.tap
Mon Jan 13 20:23:20 2014 TAP-Windows Driver Version 9.9
Mon Jan 13 20:23:20 2014 Notified TAP-Windows driver to set a DHCP IP/netmask of 10.8.0.6/255.255.255.252 on interface {1F843A3B-448F-4885-9E8E-724A0BDEE729} [DHCP-serv: 10.8.0.5, lease-time: 31536000]
Mon Jan 13 20:23:20 2014 Successful ARP Flush on interface [18] {1F843A3B-448F-4885-9E8E-724A0BDEE729}
Mon Jan 13 20:23:25 2014 TEST ROUTES: 4/4 succeeded len=4 ret=1 a=0 u/d=up
Mon Jan 13 20:23:25 2014 MANAGEMENT: >STATE:1389673405,ADD_ROUTES,,,
Mon Jan 13 20:23:25 2014 C:\Windows\system32\route.exe ADD 0.0.0.0 MASK 0.0.0.0 10.8.0.5
Mon Jan 13 20:23:25 2014 ROUTE: CreateIpForwardEntry succeeded with dwForwardMetric1=30 and dwForwardType=4
Mon Jan 13 20:23:25 2014 Route addition via IPAPI succeeded [adaptive]
Mon Jan 13 20:23:25 2014 C:\Windows\system32\route.exe ADD X.X.X.X MASK 255.255.255.255 192.168.1.1
Mon Jan 13 20:23:25 2014 ROUTE: CreateIpForwardEntry succeeded with dwForwardMetric1=25 and dwForwardType=4
Mon Jan 13 20:23:25 2014 Route addition via IPAPI succeeded [adaptive]
Mon Jan 13 20:23:25 2014 C:\Windows\system32\route.exe ADD 192.168.1.5 MASK 255.255.255.255 10.8.0.5
Mon Jan 13 20:23:25 2014 ROUTE: CreateIpForwardEntry succeeded with dwForwardMetric1=30 and dwForwardType=4
Mon Jan 13 20:23:25 2014 Route addition via IPAPI succeeded [adaptive]
Mon Jan 13 20:23:25 2014 C:\Windows\system32\route.exe ADD 10.8.0.1 MASK 255.255.255.255 10.8.0.5
Mon Jan 13 20:23:25 2014 ROUTE: CreateIpForwardEntry succeeded with dwForwardMetric1=30 and dwForwardType=4
Mon Jan 13 20:23:25 2014 Route addition via IPAPI succeeded [adaptive]
Mon Jan 13 20:23:25 2014 Initialization Sequence Completed
Mon Jan 13 20:23:25 2014 MANAGEMENT: >STATE:1389673405,CONNECTED,SUCCESS,10.8.0.6,X.X.X.X
Obviously any help is appreciated!