Mikrotik Remove DHCP Lease Blank Hostname

  • Ireka Pena
  • Sep 21, 2023

 

Mikrotik Remove DHCP Lease Blank Hostname

 

Kenapa perlu untuk me-remove DHCP Lease Hostname yang blank atau tanpa hostname. Sejauh yang saya tau perangkat-perangkat yang tanpa hostname yakni perangkat yang bukan handphone (kecuali Iphone) atau laptop mirip wifi repeater, wifi camera, dan perangkat serupa yang lain.

 

Karena ini free wifi jadi semestinya hanya perangkat mirip handphone dan laptop yang pribadi terhubung.

 

Nah, untuk meremove DHCP Lease Blank Hostname di router Mikrotik mampu menggunakan script berikut, pada script dibawah dapat melaksanakan skip ke perangkat Blank Hostname yang diperbolehkan terhubung ke jaringan, silahkan dimodifikasi sesuai keperluan.

 

:local client1 "32:72:A0:C6:97:63";
:local client2 "1A:BE:D8:FE:C2:85";

:foreach i in=[/ip dhcp-server lease find host-name  "^\$" ] do=
:local hostIP value=[/ip dhcp-server lease get $i value-name=active-mac-address]
:if (($hostIP = $client1) or ($hostIP = $client2)) do=
/ip firewall filter remove [/ip firewall filter find comment="drop $hostIP"]
:log warning "$hostIP release"
 else=
/ip firewall filter remove [/ip firewall filter find comment="drop $hostIP"]
/ip firewall filter add chain=forward src-mac-address=$hostIP action=drop comment="drop $hostIP"
/ip dhcp-server lease rem [find active-mac-address=$hostIP ]
:log warning "$hostIP remove from dhcp lease"

 

Demikian ulasan perihal Mikrotik Remove DHCP Lease Blank Hostname

 

Related Post :