Community discussions

MikroTik App
 
Pada
Member Candidate
Member Candidate
Topic Author
Posts: 150
Joined: Tue Dec 08, 2009 11:37 pm
Location: South Africa, Stellenbosch

ppp on-up/on-down variables

Fri Jan 08, 2016 2:31 am

Hi,

I've struggled for quite a bit to get the variables working that is exposed by the ppp on-up and on-down scripts, because
  1. variable names includes dashes: local-address, remote-address, caller-id, called-id
  2. interface variable isn't the interface's name
So after a while I have managed to reconstruct new and useful variables:
:local localAddr
:local remoteAddr
:local callerId
:local calledId
:local interfaceName

:set localAddr $"local-address"
:set remoteAddr $"remote-address"
:set callerId $"caller-id"
:set calledId $"called-id"
:set interfaceName [/interface get $interface name]

:log info "$user (srcIp=$callerId, dstIp=$calledId) connected: was given $remoteAddr IP (GW $localAddr) and assigned to $interfaceName interface"
I hope this example is useful to others.

My idea in the end is to add/remove Firewall Filter rules for a given IPSec client interface, since the interface name changes to unknown after the client disconnected AND because when I make use of the PPP incoming-filter/outgoing-filter and jump to ppp chain from the forward chain, then my ROS 6.33.3 goes into a weird state by removing all my bridge interfaces.
 
ditonet
Forum Veteran
Forum Veteran
Posts: 835
Joined: Mon Oct 19, 2009 12:52 am
Location: Europe/Poland/Konstancin-Jeziorna
Contact:

Re: ppp on-up/on-down variables

Fri Jan 15, 2016 7:46 pm

Hi,

Thanks a lot, it helped me.

Regards,
 
lavv17
Member Candidate
Member Candidate
Posts: 120
Joined: Sat Sep 01, 2007 9:01 am

Re: ppp on-up/on-down variables

Thu Oct 06, 2016 11:56 am

Thanks, it helped me too.

It can be made shorter by combining declaration and assignment like this:
:local remoteAddr $"remote-address"
 
User avatar
spippan
Member
Member
Posts: 464
Joined: Wed Nov 12, 2014 1:00 pm

Re: ppp on-up/on-down variables

Thu Apr 13, 2017 2:44 pm

Hi,

I've struggled for quite a bit to get the variables working that is exposed by the ppp on-up and on-down scripts, because
  1. variable names includes dashes: local-address, remote-address, caller-id, called-id
  2. interface variable isn't the interface's name
So after a while I have managed to reconstruct new and useful variables:
:local localAddr
:local remoteAddr
:local callerId
:local calledId
:local interfaceName

:set localAddr $"local-address"
:set remoteAddr $"remote-address"
:set callerId $"caller-id"
:set calledId $"called-id"
:set interfaceName [/interface get $interface name]

:log info "$user (srcIp=$callerId, dstIp=$calledId) connected: was given $remoteAddr IP (GW $localAddr) and assigned to $interfaceName interface"
I hope this example is useful to others.

My idea in the end is to add/remove Firewall Filter rules for a given IPSec client interface, since the interface name changes to unknown after the client disconnected AND because when I make use of the PPP incoming-filter/outgoing-filter and jump to ppp chain from the forward chain, then my ROS 6.33.3 goes into a weird state by removing all my bridge interfaces.

AWESOME! you, my dir sir, saved me a lot of googling.
 
davestahr
just joined
Posts: 12
Joined: Wed May 04, 2011 3:33 pm

Re: ppp on-up/on-down variables

Thu Nov 23, 2017 1:01 am

Awesome - thank you! I've been using the on-up and on-down things to invoke remote API calls by means of an http request - sorta clunky. This will make things much faster.
 
User avatar
ADahi
Member Candidate
Member Candidate
Posts: 209
Joined: Thu Sep 21, 2017 7:16 pm
Location: Iraq, Ninavah
Contact:

Re: ppp on-up/on-down variables

Fri Dec 08, 2017 2:07 pm

https://wiki.mikrotik.com/wiki/Manual:P ... r_Profiles
Execute script on user login-event. These are available variables that are accessible for the event script:
    user
    local-address
    remote-address
    caller-id
    called-id
    interface
 
jgraue
just joined
Posts: 5
Joined: Wed Jun 03, 2015 3:34 am

Re: ppp on-up/on-down variables

Tue Dec 31, 2019 1:04 am

You made my day!!! I was succesfully using $user but struggling with caller-id. Thanks Sr.

Who is online

Users browsing this forum: No registered users and 18 guests