Community discussions

MikroTik App
 
nediis
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 63
Joined: Wed Jul 11, 2018 10:32 am

Can't enable dhcp-client

Mon Oct 02, 2023 3:27 am

Hi,

[user@SIN-R1-1] > /ip dhcp-client pri
Columns: INTERFACE, USE-PEER-DNS, ADD-DEFAULT-ROUTE, STATUS, ADDRESS
# INTERFACE USE-PEER-DNS ADD-DEFAULT-ROUTE STATUS ADDRESS
0 v80-modem1 no no bound x.x.x.x/32

/ip dhcp-client disable numbers=v80-modem1 <-- it's ok

after that I want to return the setting back

[user@SIN-R1-1] > /ip dhcp-client enable numbers=v80-modem1 <-- the interface is empty, I enter it manually
no such item

[user@SIN-R1-1] > /ip dhcp-client pri
Flags: X - DISABLED, I - INVALID
Columns: INTERFACE, USE-PEER-DNS, ADD-DEFAULT-ROUTE
# INTERFACE USE-PEER-DNS ADD-DEFAULT-ROUTE
0 X v80-modem1 no no

As a result it doesn't work when I try to enable
[:parse "/ip dhcp-client $1 $InterfaceISP2"]

v80-modem1 - vlan interfaces
RB3011 ver 7.11.2
 
sid5632
Long time Member
Long time Member
Posts: 554
Joined: Fri Feb 17, 2017 6:05 pm

Re: Can't enable dhcp-client

Mon Oct 02, 2023 3:32 am

v80-modem1 is not a number, is it?
The number is at the start of the line (the # column) and is 0 in this case.
 
nediis
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 63
Joined: Wed Jul 11, 2018 10:32 am

Re: Can't enable dhcp-client

Mon Oct 02, 2023 3:38 am

why, then
user@SIN-R1-1] > /interface/ethernet/disable numbers= <-- press TAB
ether... ether9 sfp1
and working
?
 
sid5632
Long time Member
Long time Member
Posts: 554
Joined: Fri Feb 17, 2017 6:05 pm

Re: Can't enable dhcp-client

Mon Oct 02, 2023 3:41 am

I expect it's a bug. Ask MikroTik support if you care that much.
An interface name is not a number. Deal with it.
 
nediis
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 63
Joined: Wed Jul 11, 2018 10:32 am

Re: Can't enable dhcp-client

Mon Oct 02, 2023 3:53 am

It's a pity that this is a bug and not a new feature

(evl /ip/dhcp-client/disablenumbers=v80-modem1)

VS

(evl /ip/dhcp-client/disablenumbers=(evl (evl /ip/dhcp-client/findwhere=$interface;$add-default-route;$default-route-distance;$us
e-peer-dns;$use-peer-ntp;$dhcp-options;$script;$status;$address;$netmask;$gateway;$dhcp-server;$primary-dns;$secondary-dns;$prima
ry-ntp;$secondary-ntp;$caps-managers;$expires-after;$invalid;$dynamic;$disabled;$comment;$.id;$.nextid;$.dead;(= $interf (- $v80
$modem1));0)))
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 12025
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Can't enable dhcp-client

Mon Oct 02, 2023 12:32 pm

beyond any bug:
1) numbers should not be used on scripts (this is not the time to explain here, see the other dozens of posts about it in the forum)
2) don't forget the quotes for the strings, especially if there is a "-" in the name
3) dhcp-client do not have name, so you must search it by interface

So, the correct syntax is:
/ip dhcp-client disable [find where interface="v80-modem1"]

/ip dhcp-client enable [find where interface="v80-modem1"]
Learn how to script first, then talk about bugs.
 
nediis
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 63
Joined: Wed Jul 11, 2018 10:32 am

Re: Can't enable dhcp-client

Mon Oct 02, 2023 12:52 pm

(evl /ip/dhcp-client/disablenumbers=(evl (evl /ip/dhcp-client/findwhere=$interface;$add-default-route;$default-route-distance;$us
e-peer-dns;$use-peer-ntp;$dhcp-options;$script;$status;$address;$netmask;$gateway;$dhcp-server;$primary-dns;$secondary-dns;$prima
ry-ntp;$secondary-ntp;$caps-managers;$expires-after;$invalid;$dynamic;$disabled;$comment;$.id;$.nextid;$.dead;(= $interf (- $v80
$modem1));0)))
&&
/ip dhcp-client disable [find where interface="v80-modem1"]
Isn't this the same thing?
that's not what the question was about ...
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 12025
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Can't enable dhcp-client

Mon Oct 02, 2023 12:57 pm

that's not what the question was about ...
Ah... NOT?

Topic title: Can't enable dhcp-client

Who is online

Users browsing this forum: Amazon [Bot], rplatt, tawfikhtm and 5 guests