Ben's notes

Linux, Unix, network, radio...

User Tools

Site Tools


This is an old revision of the document!


RouterOS 6.x - Update bogon list automatically

  • Create a new script:
    /system script add name=bogons
  • Edit new script:
    /system script edit [/system script find name=bogons] source
  • Paste script:
    ## Builds an address list with bogons based on:
    :log info "Fetching bogon list." 
    /tool fetch url="" mode=http
    :log info "Removing all bogons." 
    /ip firewall address-list remove [/ip firewall address-list find list=bogons]
    :global content [/file get [/file find name=bogon-bn-agg.txt] contents] ;
    :global contentLen [:len $content];
    :global lineEnd 0;
    :global line "";
    :global lastEnd 0;
    :log info "Adding bogons from file." 
    :do {
           :set lineEnd [:find $content "\n" $lastEnd ] ;
           :set line [:pick $content $lastEnd $lineEnd] ;
           :set lastEnd ( $lineEnd + 1 ) ;
           :if ( $line != "" ) do={
           /ip firewall address-list add list=bogons address=$line;
    } while ($lineEnd < $contentLen)
  • Test run script:
    /system script run bogons
  • Schedule script:
    /system scheduler add interval=24h start-time=7:00:00 on-event=bogons name=update-bogons
routeros_bogon_update.1429445037.txt.gz · Last modified: 2015/04/19 14:03 by admin