Hi.
I wanna make a DHCP-Lease static.
For example: I want to make Number 0 static.
ADDRESS MAC-ADDRESS HOST-NAME SERVER RATE-LIMIT STATUS
0 D 192.168.0.253 00:16:D1:ED:F5:E6 lap server1 bound
Is it possible to create a script statement like "make-static where address=192.168.0.253" or
"make-static where host-name="lap"" ?
My problem is, I got a DHCP-Lease table with more than one entries. And I want to make an entry automatically static, if it has a host-name like "lap" for example.
I can't choose "make-static numbers=0" because I don't know what exactly number my entry has.
I tried it via
:put [/ip dhcp-server lease get [find host-name="lap"] numbers]
but a column named "numbers" or "#" doesn't exist .
I hope you can help me.
janisk
October 13, 2010, 12:23pm
2
find will return you the id of the item, then on this item you run make-static
something like this if i have understood you correctly:
/tool user-manager user reset-counters[/tool :user-manager user find subscriber ="admin"]
fewi
October 13, 2010, 12:23pm
3
/ip dhcp-server lease make-static [/ip dhcp-server lease find address="192.168.0.253"]
In scripts you should NEVER (read: not unless you are really, really sure that you need to, which is virtually never) refer to the numbers. You should use find to identify the entries you want to modify, and run whatever command on the array of identifiers returned by the find command.
Hi,
I’m in a situation pretty like this…
I wanna make a static lease via CLI but it return me always:
no such item
How can I make static lease?
fewi
February 10, 2011, 5:31pm
5
Post the output of “/ip dhcp-server lease print detail” and the exact command you’re trying to execute.
thanks for the answer:
here is the output of the command you suggest me:
Flags: X - disabled, R - radius, D - dynamic, B - blocked
0 D address=192.168.101.253 mac-address=00:0C:42:15:D2:C7
client-id="1:0:c:42:15:d2:c7" server=dhcp1 always-broadcast=yes
status=bound expires-after=2d10h57m22s active-address=192.168.101.253
active-mac-address=00:0C:42:15:D2:C7
active-client-id="1:0:c:42:15:d2:c7" active-server=dhcp1 host-name="BM1"
1 D address=192.168.101.251 mac-address=00:0C:42:16:1C:F9
client-id="1:0:c:42:16:1c:f9" server=dhcp1 status=bound
expires-after=2d2h11m47s active-address=192.168.101.251
active-mac-address=00:0C:42:16:1C:F9
active-client-id="1:0:c:42:16:1c:f9" active-server=dhcp1 host-name="BS1"
fewi
February 10, 2011, 5:42pm
7
Right. What exact command are you trying to run?
ip dhcp-server lease make-static
fewi
February 10, 2011, 5:50pm
9
You need to provide the item to convert.
Flags: X - disabled, R - radius, D - dynamic, B - blocked
0 D address=192.168.101.253 mac-address=00:0C:42:15:D2:C7
client-id="1:0:c:42:15:d2:c7" server=dhcp1 always-broadcast=yes
status=bound expires-after=2d10h57m22s active-address=192.168.101.253
active-mac-address=00:0C:42:15:D2:C7
active-client-id="1:0:c:42:15:d2:c7" active-server=dhcp1 host-name="BM1"
1 D address=192.168.101.251 mac-address=00:0C:42:16:1C:F9
client-id="1:0:c:42:16:1c:f9" server=dhcp1 status=bound
expires-after=2d2h11m47s active-address=192.168.101.251
active-mac-address=00:0C:42:16:1C:F9
active-client-id="1:0:c:42:16:1c:f9" active-server=dhcp1 host-name="BS1"
The client with MAC address 00:0C:42:15:D2:C7 is item 0 (first line, leftmost column). The client with MAC address 00:0C:42:16:1C:F9 is item number 1.
To make the lease for 00:0C:42:16:1C:F9 static, run:
/ip dhcp-server lease make-static 1
If you don’t know the item number and don’t feel like looking, you can also find the item first by MAC address:
/ip dhcp-server lease make-static [/ip dhcp-server lease find mac-address="00:0C:42:16:1C:F9"]
If you want to make all items static, you still have to explicitly say so:
/ip dhcp-server lease make-static [/ip dhcp-server lease find]