Community discussions

MikroTik App
 
happydaddy
Member Candidate
Member Candidate
Topic Author
Posts: 145
Joined: Thu May 24, 2007 12:18 am

Afraid.org dns script using specific wan port

Tue Jan 21, 2014 7:31 pm

Hi guys

I am trying to update my dns address for a specific wan port and would like to know if its possible with wget script. I have a 3 wan ports and would like to update address of wan3. Wan1 is my first route which means every time i run the script wan1 ip gets sent to afrad.org. Any way i can throw a interface=wan3 into the wget script or something which will send wan3 address to afraid?

/tool fetch url="http://freedns.afraid.org/dynamic/update.php\randomKey"
Thanks
 
efaden
Forum Guru
Forum Guru
Posts: 1708
Joined: Sat Mar 30, 2013 1:55 am
Location: New York, USA

Re: Afraid.org dns script using specific wan port

Tue Jan 21, 2014 7:56 pm

Hi guys

I am trying to update my dns address for a specific wan port and would like to know if its possible with wget script. I have a 3 wan ports and would like to update address of wan3. Wan1 is my first route which means every time i run the script wan1 ip gets sent to afrad.org. Any way i can throw a interface=wan3 into the wget script or something which will send wan3 address to afraid?

/tool fetch url="http://freedns.afraid.org/dynamic/update.php\randomKey"
Thanks
I have looked into this before. As far as I figured out it isn't possible in a simple fashion. ... I came up with a theoretical solution to utilize "modified" URLs and some mangle rules to mark routes....

e.g. /tool fetch url="http://freedns-ETH1.afraid.org/dynamic/ ... \randomKey" ... or something like that... match on layer-7. I never actually tested the idea though.
 
User avatar
c0d3rSh3ll
Long time Member
Long time Member
Posts: 557
Joined: Mon Jul 25, 2011 9:42 pm
Location: [admin@Chile] >

Re: Afraid.org dns script using specific wan port

Wed Jan 22, 2014 4:32 am

Freedns.afraid.org now for me is 178.33.33.231

So you can do this:
/ip route add dst-address=178.33.33.231 gateway=1.1.1.1

Change 1.1.1.1 for your wan3 gateway

Send from my mobile phone using Tapatalk.
 
happydaddy
Member Candidate
Member Candidate
Topic Author
Posts: 145
Joined: Thu May 24, 2007 12:18 am

Re: Afraid.org dns script using specific wan port

Wed Jan 22, 2014 5:59 am

Freedns.afraid.org now for me is 178.33.33.231

So you can do this:
/ip route add dst-address=178.33.33.231 gateway=1.1.1.1

Change 1.1.1.1 for your wan3 gateway

Send from my mobile phone using Tapatalk.

I guess this might work if you where only updating 1. In my case I have 3 wan ports I need to update.
 
efaden
Forum Guru
Forum Guru
Posts: 1708
Joined: Sat Mar 30, 2013 1:55 am
Location: New York, USA

Re: Afraid.org dns script using specific wan port

Wed Jan 22, 2014 1:40 pm

Freedns.afraid.org now for me is 178.33.33.231

So you can do this:
/ip route add dst-address=178.33.33.231 gateway=1.1.1.1

Change 1.1.1.1 for your wan3 gateway

Send from my mobile phone using Tapatalk.

I guess this might work if you where only updating 1. In my case I have 3 wan ports I need to update.

You "could" script it... so update the route... fetch... update the route... fetch again... update the route... fetch... etc...

That might actually work as long as it is timed correctly...
 
amee
just joined
Posts: 16
Joined: Mon Apr 17, 2006 3:44 pm

Re: Afraid.org dns script using specific wan port

Fri Jan 24, 2014 5:37 am

May this could answer:
# get freedns.afraid.org
:global a [:resolve freedns.afraid.org]
#update ddns from wan1
/ip ro add dst-address=$a gateway=wan1 comment=ddns
/tool fetch url="http://freedns.afraid.org/dynamic/update.php\randomKey"
#update ddns from wan2
/ip ro add dst-address=$a gateway=wan2 comment=ddns
/tool fetch url="http://freedns.afraid.org/dynamic/update.php\randomKey"
#update ddns from wan3
/ip ro add dst-address=$a gateway=wan3 comment=ddns
/tool fetch url="http://freedns.afraid.org/dynamic/update.php\randomKey"
# remove static gateway
/ip ro rem [find comment=ddns]
 
efaden
Forum Guru
Forum Guru
Posts: 1708
Joined: Sat Mar 30, 2013 1:55 am
Location: New York, USA

Re: Afraid.org dns script using specific wan port

Fri Jan 24, 2014 2:37 pm

May this could answer:
# get freedns.afraid.org
:global a [:resolve freedns.afraid.org]
#update ddns from wan1
/ip ro add dst-address=$a gateway=wan1 comment=ddns
/tool fetch url="http://freedns.afraid.org/dynamic/update.php\randomKey"
#update ddns from wan2
/ip ro add dst-address=$a gateway=wan2 comment=ddns
/tool fetch url="http://freedns.afraid.org/dynamic/update.php\randomKey"
#update ddns from wan3
/ip ro add dst-address=$a gateway=wan3 comment=ddns
/tool fetch url="http://freedns.afraid.org/dynamic/update.php\randomKey"
# remove static gateway
/ip ro rem [find comment=ddns]

Is "fetch" a blocking call?... e.g. is it guaranteed to finish before continuing the script?
 
amee
just joined
Posts: 16
Joined: Mon Apr 17, 2006 3:44 pm

Re: Afraid.org dns script using specific wan port

Sat Jan 25, 2014 6:32 am

Yes, it work fine. I have test it, with some corrections:
# get freedns.afraid.org
:global a [:resolve freedns.afraid.org]
#update ddns from wan1
/ip ro add dst-address=$a gateway=wan1 comment=ddns
/tool fetch url="http://freedns.afraid.org/dynamic/update.php\randomKey"
#update ddns from wan2
/ip ro set  [find comment=ddns] dst-address=$a gateway=wan2 
/tool fetch url="http://freedns.afraid.org/dynamic/update.php\randomKey"
#update ddns from wan3
/ip ro set  [find comment=ddns] dst-address=$a gateway=wan3 
/tool fetch url="http://freedns.afraid.org/dynamic/update.php\randomKey"
# remove static gateway
/ip ro rem [find comment=ddns]
 
happydaddy
Member Candidate
Member Candidate
Topic Author
Posts: 145
Joined: Thu May 24, 2007 12:18 am

Re: Afraid.org dns script using specific wan port

Sat Jan 25, 2014 10:53 am

Tried it but when i run the script no route is added.
 
efaden
Forum Guru
Forum Guru
Posts: 1708
Joined: Sat Mar 30, 2013 1:55 am
Location: New York, USA

Re: Afraid.org dns script using specific wan port

Sat Jan 25, 2014 8:16 pm

Tried it but when i run the script no route is added.
Because the last line removes the route...

/ip ro rem [find comment=ddns]
 
happydaddy
Member Candidate
Member Candidate
Topic Author
Posts: 145
Joined: Thu May 24, 2007 12:18 am

Re: Afraid.org dns script using specific wan port

Sat Jan 25, 2014 8:20 pm

I know that but wile i am running the script should i not see it come and go?
 
efaden
Forum Guru
Forum Guru
Posts: 1708
Joined: Sat Mar 30, 2013 1:55 am
Location: New York, USA

Re: Afraid.org dns script using specific wan port

Sat Jan 25, 2014 8:23 pm

Maybe.. Just depends on the speed

Sent from my SCH-I545 using Tapatalk
 
MasteRTriX
just joined
Posts: 10
Joined: Tue Nov 12, 2013 3:02 am

Re: Afraid.org dns script using specific wan port

Tue Apr 15, 2014 4:27 pm

May this could answer:
# get freedns.afraid.org
:global a [:resolve freedns.afraid.org]
#update ddns from wan1
/ip ro add dst-address=$a gateway=wan1 comment=ddns
/tool fetch url="http://freedns.afraid.org/dynamic/update.php\randomKey"
#update ddns from wan2
/ip ro add dst-address=$a gateway=wan2 comment=ddns
/tool fetch url="http://freedns.afraid.org/dynamic/update.php\randomKey"
#update ddns from wan3
/ip ro add dst-address=$a gateway=wan3 comment=ddns
/tool fetch url="http://freedns.afraid.org/dynamic/update.php\randomKey"
# remove static gateway
/ip ro rem [find comment=ddns]
Freedns has a hidden feature, you can add &address=x.x.x.x to the update url
4). If you are behind a firewall and Free DNS is not detecting your IP address correctly, you can add &address=127.0.0.2 to the update string, to override Free DNS auto-detection. To see the order and/or HTTP variables checked that Free DNS attempts to detect your IP address, you can click here