Community discussions

MikroTik App
 
User avatar
Jotne
Forum Guru
Forum Guru
Topic Author
Posts: 3279
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

DHCP automatic dynamic to static

Wed Apr 03, 2019 3:41 pm

DHCP dynamic to static lease

I did search for a script that did convert dynamic lease to static lease, but did not find any good solution.
So I made a new script that is placed in the DHCP server settings and convert the dynamic IP to static IP.

Cut and past to:
IP->DHCP-Server->Select your dhcp server->Lease Script

PS this makes all IP static, no expedition.
# Created Jotne 2021 v1.4
#
# This scripts converts all DHCP release to static automatically
# It should run on all routerOS version

/ip dhcp-server lease
# Test if this is a Bound session and the lease is a dynamic one. Do not change older reservation
:if (($leaseBound=1) && ([find where dynamic mac-address=$leaseActMAC]!="")) do={

	# Get the lease number
	:local Lease [find mac-address=$leaseActMAC]
	
	# Get date and time
	:local date [/system clock get date]
	:local time [/system clock get time]
	
	# Make the lease static	
	make-static $Lease

	# Get host name
	:local Name [get $Lease host-name ] 
	
	# Add date and time as a comment to show when it was seen first time	
	comment comment="$date $time $Name" $Lease
	
	# Send a message to the log	
	:log info message="script=dhcp_static server=$leaseServerName IP=$leaseActIP MAC=$leaseActMAC name=$Name"
}

This script deletes all static DHCP entry that has not been seen last 100 weeks (can be adjusted). At the same time it also delete the DNS entry corresponding to DHCP lease that is removed.
# Created Jotne 2021 v1.2
# Remove all static DHCP and corresponding DNS leases more than 100 week old
# 1.1 Used simpler regex
# 1.2 Made more dynamic

# Set how old data you like to delete.  E.g older than 100 week ->"100w".  Older than 30 days -> "30d"
:local delete "100w"

# Find and delete entries
/ip dhcp-server lease
:foreach id in=[find where dynamic=no last-seen>[:totime $delete]] do={
	:local ip [get $id address]
	:local hostdhcp [get $id host-name]
	:local hostdns "N/A"
	# Remove DNS entry if exist
	:do {
		:set $hostdns [/ip dns static get [find where address=$ip] name]
		/ip dns static remove [find where address=$ip]
	} on-error={ }
	
	# remove DHCP entry
	remove $id
	
	# Send log message
	:log info message="script=dhcp_clean older_than=$delete ip=$ip host_dhcp=\"$hostdhcp\" host_dns=\"$hostdns\""
}
Last edited by Jotne on Sun Sep 25, 2022 3:23 pm, edited 11 times in total.
 
sopyan0807
newbie
Posts: 39
Joined: Wed Jan 22, 2020 5:21 pm
Location: Indonesia
Contact:

Re: DHCP automatic dynamic to static

Sat Jan 25, 2020 8:19 am

Thank you this script is useful
 
User avatar
Joni
Member Candidate
Member Candidate
Posts: 156
Joined: Fri Mar 20, 2015 2:46 pm
Contact:

Re: DHCP automatic dynamic to static

Sat Jan 25, 2020 6:30 pm

How about just extending the DHCP lease time to one month, so unless your device is offline for a month it will retain its IP address (and if you have lots of guests then setup a bigger subnet).
 
arielf
newbie
Posts: 34
Joined: Fri May 09, 2008 4:58 pm

Re: DHCP automatic dynamic to static

Sat Apr 25, 2020 7:24 pm

excellent script, works great
Could you add in comment, the host name that appears from the lease?
 
User avatar
Jotne
Forum Guru
Forum Guru
Topic Author
Posts: 3279
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: DHCP automatic dynamic to static

Sat Apr 25, 2020 10:35 pm

Host name will stay in the lease as host-name field.

But if you like to add it in the comment field as well, this should do:

# Created Jotne 2020 v1.3
#
# This scripts converts all DHCP release to static automatically
# It should run on all routerOS version


# Test if this is a Bound session and the lease is a dynamic one. Do not change older reservation
:if (($leaseBound=1) && ([/ip dhcp-server lease find where dynamic mac-address=$leaseActMAC]!="")) do {

# Get the lease number
	:local Lease [/ip dhcp-server lease find mac-address=$leaseActMAC]
	
# Get date and time
	:local date [/system clock get date]
	:local time [/system clock get time]
	
# Make the lease static	
	/ip dhcp-server lease make-static $Lease

# Get host name
	:local Name [/ip dhcp-server lease get $Lease host-name ] 
	
# Add date and time as a comment to show when it was seen first time	
	/ip dhcp-server lease comment comment="$date $time $Name" $Lease
	
# Send a message to the log	
	:log info message="script=dhcp_static server=$leaseServerName IP=$leaseActIP MAC=$leaseActMAC name=$Name"
}
 
ALX1S
newbie
Posts: 44
Joined: Mon Apr 27, 2015 5:28 pm
Location: Buenos Aires, Argentina

Re: DHCP automatic dynamic to static

Fri Aug 14, 2020 8:35 pm

Hello,

Thanks for your information.

You saved me with ":local Lease [/ip dhcp-server lease find mac-address=$leaseActMAC]". I am building a DHCP script that make static MACs inside allowed list file, and disable the ones that are not listed (in a csv file), then send a mail informing whats happened.

See you.

Alex
 
User avatar
Jotne
Forum Guru
Forum Guru
Topic Author
Posts: 3279
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: DHCP automatic dynamic to static

Wed Sep 01, 2021 9:04 pm

Since converting all DHCP lease to static will fill opp the DHCP scope over time, I have created a script that delete all static DHCP entry that has not been seen last 100 week. At the same time it also delete the DNS entry corresponding to DHCP lease that is removed.
# Remove all static DHCP and corenspondig DNS leases more than 100 week old
:local counter 0
/ip dhcp-server lease
:foreach id in=[find where dynamic=no last-seen~"^1[0-9][0-9]"] do={
	:local ip [get $id address]
	:set counter ($counter+1)
	# delete DNS entry with that IP
	/ip dns static remove [find where address=$ip]
	# remove DHCP entry
	remove $id
}
:log info message="Number of static DHCP older>100weeks removed: $counter"
Last edited by Jotne on Thu Sep 02, 2021 8:16 am, edited 1 time in total.
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11967
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: DHCP automatic dynamic to static

Thu Sep 02, 2021 3:34 am

the problem is when last-seen is "never" (like on reboot)
 
User avatar
Jotne
Forum Guru
Forum Guru
Topic Author
Posts: 3279
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: DHCP automatic dynamic to static

Thu Sep 02, 2021 8:15 am

On my test router last-seen remain correct after reboot and upgrade to 6.48.4
I do not have any never on the 750Gr3 router.

Here is the current list of last-seen on the router:
19h39m28s, 5w1d12h14m17s, 9h22m3s, 5w1d12h57m55s, 98w3d12h36m58s, 29w1d13h12m53s, 87w5d14h34m39s, 53w4d9h38m51s, 1d14h24m8s, 11h19m44s, 77w3d20h24m55s, 4w4d15h36m, 33w5d2h13m17s, 9w2d6h11m40s, 36w3d13h29m10s, 43w3d16h30m39s, 14w2d18h45m59s, 68w6d16h9m18s, 92w4d12h48m53s, 78w3d14h54m20s, 70w6d2h15m5s, 64w4d13h11m49s, 98w2d13h4m1s, 52w3d10h4m47s, 43w7h36m50s, 62w4d19h47m49s, 25w5d4h8m45s, 95w5d16h44m55s, 87w6d12h45m13s, 17w5d18h26m37s, 15w2d13h40m29s, 55w4d21h50m50s, 55w5d2h41m27s, 55w1d14h40m1s, 49w14h36m12s, 25w13h1m14s, 53w3d14h4m34s, 27w4d8h46m26s, 81w2d12h26m53s, 82w5d16h18m42s, 62w6d11h5m34s, 62w4d14h19m19s, 65w17h23m24s, 5w1d12h14m33s, 86w3d19h29s, 96w8h59m47s, 93w1d13h43m43s, 35w6d14h16m58s, 98w3d12h12m40s, 61w6d11h46m5s, 9h8m56s, 97w3d17h3m15s, 71w3d17h18m27s, 31w2d13h43m48s, 95w4d13h8m12s, 23w10h52m44s, 95w1d9h45m54s, 42w2d22h44m50s, 70w2d16h46m51s, 83w1d10h42m56s, 88w4d20h41m26s, 36m52s, 89w5d6h13m23s, 87w6d13h54m41s, 5w10h35m43s, 52w3d12h12m3s, 71w2d14h21m35s, 71w2d11h18m51s, 47w1d11h35m40s, 53w3d11h58m35s, 45w4d7h7m30s, 18h2m7s, 77w3d21h31m46s, 77w3d19h47m52s, 14h57m58s, 79w6d11h13m2s, 63w1d16h45m, 79w17h8m14s, 77w6d9h43m25s, 7h53m57s, 75w3d14h44m5s, 40w1d10h49m12s, 42w5d13h32m57s, 42w4d14h40m45s, 53w3d12h12m42s, 69w2d13h9s, 69w2d11h23m12s, 66w6d21h33m45s, 69w1d11h54m39s, 69w1d11h30m9s, 68w3d15h49m28s, 68w3d15h53m55s, 29w5d16h18m4s, 30w20h16m43s, 32w4d6h27m9s, 28w6d19h1m54s, 53w4d6h32m41s, 17w1d17h23m21s, 48w5d16h46m8s, 53w4d8h33m1s, 6d12h52m15s, 61w3d14h58m, 61w3d14h53m51s, 55m30s, 61w3h15m23s, 58w3d15h18m36s, 7w3d10h48m5s, 53w4d8h9m36s, 42w8h17m16s, 53w4d11h44m7s, 53w4d9h47m23s, 53w3d13h7m48s, 52w5d18h36m8s, 31w2d9h30m59s, 45w5d12h28m37s, 49w1d9h34m20s, 4w3d17h10m50s, 4w3d20h36m17s, 7h44m26s, 13h49m44s, 29w3d20h26m2s, 32w5d4h31m30s, 4w5d9h12m41s, 4w6d14h38m, 6d23h56m40s, 48w15h55m33s, 2w3d20h25m52s, 3w17h12m38s, 48w14h14m51s, 13w3d10h36m6s, 44w4d12h48m9s, 22w1d12h56m27s, 32w5d6h8m57s, 23w5d15h32m25s, 9w3d17h29m55s, 15h30m54s, 12w3d16h27m24s, 30w5d5h47m7s, 1w2d16h1m23s, 16w5d2h55m49s, 1d14h41m36s, 34w6d16h48m47s, 1h19m22s, 40w4d10h55m46s, 34w5d16h31m45s, 16w4d3h53m13s, 1w8h44m4s, 1d19h43m40s, 38w15h29m46s, 8w5d9h22m2s, 7w3d10h36m32s, 35w2d5h42m52s, 36w2d3h14m48s, 13w3d11h34m4s, 36w1d12h34m2s, 4w5d18h24m25s, 6d21h14m46s, 15w3d7h44m21s, 11w4d6h40m17s, 28w2d14h42m42s, 32w22h39m49s, 20w5d8h21m22s, 31w2d13h41m32s, 30w5d23h59m22s, 13w2d9h47m52s, 29w5d16h16m58s, 13h27m5s, 6d12h42m48s, 19w3d8h49m4s, 1d11h54m17s, 28w6d17h7m14s, 28w6d14h7m54s, 22w2d20h32m14s, 28w15h7m34s, 11w2d23h11m23s, 27w4d9h58m, 27w4d5h40m56s, 17w5d12h38m51s, 11h45m5s, 25w4d20h22m43s, 22m33s, 9h34m54s, 24w5d16h5m57s, 2d8h25m59s, 12w4d13h9m14s, 3w1d16h41m3s, 22w5d19h15m32s, 22w5d17h10m49s, 22w5d17h45m57s, 12w4d16h21m49s, 11w18h58m52s, 13w2d10h28m1s, 16w1d15h26m18s, 19w4d7h7m25s, 1d14h41m58s, 4w5d8h30m17s, 17w9h20m15s, 16w5d8h53m48s, 16w4d19h57m51s, 12w5d10h24m56s, 14w3d11h51m45s, 7w3d10h34m24s, 13w11h47m9s, 1d16h42m33s, 12w1d13h43m53s, 8w2d12h58m39s, 9w6d16h58s, 11w2d11h29m10s, 10w9h49m28s, 7w3d10h16m56s, 2w4d7h15m21s, 13h38m23s, 7w4d13h8m49s, 2w5d23h8m28s, 4d9h54m, 7w4d13h11m33s, 3w3d17h41m25s, 7w3d12h9m7s, 6w3d16h32m30s, 5w1d4h55m, 5w4d11h48m28s, 8h43m6s, 4w6d21h41m, 29m17s, 1w5d12h8m59s, 1d13h47m37s, 1d12h46m41s
 
User avatar
Jotne
Forum Guru
Forum Guru
Topic Author
Posts: 3279
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: DHCP automatic dynamic to static

Thu Sep 02, 2021 8:48 am

Script updated to 1.4 (in fist post)
Just some clean up and code shortening.
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11967
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: DHCP automatic dynamic to static

Thu Sep 02, 2021 10:03 am

For rapidly simulating "never", simply add manually a static lease.
 
User avatar
Jotne
Forum Guru
Forum Guru
Topic Author
Posts: 3279
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: DHCP automatic dynamic to static

Thu Sep 02, 2021 11:41 am

That is ok behavior. For me, if some is added manually, it should be removed manually.
All IP added by the script has last seen, as far as I see.
 
mikeson
just joined
Posts: 2
Joined: Thu Jul 13, 2017 2:45 pm

Re: DHCP automatic dynamic to static

Sun Oct 03, 2021 6:50 am

Google Translate:
hi, thank you for the script, please be able to script some condition in the sense of the data. delete only if there is some text in the comment?, or IP range?
in all the attempts I made, the script deletes IP addresses which, although added as a DHCP lease but subsequently changed to static, it is very important for me that these IP addresses are not lost,
for my attempt, I added to your script everything you delete, put it in the log .. and I was horrified by how many unwanted ones (for me, important IPs, it deleted ..)

like this ( :log info message="Number of static DHCP older>100weeks removed: $ip" )
Number of static DHCP older> 100weeks removed: 192.168.3.125
Number of static DHCP older> 100weeks removed: 192.168.32.31
Number of static DHCP older> 100weeks removed: 192.168.32.4
Number of static DHCP older> 100weeks removed: 172.16.0.54
Number of static DHCP older> 100weeks removed: 10.1.1.4


and more...
I know that in this range 192.168.0.0/16 it is undesirable for me to delete anything

many thanks four your work
_______
original lang:
ahoj, děkuji za script, byla by prosím možnost do scriptu dat nejakou podminku ve smyslu. smaze pouze pokud je v komentari nejaky text ?, popripade IP rozsah ?
ve vsech pokusech ktere jsem udelal, mi script maze IP adresy ktere, byly pridany sice jako DHCP lease ale nasledne zmeneny na statick, je pro me velice dulezite aby se tyto IP adresy neztraceli,
pro muj pokus jsem do Vaseho scriptu pridal vsechno co smazes dej do logu.. a byl jsem zdesen kolik nezadoucich ( pro me dulezitych IP to smazalo.. )

vím ze v rozsahu 192.168.0.0/16 je pro me nezadouci cokoliv mazat

like this ( :log info message="Number of static DHCP older>100weeks removed: $ip" )
Number of static DHCP older>100weeks removed: 192.168.3.125
Number of static DHCP older>100weeks removed: 192.168.32.31
Number of static DHCP older>100weeks removed: 192.168.32.4
Number of static DHCP older> 100weeks removed: 172.16.0.54
Number of static DHCP older> 100weeks removed: 10.1.1.4

a dalsich..
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11967
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: DHCP automatic dynamic to static

Sun Oct 03, 2021 3:55 pm

nahradit <dhcp-server-name> název serveru DHCP, ze kterého nechcete, aby byl odstraněn:

# Remove all static DHCP and corenspondig DNS leases more than 100 week old
:local counter 0
/ip dhcp-server lease
:foreach id in=[find where server!="<dhcp-server-name>" and dynamic=no and last-seen~"^1[0-9][0-9]\$"] do={
	:local ip [get $id address]
	:set counter ($counter + 1)
	# delete DNS entry with that IP
	/ip dns static remove [find where address=$ip]
	# remove DHCP entry
	remove $id
}
:log info "Number of static DHCP older > 100 weeks removed: $counter"
 
User avatar
diamuxin
Member
Member
Posts: 317
Joined: Thu Sep 09, 2021 5:46 pm
Location: Alhambra's City

Re: DHCP automatic dynamic to static

Wed Sep 14, 2022 2:26 pm

Hi!

Do you know if in ROS 7.X (7.5 specifically) something has changed in the syntax, referring to the following query?
/ip dhcp-server lease
:if (($leaseBound=1) && ([/ip dhcp-server lease find where dynamic mac-address=$leaseActMAC]!="")) do= {
:do {
<...>
}
Thanks & BR.
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11967
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: DHCP automatic dynamic to static

Wed Sep 14, 2022 8:10 pm

try first correct syntax...

do not compare "empty string" with "empty array", "array with single id" or "array of id"...
(find return one array, and that array can be empty, with only one element, or with more elements inside, and "" is a empty string)

do not compare number with string ($leaseBound is a string, yes is counterintuitive)

"where dynamic mac-address" where is the "and"?

"where dynamic" what???
dynamic can be yes or no (string), not a true / false

"do= {" no space between = and {

v6 and v7 code

/ip dhcp-server lease
:if ( ($leaseBound = "1") and ([:len [find where dynamic=no and mac-address=$leaseActMAC]] > 0) ) do={
# ...
}
 
User avatar
diamuxin
Member
Member
Posts: 317
Joined: Thu Sep 09, 2021 5:46 pm
Location: Alhambra's City

Re: DHCP automatic dynamic to static

Wed Sep 14, 2022 11:34 pm

This script is from Jotne (first post) and I've had it running until I upgraded to ROS 7.5.
Thank you Rextended for your invaluable help.

BR.
 
User avatar
Jotne
Forum Guru
Forum Guru
Topic Author
Posts: 3279
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: DHCP automatic dynamic to static

Thu Sep 15, 2022 8:23 am

Do you say that the original script in post #1 does not work in 7.5
 
tomislav91
Member
Member
Posts: 303
Joined: Fri May 26, 2017 12:47 pm

Re: DHCP automatic dynamic to static

Sun Sep 18, 2022 12:56 am

where to put your second script
This script deletes all static DHCP
?
 
User avatar
Jotne
Forum Guru
Forum Guru
Topic Author
Posts: 3279
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: DHCP automatic dynamic to static

Sun Sep 18, 2022 7:56 am

Did you read the line? You just did quote part of it.
This script deletes all static DHCP entry that has not been seen last 100 weeks (can be adjusted).
Bottom script is to clean up your DHCP, so if no one uses a lease for more than 100 weeks, then just remove it.
No need for static leases that are not used.
 
User avatar
nichky
Forum Guru
Forum Guru
Posts: 1275
Joined: Tue Jun 23, 2015 2:35 pm

Re: DHCP automatic dynamic to static

Mon Sep 19, 2022 7:30 am

i did check on v7.4. it does work
 
egysaico
just joined
Posts: 6
Joined: Sat Sep 24, 2022 3:57 pm
Location: EGYPT

Re: DHCP automatic dynamic to static

Sat Sep 24, 2022 4:01 pm

Please I need to modify the 100week period to be like a month, it is more convenient for my needs
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11967
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: DHCP automatic dynamic to static

Sat Sep 24, 2022 5:52 pm

and you need help to replace "^1[0-9][0-9]w" with "^[4-9]w" ?
 
egysaico
just joined
Posts: 6
Joined: Sat Sep 24, 2022 3:57 pm
Location: EGYPT

Re: DHCP automatic dynamic to static

Sun Sep 25, 2022 12:51 am

and you need help to replace "^1[0-9][0-9]w" with "^[4-9]w" ?
Dear rextended thank you for reply so fast, could you please put mor examples with the real period it will translated to in mikrotik?

you just need to refer how many days this value will means "^[4-9]w"

PS, I am no coding expert so I think some help with codes explanation should be useful
Last edited by egysaico on Sun Sep 25, 2022 1:15 am, edited 1 time in total.
 
User avatar
Jotne
Forum Guru
Forum Guru
Topic Author
Posts: 3279
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: DHCP automatic dynamic to static

Sun Sep 25, 2022 1:14 am

 
egysaico
just joined
Posts: 6
Joined: Sat Sep 24, 2022 3:57 pm
Location: EGYPT

Re: DHCP automatic dynamic to static

Sun Sep 25, 2022 1:19 am

I have no experience with this coding sites sorry I cannot get the point, can you give me the final code for like this three values: week, 10days and a month
 
User avatar
Jotne
Forum Guru
Forum Guru
Topic Author
Posts: 3279
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: DHCP automatic dynamic to static

Sun Sep 25, 2022 9:32 am

Format of Last-seen utime
1-59mxxxx for less than 1 hour
1-23hxxxx for less than 24 hour
1-6dxxxxx for less than 1 week
[number]w for more than 1 week

So this: 4w6d18h57m56s
4 week 6 days 18 hours 57 min 56s uptime.
We are with the ^ in regex testing for the first number in the uptime.
PS I have updated script in fist post to include w so if you search for 4 weeks, it will not hit on 4 hours or 4 minutes. So change from "^1[0-9][0-9]" to "^1[0-9][0-9]w"

So what does last-seen~"^1[0-9][0-9]w" mean:
last seen must start ^ with a number 1 than any number 0 to 9 and then any number 0 to 9 than a w
This will then be all
100w
101w
102w
.
.
199w

So here wee looks for number larger than we need. All numbers larger than what you need.


You like to delete all leases older than one month. Sine routerOS do uses week after 6 days wee need to search for number of weeks closest to 1 month. We can use 4 weeks as 28 days.
So delete dhcp leases older than 4 weeks, you can do.
last-seen~"^[4-9]w"
PS this will only delete leases more than 4 weeks old but not older than 9 weeks.
So if you like to include all leases older than 4 weeks (first time you run it)
last-seen~"([4-9]|[1-9][0-9]+)w"
This will be 4-9 weeks any weeks larger than 10weeks
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11967
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: DHCP automatic dynamic to static

Sun Sep 25, 2022 12:16 pm

or simply replace last-seen~"^1[0-9][0-9]"

with
# for 100 weeks
last-seen>[:totime "100w"]

# for 30 days
last-seen>[:totime "30d"]

Note:
RouterOS can compare "time" (nothig to do with what all programmers mean for date-time format)
:put ([:totime "4w1d23h59m59s"] < [:totime "30d"])
:put ([:totime "4w2d"] = [:totime "30d"])
:put ([:totime "4w2d0h0m1s"] > [:totime "30d"])
the string must be converted with :totime before used, last-seen obviously is already "RouterOS time format"
 
User avatar
Jotne
Forum Guru
Forum Guru
Topic Author
Posts: 3279
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: DHCP automatic dynamic to static

Sun Sep 25, 2022 1:46 pm

The guru has spoken :)

Thanks.
 
User avatar
Jotne
Forum Guru
Forum Guru
Topic Author
Posts: 3279
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: DHCP automatic dynamic to static

Sun Sep 25, 2022 3:23 pm

Updated delete script to be more dynamic in first post.
You can set delete age in start of script.
 
egysaico
just joined
Posts: 6
Joined: Sat Sep 24, 2022 3:57 pm
Location: EGYPT

Re: DHCP automatic dynamic to static

Sun Sep 25, 2022 4:03 pm

Updated delete script to be more dynamic in first post.
You can set delete age in start of script.
Thank you very much, I am really appreciating your reply, and will give it a try
 
egysaico
just joined
Posts: 6
Joined: Sat Sep 24, 2022 3:57 pm
Location: EGYPT

Re: DHCP automatic dynamic to static

Sun Sep 25, 2022 4:06 pm

or simply replace last-seen~"^1[0-9][0-9]"

with
# for 100 weeks
last-seen>[:totime "100w"]

# for 30 days
last-seen>[:totime "30d"]
[…]

Thank you for giving the effort to reply so fast
Last edited by rextended on Sun Sep 25, 2022 4:27 pm, edited 1 time in total.
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11967
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: DHCP automatic dynamic to static

Sun Sep 25, 2022 4:26 pm

:)

Please do not reply inside quoted text... :?
 
egysaico
just joined
Posts: 6
Joined: Sat Sep 24, 2022 3:57 pm
Location: EGYPT

Re: DHCP automatic dynamic to static

Sun Sep 25, 2022 11:40 pm

:) forgive me please

Who is online

Users browsing this forum: JDF and 16 guests