How to disconnect users after device goes to sleep

Need help configuring your VPN? Just post here and you'll get that help.
Forum rules
Please use the [oconf] BB tag for openvpn Configurations. See viewtopic.php?f=30&t=21589 for an example.
Post Reply
mohsenkh
OpenVpn Newbie
Posts: 2
Joined: Mon Aug 17, 2020 9:24 am

How to disconnect users after device goes to sleep

Post by mohsenkh » Sun Sep 13, 2020 4:40 pm

I installed openVPN on ubuntu 18.04 server and use https://git.io/vpn for installing openVPN on my server.

I changed server config for able to connect several users with an ovpn file with :

Code: Select all

duplicate-cn
So here is my question:
I wanna when a user's device goes to sleep VPN disconnects and do not reconnect again ( I mean preventing something like alwaysOn or on-demand in iOS)
I tried to eliminate

Code: Select all

keepalive
and add

Code: Select all

inactive 50
and

Code: Select all

ping-exit 50
and

Code: Select all

ping-restart 0
but it didn't work form me. what is the problem??

Here is my server.conf

Server config
local serverIp
port 1194
proto udp
dev tun
ca ca.crt
cert server.crt
key server.key
dh dh.pem
auth SHA512
#client-cert-not-required
#username-as-common-name
#plugin /usr/lib/x86_64-linux-gnu/openvpn/plugins/openvpn-plugin-auth-pam.so /e$
tls-crypt tc.key
topology subnet
inactive 50
server 10.8.0.0 255.255.255.0
push "redirect-gateway def1 bypass-dhcp"
ifconfig-pool-persist ipp.txt
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"
cipher AES-256-CBC
user nobody
group nogroup
persist-key
status openvpn-status.log
log /var/log/openvpn/openvpn.log
log-append /var/log/openvpn/openvpn.log
verb 3
crl-verify crl.pem
explicit-exit-notify



and here is my client.ovpn config

Client config

client
dev tun
proto udp
remote serevrIp 1194
resolv-retry 0
nobind
persist-key
#auth-user-pass
inactive 50
ping-exit 50
ping-restart 0
remote-cert-tls server
auth SHA512
cipher AES-256-CBC
ignore-unknown-option block-outside-dns
block-outside-dns
verb 3
....
Last edited by Pippin on Sun Sep 13, 2020 5:51 pm, edited 1 time in total.
Reason: Formatting

Post Reply