Vidim ,že pro dost nováčků je peklo přepisovat mac adresse atp. ,tak sem tady pro ty tvory líné napsal takové základní MAC+IP Tools:
Kód: Vybrat vše
#Sonduje v ARP Tabulce a šecky nové dynamické záznamy přepisuje na statické
#Pro Mikrotik 2.9.x(asi)
:local prodleva
#Čas po ,který bude skript čekat na další kolo.Čím menší tím máte větší šanci ,že klient neunikne zraku ,ale tím větší spotřeba CPU.Doporučuju dat čas vypršení ARP záznamů(Prej defaultně u Oken 2m ,jak u MK nech radí chytřejší)
:set prodleva 2m
##########################################
#Pracovní adresář
/ip arp
:while true do={
:foreach a in=[find dynamic=yes] do={
add address=[get $a address] mac-address=[get $a mac-address] interface=[get $a interface]
}
:delay $prodleva
}
Vložte do MK jako script ,spuste ,nechte chvilku jet(myslim ,že za den sa prostřídajů na síti šecí) a až sa vam to nebude líbit tak stopnite.Doporučuju záznamy ručně prokontrolovat.
Výhody:-Pokud máte HW AP ,které klienty schovává tak to udělá statické právě z nich ,takže sa nemosíte starat estli pojede nebo ne
Nevýhody:-Pokud by ste to chtěli použit výpis z Static ARP Cache do DHCP Leases a máte HW AP schovávající MAC ,tak máte hold smolu a mosíte to ručně přepsat(pokud je jich víc tak esi už nepřipadá v úvahu to celé napsat ručně)
-Pokud někdo zrovna použije jiné IP než má a nebo bude pod man-in-the-midlo tak si to aj z nich nadělá statické ...,proto doporučuju ručně prokontrolovat
Kód: Vybrat vše
#Kopiruje IP+MAC mezi ARP Cache,Firewall Fiterem a DHCP Leases
#Pro MikroTik 2.9.X
:local Type
:local Chain
:local action
:local Inetrface
#Typ definující odkud kam sa bude kopirovat:
#ARP->FW
#FW->ARP
#DHCP->ARP
#ARP->DHCP
#FW->DHCP
#DHCP->FW
:set Type "FW->ARP"
#Pokud je zdroj nebo cíl Firewall tak prosím určete chain:
:set Chain "NET_users"
#Pokud je Cil Firewall určete prosim akci(accept,return,...)
:set action "accept"
#Interface ,které bude použito(záleží na Typu)
:set Interface "LANNET"
############################
#Pracovni adresar
/
#ARP->FW
:if ($Type="ARP->FW") do={
:foreach i in=[/ip arp find ] do={
/ip firewall filter add chain=$Chain src-address=[/ip arp get $i address] src-mac-address=[/ip arp get $i mac-address] in-interface=[/ip arp get $i interface] action=$action
}
}
#FW->ARP
:if ($Type="FW->ARP") do={
:foreach i in=[/ip firewall filter find chain=$Chain] do={
:if ([:tobool [/ip firewall filter get $i src-mac-address]] != false) do={
:if (($Interface = "") && ([:tobool [/ip firewall filter get $i in-interface]] != false)) do={
/ip arp add address=[/ip firewall filter get $i src-address] mac-address=[/ip firewall filter get $i src-mac-address] interface=[/ip firewall filter get $i in-interface]
}
:if ($Interface != "") do={
/ip arp add address=[/ip firewall filter get $i src-address] mac-address=[/ip firewall filter get $i src-mac-address] interface=$Interface
}
}
}
}
#DHCP->ARP
:if ($Type="DHCP->ARP") do={
:foreach i in=[/ip dhcp-server lease find ] do={
/ip arp add address=[/ip dhcp-server lease get $i address] mac-address=[/ip dhcp-server lease get $i mac-address] interface=$Interface
}
}
#ARP->DHCP
:if ($Type="ARP->DHCP") do={
:if ($Interface != "") do={
:foreach i in=[/ip arp find interface=$Interface] do={
/ip dhcp-server lease add address=[/ip arp get $i address] mac-address=[/ip arp get $i mac-address]
}
}
:if ($Interface = "") do={
:foreach i in=[/ip arp find] do={
/ip dhcp-server lease add address=[/ip arp get $i address] mac-address=[/ip arp get $i mac-address]
}
}
}
#FW->DHCP
:if ($Type="FW->DHCP") do={
:if ($Interface = "") do={
:foreach i in=[/ip firewall filter find chain=$Chain] do={
:if ([:tobool [/ip firewall filter get $i src-mac-address]] != false) do={
/ip dhcp-server lease add address=[/ip firewall filter get $i src-address] mac-address=[/ip firewall filter get $i src-mac-address]
}
}
}
:if ($Interface != "") do={
:foreach i in=[/ip firewall filter find chain=$Chain in-interface=$Interface] do={
:if ([:tobool [/ip firewall filter get $i src-mac-address]] != false) do={
/ip dhcp-server lease add address=[/ip firewall filter get $i src-address] mac-address=[/ip firewall filter get $i src-mac-address]
}
}
}
}
#DHCP->FW
:if ($Type="DHCP->FW") do={
:foreach i in=[/ip dhcp-server lease find ] do={
:if ($Interface = "") do={
/ip firewall filter add chain=$Chain src-address=[/ip dhcp-server lease get $i address] src-mac-address=[/ip dhcp-server get $i mac-address] action=$action
}
:if ($Interface != "") do={
/ip firewall filter add chain=$Chain src-address=[/ip dhcp-server lease get $i address] src-mac-address=[/ip dhcp-server get $i mac-address] in-interface=$Interface action=$action
}
}
}
Skript sem skoro celý(konec sem z nedostatku času odskůšat nestihl) skůšal a bez větších chyb to kopírovalo ,ale pokud sa vyskytne nějaká chyba(a ona sa vyskytne) ,tak sa ju prosim pokuste opravit a zveřejnit.Zatim je to taková spíš polofunkční konstrukce a nekontroluje vstupní data ,takže když něco špatně napíšete tak to prostě nepojede

(nečekané ,že?).Celé to vyřešim až sa vrátim(za pár dnů).
Výhody:To je snad jasné
Nevýhody:Zase problémy s HW AP ,které schovávajů klientské IP(třeba když zkopírujete z ARP do DHCP ,tak mosíte ručně opravit tych ,co majů schovanů MAC-Adresu)