Displaying CDP info via tcpdump or snoop

Cisco Discovery Protocol is a management protocol that Cisco uses to communicate a great deal of information about a network connection. The protocol tells you which switch and and port you are connected to. And if you are trying to debug connectivity issues, such as a system being connected to the wrong VLAN, or with the wrong duplex, this can help. If you are connected at the wrong speed, your system typically will not give you a valid link status, so a bad speed settings will probably prevent you from getting any data from the interface. There are CDP analysis programs for Windows that Network people can use to display CDP packets for a port, however, this generally requires someone to hook the PC up to the port in question.

In AIX 5.3, the tcpdump program an format CDP packets for you. It is as simple as specifiying verbose output and telling the system which packets to display. If you are using Solaris, you can use snoop to find the CDP packets, but it does not format the data nicely. I have a script, cdpinfo that will format grab the data using either tcpdump or snoop, and format select information from the packet.

Command:
# tcpdump -nn -vvv -i en0 -s 1500 -c 1 'ether[20:2] == 0x2000' Options explained.
-nn don't do dns or port number lookups -vvv very verbose output -i en0 specifies the interface to use -s 1500 capture 1500 bytes of the packet (typical MTU size) -c 1 capture one packet and exit 'ether[20:2] == 0x2000' capture only packets that have a 2 byte value of hex 2000 starting at
byte 20. Output:
tcpdump: listening on en0, link-type 1, capture size 1500 bytes
10:41:55.398940 snap 0:0:c:20:0 CDP v2, ttl: 180s, checksum: 692 (unverified)
Device-ID (0x01), length: 25 bytes: 'MYSWITCH01.net.somecompany.com' # hostname
Version String (0x05), length: 293 bytes:
Cisco Internetwork Operating System Software
IOS (tm) s72033_rp Software (s72033_rp-ADVENTERPRISEK9_WAN-M), Version 12.2(18)SXF4, RELEASE SOFTWARE (fc1) # ios version
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2006 by cisco Systems, Inc.
Compiled Thu 23-Mar-06 19:38 by tinhuang
Platform (0x06), length: 14 bytes: 'cisco WS-C6513' # switch model
Address (0x02), length: 13 bytes: IPv4 (1) 192.168.0.50 # switch ip
Port-ID (0x03), length: 20 bytes: 'GigabitEthernet13/26' # connection port
Capability (0x04), length: 4 bytes: (0x00000029): Router, L2 Switch, IGMP snooping
VTP Management Domain (0x09), length: 7 bytes: 'mwv-vtp'
Native VLAN ID (0x0a), length: 2 bytes: 2033 # vlan ID
Duplex (0x0b), length: 1 byte: full
AVVID trust bitmap (0x12), length: 1 byte: 0x00
AVVID untrusted ports CoS (0x13), length: 1 byte: 0x00
18 packets received by filter
0 packets dropped by kernel

LLDP (link layer discovery protocol)

The standard based version of CDP is LLDP (link layer discovery protocol). Some vendors will have this on by default and others off, so your mileage will vary. There are some LLDP implementations for Linux, but if you want something similar to the above you can use this (set up LLDP on a Cisco switch and tested the below, which is more consistent with above):

# tcpdump -nn -v -i em1 -s 1500 -c 1 'ether proto 0x88cc'
# tcpdump -i eth0 arp

force10 开启lldp

force10(conf)# protocol lldp

force10(conf-lldp)# no disable

force10# show lldp statistics

--------- LLDP GLOBAL STATISTICS ON CHASSIS ------------

Total number of neighbors: 0

Last table change time: 4w5d18h, In ticks: 145901708

Total number of Table Inserts: 0

Total number of Table Deletes: 0

Total number of Table Drops: 0

Total number of Table Age Outs: 0

tcpdump确认服务器连接的交换机信息的更多相关文章

  1. zookeeper客户端 和服务器连接时版本问题

    在使用kafka 和zookeeper 实现实时分析程序时,由于zookeeper部署版本和分析程序导入jar包的版本不一致,导致了当实时分析程序从远程服务器连接kafka集群的zookeeper时报 ...

  2. mqtt网关服务器连接阿里云关联物模型

    mqtt网关服务器连接阿里云关联物模型 卓岚专门为工业环境设计的RS485设备数据采集器/物联网网关,兼具串口服务器.Modbus网关.MQTT网关.RS485转JSON等多种功能于一体. 可以连接阿 ...

  3. 解决服务器连接错误Host ‘XXX’ is not allowed to connect to this MySQL server

    这段时间在研究火车头的入库教程,在“配置登陆信息和数据库(mysql)”连接中,出现“服务器连接错误Host 'XXX' is not allowed to connect to this MySQL ...

  4. sql server 使用链接服务器连接Oracle,openquery查询数据

      对接问题描述:不知道正式库oracle数据库账户密码,对方愿意在对方的客户端上输入账号和密码,但不告诉我们 解决方案:使用一台sql server作为中间服务器,可以通过转存数据到sql serv ...

  5. Windows服务器学习篇:服务器连接与退出

    此文是我早期在公司内部发布的一篇给予新入职程序员基础技术培训的文章,非常基础简单,现拿出来给大家分享.当然,已工作人士可直接忽略... 一.Windows服务器连接 1. 在桌面菜单中的“运行”里,输 ...

  6. 在虚拟机中连接oracle数据库报错ORA-12154,其他服务器连接无问题

    在一台服务器上使用sqlplus登录oracle数据库,cmd->sqlplus->name/passwd@orcl2登录某个数据库用户,提示ORA-12154.使用当前服务器的PLSQL ...

  7. 问题:sqlserver 跨服务器连接;结果:Sql Server 跨服务器连接

    Sql Server 跨服务器连接 用openrowset连接远程SQL或插入数据 --如果只是临时访问,可以直接用openrowset --查询示例 select * from openrowset ...

  8. c#通过socket判断服务器连接是否正常

    判断Socket是否连接上,需要通过发包来确认. 之前确认都是调用调用socket的connected属性,然而该属性是上次的连接是否成功的结果,不及时. // 检查一个Socket是否可连接 pri ...

  9. 【PostgreSQL】PostgreSQL添加新服务器连接时,报错“Server doesn't listen ”,已解决。

    PostgreSQL添加新的服务器连接时,报错:

随机推荐

  1. php curl 请求api 接口

    官方文档curl : http://www.runoob.com/php/php-ref-curl.html php开启curl :  ① 打开 php.ini 文件  extension=php_c ...

  2. POJ3041轰炸行星(匈牙利算法 最小覆盖点集)

    Asteroids Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 25232   Accepted: 13625 Descr ...

  3. css属性 盒子模型

    一.    css属性相关 1.宽和高    1.width可以为元素设置宽度 2. height可以为元素设置高度 3.只有块级标签才可以设置宽度和高度,内联标签并不能设置宽度和高度,及时设置了也不 ...

  4. Dev Express Report 学习总结(三)关于子报表Sub-Report的使用

    子报表即在一个Report(主报表)中嵌入另一个Report(子报表),从理论上来讲,任何一个Report都可以作为一个子报表,但在实际使用过程中,只有主报表和子报表构成一对多关系时才会使用子报表.使 ...

  5. Django-3 视图层

    5.1 视图函数 一个视图函数,简称视图,是一个简单的Python 函数,它接受Web请求并且返回Web响应.响应可以是一张网页的HTML内容,一个重定向,一个404错误,一个XML文档,或者一张图片 ...

  6. suffix ACM-ICPC 2017 Asia Qingdao

    Consider n given non-empty strings denoted by s1 , s2 , · · · , sn . Now for each of them, you need ...

  7. #1413 : Rikka with String 后缀自动机 + 二级差分

    http://hihocoder.com/problemset/problem/1413?sid=1199641 这题断断续续做了2个多星期吧,一直不会 设总答案为sum,替换后新加的子串数量为x,失 ...

  8. SETI ACdream - 1430 后缀自动机求不相交子串

    http://blog.csdn.net/gatevin/article/details/45875343 题目是求不重叠的不同子串个数 一般来说, endpos集合包含了子串结尾位置,结尾在&quo ...

  9. Java基础01-JVM内存分析

    JVM java虚拟机 java编译后的class文件就是在java虚拟机上运行的 1.栈区(stacksegment)存放函数的参数值,局部变量的值等,在超过这个变量的作用域时就会被系统自动释放掉存 ...

  10. 安卓多个RecyclerView滑动与显示问题

    最近在项目遇到这样的问题:在一线性垂直布局内,有两个垂直的RecyclerView,如果直接高度直接设置wrap-content, 通常会导致滑动冲突或是内容显示不全. 首先说下解决的思路,就是在最外 ...