Local Internet Script

:frowning: hi want to know if anyone knows of or have a script to automatically update my local ip’s…

i think this is what you are looking for:

http://wiki.mikrotik.com/wiki/Dynamic_DNS_Update_Script_for_dynDNS

Zero, you really need to provide more information with regards to “local ip’s”. “Local IP adddresses” can either refer to local as in your Country’s IP address range or local as in your home/private network.

Dynamic DNS is used to link a DNS (hostname, eg. yourpc.dyndns.org) with your changing public IP address.

Hi sorry, i meant local ip’s as in my country

so for example my clients can either browse local sites in my country or
international :slight_smile:

If you’re from South Africa, then I can help you out since I’m from SA myself :slight_smile:

Unfortunately MikroTik v4 doesn’t have LUA for reading large files, which makes scripting on the MikroTik alone impossible to add the routes for South Africa since the file is larger than 4kB!

Here’s my first attempt on splitting local and international traffic: http://mybroadband.co.za/vb/showthread.php?198430-Mikrotik-split-traffic-local-and-international&p=3511026&viewfull=1#post3511026* Its using Address Lists for the local routes and mangling to mark the routing. This method would fail if you’re using a transparent web proxy on the same router.

If the routes don’t change that often or if there aren’t that many routes (like if you’re not from SA), then you can just add the routes to the routing table. eg. http://wiki.mikrotik.com/wiki/Routing_local_%2B_international_%2B_unshaped_traffic_through_3_separate_adsl_accounts

hi, im also frm SA…Cape Town

:frowning: still dont quiet understand…

if can give a script just to copy & paste in terminal, will make things easy for me

OK, if you’re not willing to read all of the instructions that I’ve posted on myBroadband, then you’ll have to settle for 600+ routes in your routing table, by creating and running a script like follow:

  1. Download the list of IP addresses from http://developers.locality.co.za/routes.txt
  2. insert the IP addresses in the script where I’ve said ‘>>> INSERT OTHER IP RANGES HERE <<<’ and remember to remove the first and last few entries that I’ve already placed in the script. Its also important to KEEP the newline after the last route.
  3. replace ‘pppoe-local’ with the name of your local interface
  4. ensure that you have a default route for the international interface and NOT one for your local interface too
  5. ensure that you have enabled NAT for both the local and international interfaces
  6. copy the script to the router and run it


# Clear RSA address list
/ip route {
  :local o [find comment="RSA address"]
  :if ([:len $o] != 0) do={ remove $o }
}

# Add RSA addresses
:local content "41.0.0.0/11
41.56.0.0/18
>>> INSERT OTHER IP RANGES HERE <<<
216.236.176.0/20
"
:local contentLen [ :len $content ] ;
:local lineEnd 0;
:local line "";
:local lastEnd 0;
:do {
  :set lineEnd [:find $content "\r\n" $lastEnd ] ;
  :set line [:pick $content $lastEnd $lineEnd] ;
  :set lastEnd ( $lineEnd + 2 ) ;
  :if ([:len $line] > 8) do={
    /ip route  {
      add comment="RSA address" dst-address=$line gateway="pppoe-local"
    }
  }
} while ($lineEnd < $contentLen)

Enjoy :slight_smile:

That script should work fine with a transparent HTTP proxy.