Community discussions

 
hel
Member Candidate
Member Candidate
Topic Author
Posts: 155
Joined: Sun Jun 12, 2011 6:31 am
Location: Kirov, Russia

How to get an interface of connected pppoe client using CLI?

Wed May 15, 2019 4:47 pm

I have 20 pppoe servers on mikrotik which set up on different isolated VLANs.
I need to get connected clients by specific vlan interface.
In winbox I have interface read only value in a status tab.
screen.jpg
Is it possible to get it/use as filter using CLI?
You do not have the required permissions to view the files attached to this post.
 
sindy
Forum Guru
Forum Guru
Posts: 3459
Joined: Mon Dec 04, 2017 9:19 pm

Re: How to get an interface of connected pppoe client using CLI?

Wed May 15, 2019 5:07 pm

It is relatively easy to get it:

put ([interface pppoe-server monitor <pppoe-client-name> once as-value]->"interface")

It is a bit resource-consuming to filter on it:
foreach counter=ifc in=[interface pppoe-server find] do={if (([interface pppoe-server monitor $ifc once as-value]->"interface") = "carrier-interface-name" ) do={put [interface pppoe-server get $ifc name]}}
Instead of writing novels, post /export hide-sensitive. Use find&replace in your favourite text editor to systematically replace all occurrences of each public IP address potentially identifying you by a distinctive pattern such as my.public.ip.1.
 
hel
Member Candidate
Member Candidate
Topic Author
Posts: 155
Joined: Sun Jun 12, 2011 6:31 am
Location: Kirov, Russia

Re: How to get an interface of connected pppoe client using CLI?

Wed May 15, 2019 6:00 pm

It is a bit resource-consuming to filter on it:
foreach counter=ifc in=[interface pppoe-server find] do={if (([interface pppoe-server monitor $ifc once as-value]->"interface") = "carrier-interface-name" ) do={put [interface pppoe-server get $ifc name]}}
Thanks!

Successfully made a csv list using this command:
foreach ifc in=[/interface pppoe-server find] do={put ([/interface pppoe-server get $ifc name].";".[/interface pppoe-server monitor $ifc once as-value]->"interface")}

Who is online

Users browsing this forum: No registered users and 48 guests