3

I want to get the local-address property of a pppoe-client interface, which is my public internet IP.

Assuming that the name of the interface is my-pppoe-out, what is the proper interface pppoe-client get command to use?


MikroTik Terminal Screenshot

I couldn't find anything useful in the official wiki for this.

David Refoua
  • 3,476
  • 3
  • 31
  • 55

1 Answers1

2

You can't get the IP directly on the command-line, you must use a script to do this.

:local ip [/ip address get [find interface="pppoe-out1"] address ];
:put "IP: $ip"

Then you can do whatever you want with the variable $ip (here i just write it in the console) like updating a dyndns, etc.

To use this script, either copypaste it in a file like "ip.rsc" and then type "import ip.rsc" to execute it, or put it on a routerOS script (/system script add ..).

  • For any future visitors, you may also want to remove the `/24` subnet mask at the end of the IP. For doing so, I found this answer: http://forum.mikrotik.com/viewtopic.php?t=97732 – David Refoua Sep 08 '16 at 22:08
  • Not sure why you believe this command cannot be executed in command-line. Note that `:local` variables are not cached, so either use `{ }` around your snippet or use `:global` variables - then it works. – braggPeaks Aug 16 '22 at 11:30