Community discussions

MUM Europe 2020
 
bigd35
just joined
Topic Author
Posts: 1
Joined: Thu Jan 30, 2020 11:46 am

Diabling a DHCP server

Sun Feb 09, 2020 4:34 pm

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?
 
Zacharias
Forum Guru
Forum Guru
Posts: 1437
Joined: Tue Dec 12, 2017 12:58 am
Location: Greece

Re: Diabling a DHCP server

Mon Feb 10, 2020 6:35 pm

What ? Simply do not configure a DHCP Server...
 
User avatar
inteq
Member Candidate
Member Candidate
Posts: 162
Joined: Wed Feb 25, 2015 8:15 pm
Location: Romania

Re: Diabling a DHCP server

Tue Feb 11, 2020 1:15 am

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.
 
User avatar
eworm
Member
Member
Posts: 473
Joined: Wed Oct 22, 2014 9:23 am
Location: Oberhausen, Germany
Contact:

Re: Diabling a DHCP server

Thu Feb 13, 2020 9:45 am

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.
Manage RouterOS scripts and extend your devices' functionality: RouterOS Scripts
 
User avatar
inteq
Member Candidate
Member Candidate
Posts: 162
Joined: Wed Feb 25, 2015 8:15 pm
Location: Romania

Re: Diabling a DHCP server

Thu Feb 13, 2020 1:31 pm

You should never use numerical index in scripts.
Any particular reason?
 
nescafe2002
Long time Member
Long time Member
Posts: 649
Joined: Tue Aug 11, 2015 12:46 pm
Location: Netherlands

Re: Diabling a DHCP server

Thu Feb 13, 2020 3:23 pm

https://wiki.mikrotik.com/wiki/Manual:S ... ter_values

But for most entries with a identifier, you can use the name instead:

/ip dhcp-server disable default
/ip dhcp-server enable default
 
User avatar
inteq
Member Candidate
Member Candidate
Posts: 162
Joined: Wed Feb 25, 2015 8:15 pm
Location: Romania

Re: Diabling a DHCP server

Thu Feb 13, 2020 5:08 pm

https://wiki.mikrotik.com/wiki/Manual:S ... ter_values

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.

Who is online

Users browsing this forum: No registered users and 13 guests