Hi, I’m still quite new to RouterOS’s scripting, can anyone perhaps help to say how I would disable an DHCP server in a script?
What ? Simply do not configure a DHCP Server…
To disable
/ip dhcp-server disable 0
To enable
/ip dhcp-server enable 0
If you have multiple DHCP servers, use /ip dhcp-server print to find the number corresponding to your server.
Do not follow that advise! You should never use numerical index in scripts.
Try something like:
/ip dhcp-server disable [ find where comment=.... ]
Change the find to your needs.
Any particular reason?
But for most entries with a identifier, you can use the name instead:
/ip dhcp-server disable default
/ip dhcp-server enable default
Thank you. Good info.
Hello need help about this script tha goal is under dhcp server leases fine a comment who -1 and do action then disable.
for x from=0 to=70 do={
/ip dhcp-server leases [find comment=$x] comment=($x-1)
delay 50ms
}
:foreach i in=[/ip dhcp-server leases find] do={
:local address [/ip dchp-server leases set value=0];
:local comment /ip dchp-server leasest get $i comment];
if ($comment=-1) do={
/ip dchp-server leases disable [find where name=$uname]
}
}
I DO NOT UNDERSTAND ANYTHING!
WHAT DO YOU WANT TO DO? (ignoring script)