Linux – How to find connected hosts at network (vpn or lan)

linuxnetworkingvpn

I have posted this same thing at stackOverflow and someone pointed me at the fact that this should be here instead…

I'm looking for possible solutions to the following need:

I have a VPN configured (using openVPN over Linux, BTW), and I want to know at any moment which hosts are connected to it. I recognize that it probably is the same thing as trying to know which hosts are connected to a lan, so any of the solutions might do the job…

The fact is that I once used a hamachi vpn on linux and with it I had the chance to know which hosts were connected to a particular network where I belonged, so I was wondering if something similar might be possible in openVPN (or even any VPN and/or any LAN).

Preferably, I'm looking for opensource/free sw solutions, or maybe the hints to program it myself (in the most simple way if possible, not that I don't know how to program, but I'm trying to achieve this in a simple manner). But anyway, if there are no os/fsw solutions, any other one might do…

Thanks a lot!

Javier, Mexico city


ok! thanks for you reply

I'm trying to deploy the management interface, but I'm facing some trouble I don't know how to handle.

I added the following line to my server conf file:

management 10.8.0.1 2308 /etc/openvpn/password

I am sure port 2308 is unused, and 10.8.0.1 happens to be the address openVPN gives to my server (am I right with this? perhaps I understood this upside down 🙁 ) and I echoed a password of my choice into the password file.

After restarting openvpn I get this:

MANAGEMENT: Cannot bind TCP socket on 10.8.0.1:2308: Cannot assign requested address (errno=99)

any ideas?

Best Answer

OpenVPN comes with a management interface that can provide some useful information. Please see http://openvpn.net/index.php/open-source/documentation/miscellaneous/79-management-interface.html
It requires some changes to your OpenVPN configuration file: You can activate the management interface by adding these lines


management 192.168.0.100 5555 /etc/openvpn/password

Change the address 192.168.0.100 by the OpenVPN default address and 5555 by any unused port, setup a file (e.g /etc/openvpn/password) that will contain the management interface password. Later do a telnet to target like this:


telnet 192.168.0.100 5555

Furthermore, you can also manage who is connected to your OpenVPN server using a python script, please take a look at ovpnview

Related Topic