homeassistant-mikrotik_router icon indicating copy to clipboard operation
homeassistant-mikrotik_router copied to clipboard

[Feature] WAN RX/WAN TX sensors for VPN clients

Open sshalyminov opened this issue 3 years ago • 12 comments

Is it possible to implement WAN RX/WAN TX sensors (and probably presence tracking) for VPN clients, connected to router? I have static client (another same router) connected from my second house to primary and also I am dynamically connecting time to time from cell phone, laptop and other systems. And I want to track traffic of these connections if this is possible. In my case I use L2TP but probably all of this are same mechanism.

sshalyminov avatar Apr 15 '21 20:04 sshalyminov

Did you enable PPP tracking and monitoring?

tomaae avatar Apr 15 '21 20:04 tomaae

OMG, you had suprise me. You know all our needs :) Ok, great, now I have connection monitoring, but I still can't find if it is possible to monitor WAN RX/WAN TX for those connections. I understand in case of download somethinng from internet by client this connection will take traffic twice - first for download and second for upload to client, but anyway, total to know internet load by this connection would be great if possible. I can see it in WinBox but not sure this is availble for your addon.

sshalyminov avatar Apr 16 '21 10:04 sshalyminov

It was a feature request some time ago :) Mikrotik has a lot of features I dont even know about, so there is always a room for improvement ;)

I dont use PPP myself, so I need more data to have a look at this. Could you give me a screenshot and print terse output from terminal containing those data?

tomaae avatar Apr 16 '21 12:04 tomaae

Снимок экрана 2021-04-17 010032 Снимок экрана 2021-04-17 010337 It this good?

sshalyminov avatar Apr 16 '21 22:04 sshalyminov

Снимок экрана 2021-04-17 010536 One more: all interfaces list

sshalyminov avatar Apr 16 '21 22:04 sshalyminov

when you check in ppp active connections, is there any way to tell which interface in interface list are they paired to at the moment? if so, it should be easy to do.

tomaae avatar Apr 17 '21 10:04 tomaae

In a case of my L2TP server:

 > interface l2tp-server print 
Flags: X - disabled, D - dynamic, R - running 
 #     NAME                                               USER                MTU CLIENT-ADDRESS                                              UPTIME   ENCODING                                             
 0   R l2tp-dacharouter                                   dacharouter        1450 xx.xxx.xx.xxx                                               10h4m38s cbc(aes) + hmac(sha1)          

You can find here interface name mapped to PPP user name. Probably the same for other types of server - PPTP, SSTP and rest, I can't check because of I use L2TP only.

sshalyminov avatar Apr 19 '21 20:04 sshalyminov

 > interface 
An Interface is physical or virtual device which provides a connection to an external network.

l2tp-server -- Layer Two Tunneling Protocol's server
ovpn-server -- 
ppp-server -- PPP server
pppoe-server -- PPPoE server
pptp-server -- PPTP server
sstp-server -- 

Here are all types of interface *-server commands for my router.

sshalyminov avatar Apr 19 '21 20:04 sshalyminov

perfect, thanks

tomaae avatar Apr 20 '21 01:04 tomaae

I'd like to vote for the possibility to monitor traffic on L2TP interfaces.

It's a pity that this great integration found all type of interfaces on my RB4011 (ROS 7.1.1) except L2TP. The only difference I see for this type is absence of MAC address in /interface print output.

I guess It can be found as interface with type="l2tp-in" . /interface print image

and traffic statistics is available via command :

image

hellad avatar Feb 17 '22 22:02 hellad

when you check in ppp active connections, is there any way to tell which interface in interface list are they paired to at the moment? if so, it should be easy to do.

Just in case it might help... image

hellad avatar Feb 17 '22 22:02 hellad

I already plan to take a look into this. I implement new features as I have time and based on their scope and usefulness. Here I will also need to learn how to setup l2tp on mikrotik for testing. Also #166 is relevant here, since it is an interface based traffic.

tomaae avatar Feb 18 '22 01:02 tomaae