HOTSPOT IP & MAC BINDING IN MIKROTIK SERVER

Below script find active user on hotspot and set static ip with mac binding into 2 section.

section 1 find all active users on hotspot
section 2 find IP & Mac into DHCP-Server Leases.

How its works ?
copy below code into system script with name hotspot-binding.
create schedule for Example time 10min timming to run this code ..



This Code is paste in New Script Just like in First Picture

:foreach h in=[/ip hotspot active find] do={
:global address [/ ip hotspot active get $h address];
:global user [/ip hotspot active get $h user];
:global mac [/ip hotspot active get $h mac-address];
/ip hotspot user set $user  mac=$mac address=$address;
:foreach x in=[/ip dhcp-server lease find] do={/ip dhcp-server lease make-static $x};
}

ROS Code Terminal Export for version 6.x :
/system script
add name=hotspot-binding policy=\
    ftp,reboot,read,write,policy,test,password,sniff,sensitive source=":foreach \
    h in=[/ip hotspot active find] do={\r\
    \n:global address [/ ip hotspot active get \$h address];\r\
    \n:global user [/ip hotspot active get \$h user];\r\
    \n:global mac [/ip hotspot active get \$h mac-address];\r\
    \n/ip hotspot user set \$user  mac=\$mac address=\$address;\r\
    \n:foreach x in=[/ip dhcp-server lease find] do={/ip dhcp-server lease make-\
    static \$x};\r\
    \n}"
Control By Time Scheduler Add New Scheduler and paste code :

/system scheduler
add disabled=no interval=10m name=binding-hotspot on-event=hotspot-binding \
    policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive \
    start-date=jul/24/2015 start-time=22:10:03


If you want Change Name of Script And Scheduler So No Problem you can do it very easy

If You Have Any Problem in settings so comments me i will help you about this settings

Post a Comment

[blogger][disqus][facebook]

Ch.Shahzad Nasir

{facebook#YOUR_SOCIAL_PROFILE_URL} {twitter#YOUR_SOCIAL_PROFILE_URL} {google-plus#YOUR_SOCIAL_PROFILE_URL} {pinterest#YOUR_SOCIAL_PROFILE_URL} {youtube#YOUR_SOCIAL_PROFILE_URL} {instagram#YOUR_SOCIAL_PROFILE_URL}

Contact Form

Name

Email *

Message *

Powered by Blogger.
Javascript DisablePlease Enable Javascript To See All Widget