OpenVPN and Raspberry Pi 3 configuration
Posted: Sat Jun 17, 2017 2:36 pm
I am getting errors attempting to setup openvpn on my Raspberry Pi 3. Here is the required info:
With this server configuration, I've tried uncommenting and commenting out push rout, local and ifconfig lines as described below.
I started with all these lines running and not commented out:
local 10.0.0.12
ifconfig 10.8.0.1 10.8.0.2
push "route 10.8.0.1 255.255.255.255"
push "route 10.8.0.0 255.255.255.0"
push "route 10.0.0.12 255.255.255.255"
Then tried just commenting out the push lines, then adding ifconfig, and finally commenting out all of them.
Any help would be greatly appreciated. Please let me know if there is anything I am missing for this post
Server Conf
#local 10.0.0.12 # SWAP THIS NUMBER WITH YOUR RASPBERRY PI IP ADDRESS
dev tun
proto udp #Some people prefer to use tcp. Don't change it if you don't know.
port 1194
ca /etc/openvpn/easy-rsa/keys/ca.crt
cert /etc/openvpn/easy-rsa/keys/Pi.crt # SWAP WITH YOUR CRT NAME
key /etc/openvpn/easy-rsa/keys/Pi.key # SWAP WITH YOUR KEY NAME
dh /etc/openvpn/easy-rsa/keys/dh2048.pem
server 10.8.0.0 255.255.255.0
# server and remote endpoints
#ifconfig 10.8.0.1 10.8.0.2
# Add route to Client routing table for the OpenVPN Server
#push "route 10.8.0.1 255.255.255.255"
# Add route to Client routing table for the OpenVPN Subnet
#push "route 10.8.0.0 255.255.255.0"
# your local subnet
#push "route 10.0.0.12 255.255.255.255" # SWAP THE IP NUMBER WITH YOUR RASPBERRY PI IP ADDRESS
# Set primary domain name server address to the SOHO Router
# If your router does not do DNS, you can use Google DNS 8.8.8.8
push "dhcp-option DNS 10.0.0.1" # This should match your router's IP address.
# Override the Client default gateway by using 0.0.0.0/1 and
# 128.0.0.0/1 rather than 0.0.0.0/0. This has the benefit of
# overriding but not wiping out the original default gateway.
push "redirect-gateway def1"
client-to-client
duplicate-cn
keepalive 10 120
tls-auth /etc/openvpn/easy-rsa/keys/ta.key 0
cipher AES-128-CBC
comp-lzo
user nobody
group nogroup
persist-key
persist-tun
status /var/log/openvpn-status.log 20
log /var/log/openvpn.log
verb 1
dev tun
proto udp #Some people prefer to use tcp. Don't change it if you don't know.
port 1194
ca /etc/openvpn/easy-rsa/keys/ca.crt
cert /etc/openvpn/easy-rsa/keys/Pi.crt # SWAP WITH YOUR CRT NAME
key /etc/openvpn/easy-rsa/keys/Pi.key # SWAP WITH YOUR KEY NAME
dh /etc/openvpn/easy-rsa/keys/dh2048.pem
server 10.8.0.0 255.255.255.0
# server and remote endpoints
#ifconfig 10.8.0.1 10.8.0.2
# Add route to Client routing table for the OpenVPN Server
#push "route 10.8.0.1 255.255.255.255"
# Add route to Client routing table for the OpenVPN Subnet
#push "route 10.8.0.0 255.255.255.0"
# your local subnet
#push "route 10.0.0.12 255.255.255.255" # SWAP THE IP NUMBER WITH YOUR RASPBERRY PI IP ADDRESS
# Set primary domain name server address to the SOHO Router
# If your router does not do DNS, you can use Google DNS 8.8.8.8
push "dhcp-option DNS 10.0.0.1" # This should match your router's IP address.
# Override the Client default gateway by using 0.0.0.0/1 and
# 128.0.0.0/1 rather than 0.0.0.0/0. This has the benefit of
# overriding but not wiping out the original default gateway.
push "redirect-gateway def1"
client-to-client
duplicate-cn
keepalive 10 120
tls-auth /etc/openvpn/easy-rsa/keys/ta.key 0
cipher AES-128-CBC
comp-lzo
user nobody
group nogroup
persist-key
persist-tun
status /var/log/openvpn-status.log 20
log /var/log/openvpn.log
verb 1
I started with all these lines running and not commented out:
local 10.0.0.12
ifconfig 10.8.0.1 10.8.0.2
push "route 10.8.0.1 255.255.255.255"
push "route 10.8.0.0 255.255.255.0"
push "route 10.0.0.12 255.255.255.255"
Then tried just commenting out the push lines, then adding ifconfig, and finally commenting out all of them.
Client Conf
client
dev tun
proto udp
remote server.com 1194
resolv-retry infinite
nobind
persist-key
persist-tun
mute-replay-warnings
ns-cert-type server
key-direction 1
cipher AES-128-CBC
comp-lzo
verb 1
mute 20
dev tun
proto udp
remote server.com 1194
resolv-retry infinite
nobind
persist-key
persist-tun
mute-replay-warnings
ns-cert-type server
key-direction 1
cipher AES-128-CBC
comp-lzo
verb 1
mute 20
Server Log
Sat Jun 17 10:15:23 2017 OpenVPN 2.3.4 arm-unknown-linux-gnueabihf [SSL (OpenSSL)] [LZO] [EPOLL] [PKCS11] [MH] [IPv6] built on Jan 23 2016
Sat Jun 17 10:15:23 2017 library versions: OpenSSL 1.0.1t 3 May 2016, LZO 2.08
Sat Jun 17 10:15:23 2017 Control Channel Authentication: using '/etc/openvpn/easy-rsa/keys/ta.key' as a OpenVPN static key file
Sat Jun 17 10:15:23 2017 TUN/TAP device tun0 opened
Sat Jun 17 10:15:23 2017 do_ifconfig, tt->ipv6=0, tt->did_ifconfig_ipv6_setup=0
Sat Jun 17 10:15:23 2017 /sbin/ip link set dev tun0 up mtu 1500
Sat Jun 17 10:15:23 2017 /sbin/ip addr add dev tun0 local 10.8.0.1 peer 10.8.0.2
Sat Jun 17 10:15:23 2017 GID set to nogroup
Sat Jun 17 10:15:23 2017 UID set to nobody
Sat Jun 17 10:15:23 2017 UDPv4 link local (bound): [undef]
Sat Jun 17 10:15:23 2017 UDPv4 link remote: [undef]
Sat Jun 17 10:15:23 2017 Initialization Sequence Completed
Sat Jun 17 10:15:27 2017 event_wait : Interrupted system call (code=4)
RTNETLINK answers: Operation not permitted
Sat Jun 17 10:15:27 2017 ERROR: Linux route delete command failed: external program exited with error status: 2
Sat Jun 17 10:15:27 2017 /sbin/ip addr del dev tun0 local 10.8.0.1 peer 10.8.0.2
RTNETLINK answers: Operation not permitted
Sat Jun 17 10:15:27 2017 Linux ip addr del failed: external program exited with error status: 2
Sat Jun 17 10:15:27 2017 SIGINT[hard,] received, process exiting
Sat Jun 17 10:15:23 2017 library versions: OpenSSL 1.0.1t 3 May 2016, LZO 2.08
Sat Jun 17 10:15:23 2017 Control Channel Authentication: using '/etc/openvpn/easy-rsa/keys/ta.key' as a OpenVPN static key file
Sat Jun 17 10:15:23 2017 TUN/TAP device tun0 opened
Sat Jun 17 10:15:23 2017 do_ifconfig, tt->ipv6=0, tt->did_ifconfig_ipv6_setup=0
Sat Jun 17 10:15:23 2017 /sbin/ip link set dev tun0 up mtu 1500
Sat Jun 17 10:15:23 2017 /sbin/ip addr add dev tun0 local 10.8.0.1 peer 10.8.0.2
Sat Jun 17 10:15:23 2017 GID set to nogroup
Sat Jun 17 10:15:23 2017 UID set to nobody
Sat Jun 17 10:15:23 2017 UDPv4 link local (bound): [undef]
Sat Jun 17 10:15:23 2017 UDPv4 link remote: [undef]
Sat Jun 17 10:15:23 2017 Initialization Sequence Completed
Sat Jun 17 10:15:27 2017 event_wait : Interrupted system call (code=4)
RTNETLINK answers: Operation not permitted
Sat Jun 17 10:15:27 2017 ERROR: Linux route delete command failed: external program exited with error status: 2
Sat Jun 17 10:15:27 2017 /sbin/ip addr del dev tun0 local 10.8.0.1 peer 10.8.0.2
RTNETLINK answers: Operation not permitted
Sat Jun 17 10:15:27 2017 Linux ip addr del failed: external program exited with error status: 2
Sat Jun 17 10:15:27 2017 SIGINT[hard,] received, process exiting
Client Log
*Tunnelblick: OS X 10.12.3; Tunnelblick 3.6.2 (build 4558)
2017-06-17 10:27:59 *Tunnelblick: Attempting connection with Client1; Set nameserver = 769; monitoring connection
2017-06-17 10:27:59 *Tunnelblick: openvpnstart start Client1.tblk 1337 769 0 3 0 1065264 -ptADGNWradsgnw 2.3.10
2017-06-17 10:27:59 *Tunnelblick: openvpnstart starting OpenVPN
2017-06-17 10:28:00 *Tunnelblick: openvpnstart log:
OpenVPN started successfully. Command used to start OpenVPN (one argument per displayed line):
/Applications/Tunnelblick.app/Contents/Resources/openvpn/openvpn-2.3.10/openvpn
--daemon
--log
/Library/Application Support/Tunnelblick/Logs/-SLibrary-SApplication Support-STunnelblick-SShared-SClient1.tblk-SContents-SResources-Sconfig.ovpn.769_0_3_0_1065264.1337.openvpn.log
--cd
/Library/Application Support/Tunnelblick/Shared/Client1.tblk/Contents/Resources
--verb
3
--config
/Library/Application Support/Tunnelblick/Shared/Client1.tblk/Contents/Resources/config.ovpn
--verb
3
--cd
/Library/Application Support/Tunnelblick/Shared/Client1.tblk/Contents/Resources
--management
127.0.0.1
1337
--management-query-passwords
--management-hold
--script-security
2
--up
/Applications/Tunnelblick.app/Contents/Resources/client.up.tunnelblick.sh -9 -d -f -m -w -ptADGNWradsgnw
--down
/Applications/Tunnelblick.app/Contents/Resources/client.down.tunnelblick.sh -9 -d -f -m -w -ptADGNWradsgnw
2017-06-17 10:28:00 *Tunnelblick: Established communication with OpenVPN
2017-06-17 10:28:00 *Tunnelblick: Obtained VPN passphrase from the Keychain
2017-06-17 10:28:00 OpenVPN 2.3.10 x86_64-apple-darwin [SSL (OpenSSL)] [LZO] [PKCS11] [MH] [IPv6] built on Apr 23 2016
2017-06-17 10:28:00 library versions: OpenSSL 1.0.2g 1 Mar 2016, LZO 2.09
2017-06-17 10:28:00 MANAGEMENT: TCP Socket listening on [AF_INET]127.0.0.1:1337
2017-06-17 10:28:00 Need hold release from management interface, waiting...
2017-06-17 10:28:00 MANAGEMENT: Client connected from [AF_INET]127.0.0.1:1337
2017-06-17 10:28:00 MANAGEMENT: CMD 'pid'
2017-06-17 10:28:00 MANAGEMENT: CMD 'state on'
2017-06-17 10:28:00 MANAGEMENT: CMD 'state'
2017-06-17 10:28:00 MANAGEMENT: CMD 'bytecount 1'
2017-06-17 10:28:00 MANAGEMENT: CMD 'hold release'
2017-06-17 10:28:00 NOTE: the current --script-security setting may allow this configuration to call user-defined scripts
2017-06-17 10:28:00 MANAGEMENT: CMD 'password [...]'
2017-06-17 10:28:00 WARNING: this configuration may cache passwords in memory -- use the auth-nocache option to prevent this
2017-06-17 10:28:00 Control Channel Authentication: tls-auth using INLINE static key file
2017-06-17 10:28:00 Outgoing Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
2017-06-17 10:28:00 Incoming Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
2017-06-17 10:28:00 Socket Buffers: R=[196724->196724] S=[9216->9216]
2017-06-17 10:28:00 MANAGEMENT: >STATE:1497709680,RESOLVE,,,
2017-06-17 10:28:00 UDPv4 link local: [undef]
2017-06-17 10:28:00 UDPv4 link remote: [AF_INET]108.16.136.122:1194
2017-06-17 10:28:00 MANAGEMENT: >STATE:1497709680,WAIT,,,
2017-06-17 10:29:00 TLS Error: TLS key negotiation failed to occur within 60 seconds (check your network connectivity)
2017-06-17 10:29:00 TLS Error: TLS handshake failed
2017-06-17 10:29:00 SIGUSR1[soft,tls-error] received, process restarting
2017-06-17 10:29:00 MANAGEMENT: >STATE:1497709740,RECONNECTING,tls-error,,
2017-06-17 10:29:00 MANAGEMENT: CMD 'hold release'
2017-06-17 10:29:00 NOTE: the current --script-security setting may allow this configuration to call user-defined scripts
2017-06-17 10:29:00 Socket Buffers: R=[196724->196724] S=[9216->9216]
2017-06-17 10:29:00 MANAGEMENT: >STATE:1497709740,RESOLVE,,,
2017-06-17 10:29:00 UDPv4 link local: [undef]
2017-06-17 10:29:00 UDPv4 link remote: [AF_INET]108.16.136.122:1194
2017-06-17 10:29:00 MANAGEMENT: >STATE:1497709740,WAIT,,,
2017-06-17 10:27:59 *Tunnelblick: Attempting connection with Client1; Set nameserver = 769; monitoring connection
2017-06-17 10:27:59 *Tunnelblick: openvpnstart start Client1.tblk 1337 769 0 3 0 1065264 -ptADGNWradsgnw 2.3.10
2017-06-17 10:27:59 *Tunnelblick: openvpnstart starting OpenVPN
2017-06-17 10:28:00 *Tunnelblick: openvpnstart log:
OpenVPN started successfully. Command used to start OpenVPN (one argument per displayed line):
/Applications/Tunnelblick.app/Contents/Resources/openvpn/openvpn-2.3.10/openvpn
--daemon
--log
/Library/Application Support/Tunnelblick/Logs/-SLibrary-SApplication Support-STunnelblick-SShared-SClient1.tblk-SContents-SResources-Sconfig.ovpn.769_0_3_0_1065264.1337.openvpn.log
--cd
/Library/Application Support/Tunnelblick/Shared/Client1.tblk/Contents/Resources
--verb
3
--config
/Library/Application Support/Tunnelblick/Shared/Client1.tblk/Contents/Resources/config.ovpn
--verb
3
--cd
/Library/Application Support/Tunnelblick/Shared/Client1.tblk/Contents/Resources
--management
127.0.0.1
1337
--management-query-passwords
--management-hold
--script-security
2
--up
/Applications/Tunnelblick.app/Contents/Resources/client.up.tunnelblick.sh -9 -d -f -m -w -ptADGNWradsgnw
--down
/Applications/Tunnelblick.app/Contents/Resources/client.down.tunnelblick.sh -9 -d -f -m -w -ptADGNWradsgnw
2017-06-17 10:28:00 *Tunnelblick: Established communication with OpenVPN
2017-06-17 10:28:00 *Tunnelblick: Obtained VPN passphrase from the Keychain
2017-06-17 10:28:00 OpenVPN 2.3.10 x86_64-apple-darwin [SSL (OpenSSL)] [LZO] [PKCS11] [MH] [IPv6] built on Apr 23 2016
2017-06-17 10:28:00 library versions: OpenSSL 1.0.2g 1 Mar 2016, LZO 2.09
2017-06-17 10:28:00 MANAGEMENT: TCP Socket listening on [AF_INET]127.0.0.1:1337
2017-06-17 10:28:00 Need hold release from management interface, waiting...
2017-06-17 10:28:00 MANAGEMENT: Client connected from [AF_INET]127.0.0.1:1337
2017-06-17 10:28:00 MANAGEMENT: CMD 'pid'
2017-06-17 10:28:00 MANAGEMENT: CMD 'state on'
2017-06-17 10:28:00 MANAGEMENT: CMD 'state'
2017-06-17 10:28:00 MANAGEMENT: CMD 'bytecount 1'
2017-06-17 10:28:00 MANAGEMENT: CMD 'hold release'
2017-06-17 10:28:00 NOTE: the current --script-security setting may allow this configuration to call user-defined scripts
2017-06-17 10:28:00 MANAGEMENT: CMD 'password [...]'
2017-06-17 10:28:00 WARNING: this configuration may cache passwords in memory -- use the auth-nocache option to prevent this
2017-06-17 10:28:00 Control Channel Authentication: tls-auth using INLINE static key file
2017-06-17 10:28:00 Outgoing Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
2017-06-17 10:28:00 Incoming Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
2017-06-17 10:28:00 Socket Buffers: R=[196724->196724] S=[9216->9216]
2017-06-17 10:28:00 MANAGEMENT: >STATE:1497709680,RESOLVE,,,
2017-06-17 10:28:00 UDPv4 link local: [undef]
2017-06-17 10:28:00 UDPv4 link remote: [AF_INET]108.16.136.122:1194
2017-06-17 10:28:00 MANAGEMENT: >STATE:1497709680,WAIT,,,
2017-06-17 10:29:00 TLS Error: TLS key negotiation failed to occur within 60 seconds (check your network connectivity)
2017-06-17 10:29:00 TLS Error: TLS handshake failed
2017-06-17 10:29:00 SIGUSR1[soft,tls-error] received, process restarting
2017-06-17 10:29:00 MANAGEMENT: >STATE:1497709740,RECONNECTING,tls-error,,
2017-06-17 10:29:00 MANAGEMENT: CMD 'hold release'
2017-06-17 10:29:00 NOTE: the current --script-security setting may allow this configuration to call user-defined scripts
2017-06-17 10:29:00 Socket Buffers: R=[196724->196724] S=[9216->9216]
2017-06-17 10:29:00 MANAGEMENT: >STATE:1497709740,RESOLVE,,,
2017-06-17 10:29:00 UDPv4 link local: [undef]
2017-06-17 10:29:00 UDPv4 link remote: [AF_INET]108.16.136.122:1194
2017-06-17 10:29:00 MANAGEMENT: >STATE:1497709740,WAIT,,,