$ sudo apt-get install cdpr
$ sudo cdpr [sudo] password for neo: cdpr - Cisco Discovery Protocol Reporter Version 2.4 Copyright (c) 2002-2010 - MonkeyMental.com 1. eth0 (No description available) 2. tun0 (No description available) 3. usbmon1 (USB bus number 1) 4. usbmon2 (USB bus number 2) 5. usbmon3 (USB bus number 3) 6. usbmon4 (USB bus number 4) 7. usbmon5 (USB bus number 5) 8. lo (No description available) Enter the interface number (1-8):1 Using Device: eth0 Waiting for CDP advertisement: (default config is to transmit CDP packets every 60 seconds) Device ID value: 4A3750G Addresses value: 193.168.0.254 Port ID value: GigabitEthernet1/0/15
通過cdprs.php收集CDP數據,很容易改寫,實現寫入資料庫
/usr/share/doc/cdpr/examples/
$ find /usr/share/doc/cdpr/examples/ /usr/share/doc/cdpr/examples/ /usr/share/doc/cdpr/examples/cdprs /usr/share/doc/cdpr/examples/cdprs/cdprs.cgi.gz /usr/share/doc/cdpr/examples/cdprs/cdprs.php /usr/share/doc/cdpr/examples/cdpr.conf
這個功能可以實現後自動繪製網絡拓撲,分析收集的數據,然後通過Graphviz繪製網絡拓撲圖。