Community discussions

MikroTik App
 
heavenlyangel
just joined
Topic Author
Posts: 18
Joined: Fri Apr 16, 2021 5:48 pm

Bridge Hosts to Interface Comments Script

Fri Apr 16, 2021 5:49 pm

Does anyone have a script that goes through the Bridge -> Hosts table, looks up each MAC as a hostname and comments it in the Interfaces page. This would effectively show what is plugged into each interface. I think it would be really useful.
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3291
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: Bridge Hosts to Interface Comments Script

Mon Apr 19, 2021 3:13 pm

Some like this:

It looks up all data in "ip arp"
For each entry it gets IP and MAC
The we lookup the mac in "ip bridge host" to get physical interface
:foreach i in=[/ip arp find] do={
	:local if
	:local localmac [get $i mac-address]
	:local address [get $i address]
	:do {
		:set if [/interface bridge host get [find where mac-address=$localmac] interface]
	} on-error={}
	:put "Mac=$localmac Address=$address Interface=$if"
}
I guess ut could be created the other way around as well.

Who is online

Users browsing this forum: No registered users and 21 guests