HPE Community read-only access December 15, 2018
This is a maintenance upgrade. You will be able to read articles and posts, but not post or reply.
Hours:
Dec 15, 4:00 am to 10:00 am UTC
Dec 14, 10:00 pm CST to Dec 15, 4:00 am CST
Dec 14, 8:00 pm PST to Dec 15, 2:00 am PST
Comware Based
cancel
Showing results for 
Search instead for 
Did you mean: 

How to know MAC for specific port

 
JonisMaurin
Occasional Contributor

How to know MAC for specific port

Hi.

I have 52 units of A5120-EI switch and time to time, i need to know where some MAC address are connected. Is there any way to do that by command line or SNMP?

I've tried the command "display mac-address <mac>" and I've got the port.....but is not the right way. Way? Because, as I think, it's a MAC-table of know hosts, not the MAc os connected device on specific port.

For example: I have switchs: A------B-----C. My computer is connected to switch A and switch C doesn't have anything connected, except the 'link' in port 1, witch is in 'hybrid' mode aloowing X,Y,Z VLAN's.

After some time and after connecting on all Switchs from my computer to manage it, if I go to console on switch C and so this: "display mac-address <my mac>", I got all mac-address learned from other switchs, including my computer MAC......all saying that is know from port 1 (link port). With this, I can't find where my MAc is connected.

Is there any other way to do that? Of corse, I know the MAC address. My initial idea is to make an script with will connect on all my switchs, one by one, and do some commands to discovery if the specific MAC address are connected to that switch or not.

 

By the way, I'm not interested in any software. I need to implement this in my current system using any kind of connection; ssh, telnet, SNMP, etc...

 

Thanks!!

 

P.S. This thread has been moved from Switches, Hubs, Modems (Legacy ITRC forum) to Comware-Based. -HP Forum Moderator

 

5 REPLIES
Pete W
Valued Contributor

Re: How to know MAC for specific port

The command :

     dis mac-add aaaa-bbbb-cccc

 

... should display the interface where that mac-address was last seen. If this turns out to be a link to another switch, then you just repeat the process on that switch (and the next...) until you find the interface in question.

 

Is this a process that you need to perform frequently, and therefore wish to script?

 

Regards,

 

Pete

HPE MASE
Aruba ACMP
Fortinet NSE 1-7
Cisco CCNP
Richard Brodie_1
Honored Contributor

Re: How to know MAC for specific port

The function of the MAC forwarding table is so that data for that destination address is forwarded out that particular port, rather than flooded to all of them. This includes anything connected via an uplink to another switch.

 

If you want to find local machines, you have to discount ports connected to other switches. One way of doing that is by doing 'display lldp neighbor-information', assuming all your switches are running LLDP.

 

Needless to say, this should all be available through SNMP. However, it can take a while poking around to extract all the data and get it into a useful form.

Apachez-
Trusted Contributor

Re: How to know MAC for specific port

If you do port-security and enable "port-security trap" you will get SNMP traps when a new client is being identified, check this thread for more info:

 

http://h30499.www3.hp.com/t5/Comware-Based/Port-Security-on-A5500/td-p/6472778

 

You can also add these lines to your config to get a log entry through syslog when a new mac-address is being identified (along with which device identified it and for which physical interface):

 

mac-address information enable
mac-address information queue-length 0
mac-address information mode syslog
mac-flapping notification enable

 

The log entry will look something like:

 

Fri Jul 04 03:01:41 2014: <190>2014-07-04T03:01:41 SW1 %%10MAC/6/MAC_INFORMATION(l): -DevIP=1.2.3.4-Action=Added-MacAddr=aaaa-bbbb-cccc-VlanID=123-MACType=1-IfName=GigabitEthernet1/0/1; MAC address table changed.

JonisMaurin
Occasional Contributor

Re: How to know MAC for specific port

Tks for all answers!

 

I've made a script that run searching on all my switchs and to 'filter' those uplink ports, I'm using port-type. Ex: If MAC is found on port X and this port is of type 'trunk', ignore and keep searching.

It's working pretty good :)

 

Apachez-
Trusted Contributor

Re: How to know MAC for specific port

Sorry I missed that in order for the "mac-address information" to work you need to add this to the interface you wish to enable logging for:

 

mac-address information enable added

 

However if you already do port-security (and have configured that traps is sent as syslog aswell) the "mac-address information" might be redundant...