changeip.com and mikrotik

hi! i using this script on my mikrotik (v3.13):

# Define User Variables
:global ddnsuser "zzzz1"
:global ddnspass "zzzz2"
:global ddnshost "*1"

# Define Global Variables
:global ddnsip
:global ddnslastip
:if ([ :typeof $ddnslastip ] = nil ) do={ :global ddnslastip "0" }

:global ddnsinterface
:global ddnssystem ("mt-" . [/system package get system version] )

# Define Local Variables
:local int

# Loop thru interfaces and look for ones containing
# default gateways without routing-marks
:foreach int in=[/ip route find dst-address=0.0.0.0/0 active=yes ] do={ 
  :if ([:typeof [/ip route get $int routing-mark ]] != str ) do={
     :global ddnsinterface [/ip route get $int interface]
  } 
}

# Grab the current IP address on that interface.
:global ddnsip [ /ip address get [/ip address find interface=$ddnsinterface ] address ]

# Did we get an IP address to compare?
:if ([ :typeof $ddnsip ] = nil ) do={
   :log info ("DDNS: No ip address present on " . $ddnsinterface . ", please check.")
} else={

  :if ($ddnsip != $ddnslastip) do={

    :log info "DDNS: Sending UPDATE!"
    :log info [ :put [/tool dns-update name=$ddnshost address=[:pick $ddnsip 0 [:find $ddnsip "/"] ] key-name=$ddnsuser key=$ddnspass ] ]
    :global ddnslastip $ddnsip

  } else={ 
    :log info "DDNS: No update required."
  }

}

# End of script

what i need to do, if i have two default routes (with routing marks)??? this script can’t to know, which route containg my public ip, isn’t?

that script is looking for any routes without routing marks. If you want to tweak it for your specs we can do that, just let me know more information.

This piece here:

:foreach int in=[/ip route find dst-address=0.0.0.0/0 active=yes ] do={
:if ([:typeof [/ip route get $int routing-mark ]] != str ) do={
:global ddnsinterface [/ip route get $int interface]
}
}

is where it loops thru active default gateways and will find one without a routing mark on it. We can modify that to your needs.

We have another script for our inbound load balancing, that might work as well. That annouces any number of available IP addresses on your WAN interfaces to bring traffic in all of them at the same time.

Sam

can i get that another script? thanks.

hello,

post your routing table so we can see how you have it configured, and I will help write you script for it.

/ip route export
and maybe a
/ip route print detail

If there is sensative info in that printout, just replace some numbers to obfuscate them. I need to see routing-marks and interfaces mainly.

sorry for late, i had some problems and i didn’t was on internet. there is information which u need:
ip route export

add comment="cod routa" disabled=yes distance=1 dst-address=0.0.0.0/0 \
    gateway=92.36.128.1 routing-mark=cod scope=30 target-scope=10
add comment="" disabled=no distance=1 dst-address=0.0.0.0/0 gateway=10.1.0.1 \
    routing-mark=free_zona scope=30 target-scope=10
add comment="default routa za adsl" disabled=no distance=1 dst-address=\
    0.0.0.0/0 gateway=92.36.128.1 routing-mark=ostalo scope=255 target-scope=\
    10
add comment="default routa za wireless" disabled=yes distance=1 dst-address=\
    0.0.0.0/0 gateway=192.168.100.252 routing-mark=ostalo scope=255 \
    target-scope=10
add comment=dns disabled=yes distance=1 dst-address=0.0.0.0/0 gateway=\
    kolins_adsl routing-mark=dns
add comment="" disabled=yes distance=1 dst-address=0.0.0.0/0 gateway=\
    192.168.100.252 scope=255 target-scope=10
add comment="" disabled=yes distance=1 dst-address=0.0.0.0/0 gateway=\
    92.36.128.1 scope=255 target-scope=10
add comment="" disabled=yes distance=1 dst-address=10.100.37.0/26 gateway=\
    10.1.0.1 scope=30 target-scope=10
add comment="" disabled=yes distance=1 dst-address=10.105.3.0/24 gateway=\
    192.168.100.252 scope=30 target-scope=10

ip route print detail

ip route print detail
Flags: X - disabled, A - active, D - dynamic, 
C - connect, S - static, r - rip, b - bgp, o - ospf, m - mme, 
B - blackhole, U - unreachable, P - prohibit 
 0 X S  ;;; cod routa
        dst-address=0.0.0.0/0 gateway=92.36.128.1 distance=1 scope=30 
        target-scope=10 routing-mark=cod 

 1 A S  dst-address=0.0.0.0/0 gateway=10.1.0.1 interface=adsl_freezona 
        gateway-state=reachable distance=1 scope=30 target-scope=10 
        routing-mark=free_zona 

 2 A S  ;;; default routa za adsl
        dst-address=0.0.0.0/0 gateway=92.36.128.1 interface=kolins_adsl 
        gateway-state=reachable distance=1 scope=255 target-scope=10 
        routing-mark=ostalo 

 3 X S  ;;; default routa za wireless
        dst-address=0.0.0.0/0 gateway=192.168.100.252 distance=1 scope=255 
        target-scope=10 routing-mark=ostalo 

 4 X S  ;;; dns
        dst-address=0.0.0.0/0 gateway=kolins_adsl distance=1 routing-mark=dns

i will try to explain my mikrotik router confituration. i have mikrotik with three NIC. one is connected on my ADSL modem, second NIC connected on my AccessPoint AirLive 5460v2 (it is working in WISP mode), and third NIC connected on my Desktop computer. for download i using wireless connection, and then i activate route with gateway=192.168.100.252 (that is ip of AP, which connected on wireless internet). when i wanna to play COD4 (on ADSL i have lower ping), i activate route with gateway 92.36.128.1, and that is gateway of my ADSL (pppoe) connection. i have a problem, because my wireless provider is changing ur default gateway on pppoe connection, and sometime my AP getting local address from WISP, and sometime my AP getting public IP from WISP. on ADSL connection i getting ALWAYS public IP, and that’s reason why i wanna that my dns update go above ADSL route, altough i in that moment using wireless internet (which is fasted then ADSL) for some download. also, third route with free_zona mark is always active, and i using it for download from provider free zone (some FTP, game server, neews server etc., where i don’t need to pay for download and gaming). on free_zona i connecting with pppoe, just with another username apart from adsl internet zone. there is another default gateway = 10.1.0.1

i hope so, that u will understand what i trying to accomplish. sorry for my bad english, and thanks for all help.