Community discussions

MikroTik App
 
Andrej90
just joined
Topic Author
Posts: 8
Joined: Sun Jun 21, 2009 1:06 am

frequency changer

Sun Jun 21, 2009 1:28 pm

I had some problems with disturbance signal and i had to make this script.It works on router where interface is set in AP mode.
This is timeschedule and it's interval is 10 sec and call a script timeschange
:do {:global ping "[ping 62.240.12.12 count=1]"} while($ping=1); 
/system scheduler enable schedule-freqchange;
/system scheduler disable timeschedule
It pings until there is one timeout.Then enables schedule-freqchange and disable timeschedule.
When the schedule-freqchange is enabled it calls a freqchange script
:if([/interface wireless get wlan1 frequency]=5000) do={ /interface wireless set wlan1 frequency=5470; /ping 62.240.12.12 count=10; /system scheduler enable timeschedule; /system scheduler disable schedule-freqchange } else={/interface wireless set wlan1 frequency=5000;  /ping 62.240.12.12 count=10; /system scheduler enable timeschedule; /system scheduler disable schedule-freqchange}
The part when the frequency is changed and after that you can see ping command.It's used as delay time.We know when the frequency is changed, it needs some time to get connected and that's why i set a ping command.To give that time.Otherwise it's going to change frequency in circles

Give me some comment about this one :)
 
fosben
Frequent Visitor
Frequent Visitor
Posts: 81
Joined: Thu Dec 14, 2006 4:50 pm

Re: frequency changer

Sun Jun 21, 2009 1:48 pm

what about
:delay 5s
and netwatch on up/down events can replace your schedule... and possibly your time delaying problem..
Last edited by fosben on Sun Jun 21, 2009 1:54 pm, edited 1 time in total.
 
Andrej90
just joined
Topic Author
Posts: 8
Joined: Sun Jun 21, 2009 1:06 am

Re: frequency changer

Sun Jun 21, 2009 1:53 pm

Haha.Because I'm new in this stuff ping was the first thing that get on my mind :) Yeah i could use :delay :)
Frst i tried to put all in one script but it couldn't work that way.Maybe u have some sugestions ? Or this is alright ?
Thx
 
fosben
Frequent Visitor
Frequent Visitor
Posts: 81
Joined: Thu Dec 14, 2006 4:50 pm

Re: frequency changer

Sun Jun 21, 2009 2:00 pm

here you go
/tool netwatch
add comment="" disabled=no down-script=\
    ":if([/interface wireless get wlan1 frequency]=5000) do={ /interface wireless set wlan1 frequency=5470 } else={/interface wireless set wlan1 frequency=5000}" host=\
    62.240.12.12 interval=1m timeout=1s up-script=""
netwatch interval set to 1 minute, but you can change that to 10 sec if you want to...
 
Andrej90
just joined
Topic Author
Posts: 8
Joined: Sun Jun 21, 2009 1:06 am

Re: frequency changer

Sun Jun 21, 2009 2:06 pm

yeah it's better than mine.But it's the same thing.Is there any disturbance on processor, because of ping command??
 
fosben
Frequent Visitor
Frequent Visitor
Posts: 81
Joined: Thu Dec 14, 2006 4:50 pm

Re: frequency changer

Sun Jun 21, 2009 2:10 pm

its the same as yours because it is yours ;)

I suggest you use the netwatch one, since its easier to look at and to change/disable etc (just one click in /tool netwatch).. but I also suggest that you fix the frequency issues, cause this is like an emergency fix for your problem and should only be used temp...
 
Andrej90
just joined
Topic Author
Posts: 8
Joined: Sun Jun 21, 2009 1:06 am

Re: frequency changer

Sun Jun 21, 2009 2:14 pm

The problem is in other peoples mind.Can you get me.I only can move that station somewhere else.Disturbance are because of othere providers.He copy my mac address of that interface and point his anthena in mine.And cut of my signal.Then I change it on another frequency and it's better.
 
User avatar
thavinci
Member
Member
Posts: 335
Joined: Sat Aug 04, 2007 4:40 pm
Location: Johannessburg
Contact:

Re: frequency changer

Wed Jul 22, 2009 1:55 pm

fosben:


Im having troubles as its not doing anything...
How do i fault find it?

In the Down section of Netwatch item i have following code:
:if([/interface wireless get wlan1 frequency]=5180) do={ /interface wireless set wlan1 frequency=4920 } else={/interface wireless set wlan1 frequency=5180}
Im testing this in a testing environment and triggering it by changing host ip address to a invalid one to get it to trigger and change the frequency on wlan1, yet it does nothing.
 
User avatar
thavinci
Member
Member
Posts: 335
Joined: Sat Aug 04, 2007 4:40 pm
Location: Johannessburg
Contact:

Re: frequency changer

Wed Jul 22, 2009 2:04 pm

Ok i found the problem, was missing space after if statement.


However i do have another question, how can i turn this into something that will keep changing frequencies till it finds an available one that works?



Regards.

Who is online

Users browsing this forum: GoogleOther [Bot] and 7 guests