Linux + which tool can help to identify which eth in the Linux machines connected to which port in the cisco switch

ciscolinuxnetworkingscripting

I have a system with more than 50 different Linux machines (BLADE machines) with the following IP range

      165.23.1.21-165.23.1.64 ( each Linux machine have 4 eth - eth1,2,3,4)

The system connected to 4 Cisco switches via LANS cable

My target is to verify each eth in the Linux machine were this eth connected to which port in the switch

for example

./my_tool

   machine1 results


   linux_machine1_eth0  connected to switch_1_port_15
   linux_machine1_eth1  connected to switch_2_port_15
   linux_machine1_eth2  connected to switch_1_port_16
   linux_machine1_eth3  connected to switch_2_port_16


   machine2 results


   linux_machine2_eth0  connected to switch_1_port_22
   linux_machine2_eth1  connected to switch_4_port_7
   linux_machine2_eth2  connected to switch_1_port_23
   linux_machine2_eth3  connected to switch_4_port_8

   .
   .

My question which tool can help to identify which eth in the Linux machines connected to which port in the switch?

       remark -     1. the tool can be also script that runs on the Linux machines
                    2. we have access to the switch by telnet 

Best Answer

I think you will have to go to each switch and issue the command

show mac-address-table

and make a note of the information provided. Then go to each linux machine and do something like

echo $(hostname); ifconfig eth0 | grep HWaddr | awk '{print " "$1,$5}'

Now you have 2 lists to match up.

Related Topic