tjh: I tried your recommendation, but get similar result.
show dhcp server leases | grep 'free' | awk 'NR >2 {print $1}' | xargs -I {} clear dhcp-server lease {}
Usage: clear [options]
Options:
-T TERM use this instead of $TERM
-V print curses-version
-x do not try to clear scrollback
Usage: clear [options]
Options:
-T TERM use this instead of $TERM
-V print curses-version
-x do not try to clear scrollback
Usage: clear [options]
..
..
..
I may have found a way just to get rid of the free leases
Each time you run clear dhcp lease $IP it asks
This will restart DHCP server.
Continue? [y/N]
So came up with script below which grabs only the “free” leases and loops through removing each one, one at a time. Need to sleep long enough to restart the dhcp service. Tried using yes n | for no, but that did not continue with deletion.
show dhcp server lease | grep "free" | awk '{print $1}' | while read ip; do
yes | clear dhcp lease $ip
sleep 5 # Sleep for 5 seconds after clearing each lease
done