Saturday, 22 March 2025

OpenVPN commands - As alias

 When using openvpn3 I normally create aliases that would help me easily managing my vpn.

# Alias for importing VPN configuration persistently

alias vpn-import='openvpn3 config-import --persistent --name solofunds --config /home/shahzeb/vpn/openvpn_config.ovpn'


# Alias for starting the VPN session

alias connectvpn='openvpn3 session-start --config solofunds'


# Alias for stopping the VPN session

alias stopvpn='openvpn3 session-manage --config solofunds --disconnect'


# Alias for restarting the VPN session

alias restartvpn='openvpn3 session-manage --config solofunds --restart'


# Alias for listing active VPN sessions

alias vpnstatus='openvpn3 sessions-list'


# Alias for viewing VPN session statistics

alias vpn-stats='openvpn3 session-stats --config solofunds'


# Alias for checking VPN logs in real time

alias vpn-log='openvpn3 log --config solofunds --log-level 6'


#stop a given sessions

#openvpn3 session-manage --session-path /net/openvpn/v3/sessions/<session-path> --disconnect