Scriplet: Grabbing PPPoE IP Address

A quick scriptlet I whipped up for a friend tonight to allow them to retrieve an IP addess from a specific PPPoE interface.
Handy for updating DynDNS entries among other things.

:local wanip [/ip address get [/ip address find where interface=pppoe-wan] address];
:set wanip [:pick $wanip 0 ([:len $wanip]-3) ];
#whatever you want to do with said IP goes here
:put $wanip;

Obviously update pppoe-wan with your interface name 😉

Advertisement

One thought on “Scriplet: Grabbing PPPoE IP Address

  1. that is very help full my friend , am using this code

    i used this script to disable and enable the pppoe-client interface
    **sorry for using global variables

    {:global wanip;
    :global ping 1;
    :global loss 0;
    :global continue true;
    :while (true) do {
    :set ping 1;
    :set continue true;
    :set loss 0;
    :while ($continue) do= {
    :set wanip [ip address get [ip address find where interface=myWanNIC] value-name=network];
    :set ping [ping $wanip count=1 ];
    :if ($ping=0) do={:set loss 1; interface pppoe-client set myWanNIC disabled=”yes”;
    :set loss 1; interface pppoe-client set myWanNIC disabled=”no”;
    :set continue true;
    delay 5;} else={:set continue false;} ;
    :delay 5;
    }}}

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.