I am using openvpn very happily, I have more than 50 vpn defined on a debian jessie machine.
I have a question regarding the ability to map some route to some process.
I would like to known which tun interface is mapped to which openvpn process.
At this time my only solution is to scan the syslog searching for some string like /ovpn-([^\[]*).*(tun\d+)/
, where I can mostly retrieve every things at boot time but it is not clean, and informations disappear as log get cleaned up.
So is there a way to map the tun device to the openvpn process ?
I can not find in /proc/{openvpn process}/*
Asked
Active
Viewed 64 times
0

dominix
- 610
2 Answers
1
If the VPNs connect to dedicated sites, why not (a) identify the interface by its IP address (you should not which internal IP range each site uses), or (b) configure each OpenVPN a specific number, e.g. tun100
to tun150
? See dev
argument in the configuration, man openvpn
for details.

dirkt
- 32,309
0
given this post How to find the connection between tap interface and its file descriptor?
I went with a solution with ps ax |awk '/[o]penvpn/{print $7" "$1;system("grep iff /proc/"$1"/fdinfo/*")}'

dominix
- 610
ip route
), you'll either use just one of them, or your internet connection will become unstable and drop packets, because it picks one of the routes randomly, which doesn't work for TCP. So very likely you are just using a single VPN anyway, even if you are connected to several ones. – dirkt May 31 '17 at 06:43tun100
totun150
? Seedev
argument in the configuration,man openvpn
for details. – dirkt May 31 '17 at 12:03