There are so called MAC address tables. In snmp there are just a tree. If you have small office and only 1 switch you can go through dashboard and check all ports manually.
I have 9 switches with ip addresses 192.168.1.101-109. I have port 48 as incoming port, so it has to be excluded from search. If you want to search all ports, erase part "|grep -v "ports 48" from script.
Create a shell script named macport.sh.
nano macport.sh
Paste this text in body
address=$((0x$1)).$((0x$2)).$((0x$3)).$((0x$4)).$((0x$5)).$((0x$6))
for i in {1,2,3,4,5,6,7,8,9};do
echo check $i switch
snmpwalk -v 2c -c secret 192.168.1.10$i 1.3.6.1.2.1.17.7.1.2.2.1.2.1 | sed 's/iso.3.6.1.2.1.17.7.1.2.2.1.2.1.//' | sed 's/= INTEGER:/ports/'|grep -v "ports 48"|grep $address
done
Make it executable
chmod +x macport.sh
To execute type in shell
./macport.sh 08 af 27 81 04 13
where 08 af 27 81 04 13 is mac address, i want to found.
Nav komentāru:
Ierakstīt komentāru