# Based on https://forum.mikrotik.com/viewtopic.php?t=153641
:local recipient "email@address.com"
/ip dhcp-server lease
:if (($leaseBound=1) && ([/ip dhcp-server lease find where dynamic mac-address=$leaseActMAC]!="")) do {
:do {
:tool e-mail send to=$recipient subject="DHCP Address Alert [MAC: $leaseActMAC]" body="The following device received an Dynamic IP address:
Mac: $leaseActMAC
Ip: $leaseActIP,
Host: $lease-hostname,
Bound: $leaseBound"
:log info "Sent Dynamic IP alert for MAC $leaseActMAC, $leaseActIP, $lease-hostname"
} on-error={:log error "Failed to send alert email to $recipient"}
}}
I'd imagine not, but several workarounds.Thanks, but none of those responses really get close to the core issue. This is a home network but with many (60+) Devices. All mobile devices have been set to use hardware MAC, and all devices have Static DCHP Leases. I have even gone one step further, with a script that sends me an Email every time an unknown device receives an IP Address: (DHCP Server -> DHCP -> Scripts)
I do not believe there is currently any RouterOS equivalent method of giving a client a 'friendly name' that is used globally across all windows and apps.
This is what I am looking for - a global 'MAC address --> friendly name' label that can be seen wherever that MAC Address is displayed.DNS only applies to IP, there is no equivalent database/mapping for name to MAC address.
Thanks - this is useful, I have added the 'Address List' column to DHCP Server, but guess what, you can't add it anywhere else, like Kid Control, Mikrotik Home App, and it is not visible in log entries, etc. I guess there is simply an acceptance in the RouterOS community that you must take multiple additional steps to translate an IP Address / MAC Address back into an understandable "Johns Mobile" or "The PC in the Conference Room"Since you have static DHCP lease entries, you can use the "address-list" option as the unique name field.
But would that name be visible everywhere I see the corresponding IP/MAC? I suspect not...Alternatively you could try new User Manager in V7 at somepoint, and then use RADIUS to auth your users. A bit overkill for a typical home, but your whitelisting your clients already, 60 devices, etc... That give you even more ability to set a "name", and likely add another measure of control.
No, this is exactly how things are designed to work.[...] And what seemed to be strange that i.e mobile phone internal MAC address after connecting to router was getting a different MAC... [...]
Isn't the answer to this to set the Hostname on the client?In most Routers/Firewalls/HotSpots I have used, there is some very simple & consistent method of giving a friendly/memorable name to a client,
As a RouterOS newbie I really struggle with the lack of a consistent approach to this - for example in DHCP Server I can add a 'Comment' to give a friendly name to a client, but that comment remains local to only the DHCP window - if I navigte to 'Kid Control' I lose my DHCP assigned comment, but here, (in Kid Control) instead of 'Active Hostname' I have 'Name' - and here I can override that name into a friendly name (which will not appear anywhere else in RouterOS...)
If I open My Mikrotik Home app and navigate to 'Clients', I see a MAC address if the client did not supply a Hostname - and again here I need to navigate to 'Edit device Details', and rename the device with my friendly name...
Open Dude Server... Here we go again - no friendly name, and another need to rename the client.
Except that for many devices, you have no control over that - Especially IoT devices. For example:Isn't the answer to this to set the Hostname on the client?
Oh.......My Garmin GPS has a Host Name of "rogue"
Mine is a DriveSmart65. I do like the GPS and the ability to update it via WiFi. It's fast enough that by the time I back into driveway, the GPS has connected to the WiFi, connected to my NTP server (not sure why a GPS needs to check in with an NTP server), and it has checked in with the Garmin servers to determine if there is an update.Oh.......My Garmin GPS has a Host Name of "rogue"
My Garmin DriveSmart76 is called.... "koala"!!!
Isn't the answer to this to set the Hostname on the client?
On many Android devices you cannot set it, but on phones of the past ~7 years you can actually set the device name in the settings menu.Well if you can tell me how to do it:
- on Android devices (for instance phones, tv boxes, media players) or other devices which ignore the hostname for DHCP I'll be happy to apply your solution.
Totally agree. The OP wasn't wrong. A "client" manifest itself in a lot of places: Wi-Fi registration, DHCP lease, ARP cache, L2 firewall, VPN interfaces, etc., etc. But there isn't a good view "all connect devices" & certainly no way to "name" them. While creating static DHCP reservations can help with a device name, problem that device name doesn't appear elsewhere. And, yeah a lot of ISP routers have a "device list" with a edit button for a name, so OP's request isn't crazy.But it isn't what the question initially was about anyway. What RouterOS lacks is a convenient mechanism to keep track of MAC addresses (and IP addresses) throughout the router configuration. That could be placed on the feature request list, at some appropriate priority.
Any news on the topic? Does the aforementioned message make it clear that a non-expert user like me could finally name the various connected clients?Well it seems that work is progressing a little on this. E.g. now you can see the hostname and connection port in the ARP table (and DHCP leases).
It is also possible to assign an address list to a static DHCP entry and it will put the assigned address in the address list, e.g. for use in the firewall.
But there is still a lot that could be improved.
Not all devices have random MACs though. In my home network all known devices either by default have a fixed MAC ID or have been configured to use one. Mobile devices (phones, tablets) revert to a random MAC ID only if I rename my SSIDs, but once properly configured they stay put. Any unknown/guest devices are assigned IP addresses from a specific IP range. I value the ability to set up human-friendly names that adhere to a certain consistent format across the board. Some devices don't even let you edit the device name and just use the one given by the manufacturer, often not a very pretty-looking one.Did you ask Sony?+1 - my PS5 provide no name and it is VERY annoying. NOT FIXED IN ROS 7!!!!
What are you writing? If there is no name it depends on the PS5, not RouterOS (and not from any other system either).
Learn how things work before writing this bu!!sh*t.
As for having a list of known MACs, with a description to match it is another thing, especially with the other bu!!sh*t of random MACs...
You may be able to do what you want using the vendor class.+1
also can we have a way for DHCP server to put devices in a IP pool based on their name using regexp ?
Sure, I didn't understand, what an idiot...Yes. Vendor class has nothing to do with MAC.