0

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}/*

4
  • Just out of curiosity: What exactly do you hope to achieve by using several VPNs at once? Depending on how your default route is set (check with 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
    Commented May 31, 2017 at 6:43
  • Nope, I have no route problems. my set up is very clean, I am connecting to more than 50 externals sites that are not federated. So it is really 50 different VPN clients, and one VPN server. there IS a lot of openvpn process and I need to map "cleanly" each process to its tun interface.
    – dominix
    Commented May 31, 2017 at 8:14
  • If it's VPNs 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
    Commented May 31, 2017 at 12:03
  • very nice. I am using openvpn for years and I never noticed this option along all the version upgrade... too bad, but it is the most convenient way to get around my issue.
    – dominix
    Commented May 31, 2017 at 19:17

2 Answers 2

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.

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/*")}'

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .