首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >linux +哪个工具可以帮助识别连接到cisco交换机中哪个端口的Linux机器中的哪个eth

linux +哪个工具可以帮助识别连接到cisco交换机中哪个端口的Linux机器中的哪个eth
EN

Server Fault用户
提问于 2011-08-21 13:04:13
回答 3查看 2.9K关注 0票数 2

我有一个拥有50多台不同Linux机器(刀片机)的系统,其IP范围如下

代码语言:javascript
复制
      165.23.1.21-165.23.1.64 ( each Linux machine have 4 eth - eth1,2,3,4)

通过LANS电缆连接到4个Cisco交换机的系统

我的目标是验证Linux机器中的每个eth是否连接到交换机中的哪个端口。

例如

./我的工具

代码语言:javascript
复制
   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

   .
   .

我的问题是,哪个工具可以帮助识别Linux机器中的哪个eth连接到交换机中的哪个端口?

代码语言:javascript
复制
       remark -     1. the tool can be also script that runs on the Linux machines
                    2. we have access to the switch by telnet 
EN

回答 3

Server Fault用户

发布于 2011-08-21 13:42:19

您可以使用Net::Telnet::CiscoNet::OpenSSH来自动编写perl脚本。如果我今天有时间的话,我会在这里提供一个。

更新

正如提问者在评论中询问的那样:如果您想通过SNMP获取信息,cisco库中有一个非常优秀的文档:http://www.cisco.com/en/US/tech/tk648/tk362/technologies_高科技_note09186a00801c9199.shtml

简而言之:您需要合并五个snmpwalks的输出(其中crumpy是您的开关名)

代码语言:javascript
复制
snmpwalk -c public crumpy .1.3.6.1.4.1.9.9.46.1.3.1.1.2 # get vlan states
snmpwalk -c public@1 crumpy .1.3.6.1.2.1.17.4.3.1.1     # get mac table
snmpwalk -c public@1 crumpy .1.3.6.1.2.1.17.4.3.1.2     # get the switchport numbers for the vlans (here Vlan1)
snmpwalk -c public@1 crumpy .1.3.6.1.2.1.17.1.4.1.2     # switchport to if number
snmpwalk -c public@1 crumpy .1.3.6.1.2.1.31.1.1.1.1     # get the interface names

来自“文件”:

代码语言:javascript
复制
6. Link a MAC address to the port on which the address was learned.

* From Step 1, the MAC address is:
      17.4.3.1.1.0.0.12.7.172.8 = Hex: 00 00 0C 07 AC 08

*  From Step 2, the bridge port tells that the MAC address belongs to bridge port number 13:
      17.4.3.1.2.0.0.12.7.172.8 = 13 

*  From Step 3, the bridge port number 13 has ifIndex number 2:
      17.1.4.1.2.13 = 2

*  From Step 4, the ifIndex 2 corresponds to port Fast Ethernet 0/1:
      ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifName.2 = Fa0/1
票数 2
EN

Server Fault用户

发布于 2011-08-21 14:03:13

如果在交换机上启用了CDP,则可以尝试使用cdpr。这是一个简单的程序,您可以在服务器上运行并收听CDP公告。

代码语言:javascript
复制
petrus@seth:~$ sudo cdpr
cdpr - Cisco Discovery Protocol Reporter
Version 2.2.1
Copyright (c) 2002-2006 - MonkeyMental.com

1. eth0 (No description available)
2. wlan0 (No description available)
3. virbr0 (No description available)
<snip>
12. lo (No description available)
Enter the interface number (1-12):1
Using Device: eth0
Waiting for CDP advertisement:
(default config is to transmit CDP packets every 60 seconds)

Device ID
  value:  switch01           
Addresses
  value:  192.168.12.15 
Port ID
  value:  0/15

cdpr还可以使用GET请求将详细信息上载到web服务器。

票数 2
EN

Server Fault用户

发布于 2011-08-21 13:46:06

OpenNMS通过其Linkd特征很好地实现了这一点,通过SNMP、CDP和路由信息自动发现节点之间的链接。它还允许您创建拓扑图

开关的链接页面如下所示:

虽然节点的链接页面如下所示:

除此之外,您还需要在交换机上使用某种版本的show mac address例程。

票数 1
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/303504

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档