Repository navigation
Description
Summary
MacTrack exists to answer two questions: where is this device plugged in, and what is on this port? These proposals make those answers more accurate and quicker to get. They are ordered by value, and each one would be its own PR.
They come after the open correctness work (#399, #351, #355, #356) and after #270, since several of them read more history from tables that already grow without limit.
flowchart LR
bugs["Bug fixes<br/>#399 #351 #355 #356"] --> part["Partitioning<br/>#270"]
bugs --> up["1. Uplink detection"]
bugs --> v6["6. IPv6 neighbours"]
part --> hist["3. Location history"]
up --> look["2. Lookup"]
hist --> look
up --> free["4. Free-port report"]
up --> alerts["5. Alerts"]
hist --> alerts
look --> api["7. JSON lookup endpoint"]
Proposals
1. Detect uplinks from LLDP and CDP neighbours
Today a port counts as a trunk only through per-device settings (scan_trunk_port) and the trunk status from the scanner. No scanner collects LLDP or CDP. When a switch-to-switch or switch-to-AP port is not set up as a trunk, MACs on it are reported as locally connected, which is the most common way MacTrack gives a wrong location.
- Walk
lldpRemTable, andcdpCacheTablewhere available, during the device scan. - Store neighbours for each device and port, and treat ports with a network neighbour as uplinks unless an operator overrides it.
- Show the neighbour on the interfaces report.
flowchart TD
scan["Device scan"] --> ovr{"Operator set the port role?"}
ovr -- "Uplink" --> upl["Uplink: store the neighbour,<br/>do not record MACs on this port"]
ovr -- "Access" --> acc["Access port: record its MACs"]
ovr -- "No" --> walk["Read LLDP and CDP neighbours"]
walk --> nb{"Neighbour is a switch or AP?"}
nb -- "Yes" --> upl
nb -- "No" --> acc
The same neighbour data could later suggest map layouts in Weathermap.
2. One lookup for a MAC, IP, hostname or vendor
A single search that returns the switch, port, VLAN, IP addresses, vendor, first and last seen, and recent moves on one page. The MAC, IP and ARP reports each hold part of this today, and helpdesk users have to know which one to open. This should use the card layout from #412.
3. History of each device's location
A timeline of every port, VLAN and IP address a MAC has been seen on. mac_track_aggregated_ports already records first and last seen dates, so the first version can be built from existing data. Keeping more detail depends on #270.
Proposals 2 and 3 together:
sequenceDiagram
actor U as Helpdesk user
participant L as Lookup page
participant DB as MacTrack tables
U->>L: MAC, IP, hostname or vendor
L->>L: Normalise the query (any MAC format)
L->>DB: Search port, IP and ARP data
DB-->>L: Matching devices
U->>L: Pick a device
L->>DB: Read aggregated history
DB-->>L: Ports, VLANs and IPs over time
L-->>U: Current location and timeline
4. Free-port report
Access ports with no MAC seen in a set number of days, by device and site, with totals. This is a common reason sites buy a separate port-mapping tool.
5. Better alerts
MAC Watch and MAC authorisation already exist. New alert types:
- an unknown MAC on a port that has only ever had one device
- a MAC that moves between sites
- a port with more MACs than a set limit, which usually means an unmanaged switch someone plugged in
Send these through Cacti notification lists instead of the plugin's own mail settings.
flowchart TD
scan["Scan finishes"] --> cmp["Compare MAC and port data<br/>with the previous scan"]
cmp --> r1{"Unknown MAC on a<br/>single-device port?"}
cmp --> r2{"MAC moved to<br/>another site?"}
cmp --> r3{"Access port over<br/>its device limit?"}
r1 -- "Yes" --> dup{"Same alert sent recently?"}
r2 -- "Yes" --> dup
r3 -- "Yes" --> dup
dup -- "No" --> send["Send to the rule's<br/>Cacti notification list"]
dup -- "Yes" --> skip["Skip"]
6. IPv6 neighbours for every scanner
Only the Aruba AOS-CX scanner walks ipNetToPhysicalTable. Collecting it for all devices would show the IPv6 addresses of dual-stack hosts. This needs #355 and #356 fixed first, because xform_net_address() currently corrupts compressed IPv6 addresses.
7. A read-only JSON lookup endpoint
The lookup from proposal 2 as JSON, for NAC, helpdesk and DHCP tools. It should use Cacti's existing permissions and be read-only.
Requests already filed
These fit the same direction and stay in their own issues:
- Have Mactrack use Cacti sites instead #152 use Cacti sites instead of MacTrack's own sites
- Allow site device mapping without L3 device in that site. #151 map site devices without an L3 device in the site
- import button for sites #113 and Feature Request: Export/Import MT Sites #71 import and export sites
- Add a few columns to the dot1x feature #122 more dot1x columns
Out of scope
- Device fingerprinting from DHCP or traffic: that is a different product.
- Drawing topology inside MacTrack: that belongs in Weathermap, which can use the neighbour data from proposal 1.
Related
- Adopt PHP 8.3 and enforceable PHP standards (umbrella) #315 modernisation roadmap. These features should be built on its shared report code (refactor: centralize report filter and export plumbing #358), not on more copies of each report page.
- New errors after sync of latest PR's #270 partitioning for
mac_track_ips, needed before keeping more history.
Questions
- Should uplink detection replace the per-device trunk settings, or only fill them in when they are empty?
- Is the card-based lookup page the right home for proposals 2 and 3, or should they extend the existing MAC report?
Activity