The issue is when OpenVPN tries to reconnect to the server once the internet is restored, it is not adding back the routes. Running ifconfig shows the tun0 is still up, but running route does not show the additional vpn routes. The only way to get it to work is to shut down openvpn on the client, wait about 30 seconds and then restart it using systemctl.
I have tried removing the persist-tun and persist-key, but I am still getting the same issues.
server.conf
Code: Select all
port 1194
proto udp
dev tun
sndbuf 0
rcvbuf 0
ca ca.crt
cert server.crt
key server.key
dh dh.pem
auth SHA512
tls-auth ta.key 0
topology subnet
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "redirect-gateway def1 bypass-dhcp"
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"
keepalive 10 120
cipher AES-256-CBC
comp-lzo
user nobody
group nogroup
#persist-key
#persist-tun
status openvpn-status.log
verb 4
crl-verify crl.pem
Code: Select all
client
dev tun
proto udp
sndbuf 0
rcvbuf 0
remote 123.456.78.9 1194
resolv-retry infinite
nobind
#persist-key
#persist-tun
remote-cert-tls server
auth SHA512
cipher AES-256-CBC
comp-lzo
setenv opt block-outside-dns
key-direction 1
verb 3
log-append /var/log/openvpn.log
script-security 2
up /etc/openvpn/update-resolv-conf
down /etc/openvpn/update-resolv-conf
Code: Select all
Sat Aug 4 06:53:21 2018 NOTE: the current --script-security setting may allow this configuration to call user-defined scripts
Sat Aug 4 06:53:21 2018 Outgoing Control Channel Authentication: Using 512 bit message hash 'SHA512' for HMAC authentication
Sat Aug 4 06:53:21 2018 Incoming Control Channel Authentication: Using 512 bit message hash 'SHA512' for HMAC authentication
Sat Aug 4 06:53:21 2018 TCP/UDP: Preserving recently used remote address: [AF_INET]123.456.78.9:1194
Sat Aug 4 06:53:21 2018 Socket Buffers: R=[212992->212992] S=[212992->212992]
Sat Aug 4 06:53:21 2018 UDP link local: (not bound)
Sat Aug 4 06:53:21 2018 UDP link remote: [AF_INET]123.456.78.9:1194
Sat Aug 4 06:53:21 2018 TLS: Initial packet from [AF_INET]123.456.78.9:1194, sid=0f97b1b9 e7dr7548
Sat Aug 4 06:53:21 2018 VERIFY OK: depth=1, CN=ChangeMe
Sat Aug 4 06:53:21 2018 VERIFY KU OK
Sat Aug 4 06:53:21 2018 Validating certificate extended key usage
Sat Aug 4 06:53:21 2018 ++ Certificate has EKU (str) TLS Web Server Authentication, expects TLS Web Server Authentication
Sat Aug 4 06:53:21 2018 VERIFY EKU OK
Sat Aug 4 06:53:21 2018 VERIFY OK: depth=0, CN=server
Sat Aug 4 06:53:21 2018 WARNING: 'link-mtu' is used inconsistently, local='link-mtu 1550', remote='link-mtu 1602'
Sat Aug 4 06:53:21 2018 WARNING: 'cipher' is used inconsistently, local='cipher AES-256-GCM', remote='cipher AES-256-CBC'
Sat Aug 4 06:53:21 2018 WARNING: 'auth' is used inconsistently, local='auth [null-digest]', remote='auth SHA512'
Sat Aug 4 06:53:21 2018 Control Channel: TLSv1.2, cipher TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384, 2048 bit RSA
Sat Aug 4 06:53:21 2018 [server] Peer Connection Initiated with [AF_INET]123.456.78.9:1194
Sat Aug 4 06:53:22 2018 SENT CONTROL [server]: 'PUSH_REQUEST' (status=1)
Sat Aug 4 06:53:22 2018 PUSH: Received control message: 'PUSH_REPLY,redirect-gateway def1 bypass-dhcp,dhcp-option DNS 8.8.8.8,dhcp-option DNS 8.8.4.4,route-gateway 10.8.0.1,topology subnet,ping 10,ping-restart 120,ifconfig 10.8.0.2 255.255.255.0,peer-id 0,cipher AES-256-GCM'
Sat Aug 4 06:53:22 2018 OPTIONS IMPORT: timers and/or timeouts modified
Sat Aug 4 06:53:22 2018 OPTIONS IMPORT: --ifconfig/up options modified
Sat Aug 4 06:53:22 2018 OPTIONS IMPORT: route options modified
Sat Aug 4 06:53:22 2018 OPTIONS IMPORT: route-related options modified
Sat Aug 4 06:53:22 2018 OPTIONS IMPORT: --ip-win32 and/or --dhcp-option options modified
Sat Aug 4 06:53:22 2018 OPTIONS IMPORT: peer-id set
Sat Aug 4 06:53:22 2018 OPTIONS IMPORT: adjusting link_mtu to 1625
Sat Aug 4 06:53:22 2018 OPTIONS IMPORT: data channel crypto options modified
Sat Aug 4 06:53:22 2018 Outgoing Data Channel: Cipher 'AES-256-GCM' initialized with 256 bit key
Sat Aug 4 06:53:22 2018 Incoming Data Channel: Cipher 'AES-256-GCM' initialized with 256 bit key
Sat Aug 4 06:53:22 2018 ROUTE_GATEWAY 192.168.1.1/255.255.255.0 IFACE=wlp6s0 HWADDR=7b:dd:76:2f:05:37
Sat Aug 4 06:53:22 2018 TUN/TAP device tun0 opened
Sat Aug 4 06:53:22 2018 TUN/TAP TX queue length set to 100
Sat Aug 4 06:53:22 2018 do_ifconfig, tt->did_ifconfig_ipv6_setup=0
Sat Aug 4 06:53:22 2018 /sbin/ip link set dev tun0 up mtu 1500
Sat Aug 4 06:53:22 2018 /sbin/ip addr add dev tun0 10.8.0.2/24 broadcast 10.8.0.255
Sat Aug 4 06:53:22 2018 /etc/openvpn/update-resolv-conf tun0 1500 1553 10.8.0.2 255.255.255.0 init
dhcp-option DNS 8.8.8.8
dhcp-option DNS 8.8.4.4
Code: Select all
Sat Aug 4 12:58:55 2018 /sbin/ip route add 123.456.78.9/32 via 192.168.1.1
Sat Aug 4 12:58:55 2018 /sbin/ip route add 0.0.0.0/1 via 10.8.0.1
Sat Aug 4 12:58:55 2018 /sbin/ip route add 128.0.0.0/1 via 10.8.0.1
Sat Aug 4 12:58:55 2018 WARNING: this configuration may cache passwords in memory -- use the auth-nocache option to prevent this
Sat Aug 4 12:58:55 2018 Initialization Sequence Completed