实验3:CDP命令操作

发布时间:2019-08-09 09:14:30编辑:auto阅读(1747)

     

     Cisco Discovery Protocol (CDP)从名字我们就可以看出这是Cisco专有的了,建议大家学习CCNA的时候尽量熟悉全拼 不要简单的记下缩写!

    CDP可以收集相邻的设备的硬件和协议信息
    CDP有两个全局参数 ,可以进行设置
    CDP timer(CDP定时器) 和 CDP holdtime(保持时间)
    CDP定时器是多长时间将CDP数据包传输到所有接口的时间量。
    CDP保持时间是设备保留从相邻设备接收到的数据包的时间量。

    下面介绍下CDP的几个命令和区别
    show cdp neighbors :作用是显示有关直连设备的信息,其中包括设备的主机名,接收数据包的端口或接口,保持时间,邻居设备的性能,设备类型和连接的端口ID
    show cdp neighbors detail 显示的就比较详细了
    和以上比较多了,直连设备的IP地址和IOS版本号。

    show cdp entry * 与 show cdp neighbors detail 相同。

    show cdp entry * protocols 显示直连邻居的IP地址。
    show cdp entry * version 显示直连邻居的IOS版本。
    show cdp traffic 显示了设备发送和接收的CDP数据包。
    show cdp interface 显示每个接口使用的CDP信息,包括线路的封装类型,定时器和保持时间。

    关闭CDP服务 no cdp run ,关闭某个接口的CDP 进入接口模式下 no cdp enable

    当大家看完以上的命令的时候,想象一下,给你一个路由器 然后需要你根据CDP的
    信息来配置IP和线缆的连接类型 以及设备类型 ,大家应该能做出来吧!下面我们来做以上实验

    Router>en
    Router#conf t
    Enter configuration commands, one per line.  End with CNTL/Z.
    Router(config)#host ccna1                                   设置路由器名
    ccna1(config)#enable password cisco1            设置password
    ccna1(config)#enable secret cisco2                   设置secret
    ccna1(config)#line vty 0 4
    ccna1(config-line)#login
    % Login disabled on line 66, until 'password' is set
    % Login disabled on line 67, until 'password' is set
    % Login disabled on line 68, until 'password' is set
    % Login disabled on line 69, until 'password' is set
    % Login disabled on line 70, until 'password' is set
    ccna1(config-line)#pass cisco3                            设置vty密码
    ccna1(config-line)#exit
    ccna1(config)#service password-encryption
    ccna1(config)#int s1/1/0
    ccna1(config-if)#ip add 202.119.249.1 255.255.255.0                    设置s0
    ccna1(config-if)#clock rate 56000
    ccna1(config-if)#no shut

    %LINK-5-CHANGED: Interface Serial1/1/0, changed state to down
    ccna1(config-if)#exit
    ccna1(config)#exit
    %SYS-5-CONFIG_I: Configured from console by console
    ccna1#

    ccna2配置

    Router>en
    Router#Conf t
    Enter configuration commands, one per line.  End with CNTL/Z.
    Router(config)#host ccna2
    ccna2(config)#enable password cisco1
    ccna2(config)#enable secret cisco2
    ccna2(config)#line vty 0 4
    ccna2(config-line)#login
    % Login disabled on line 66, until 'password' is set
    % Login disabled on line 67, until 'password' is set
    % Login disabled on line 68, until 'password' is set
    % Login disabled on line 69, until 'password' is set
    % Login disabled on line 70, until 'password' is set
    ccna2(config-line)#password cisco3
    ccna2(config-line)#exit
    ccna2(config)#service password-encryption
    ccna2(config)#int s1/1/0
    ccna2(config-if)#ip add 202.119.249.2 255.255.255.0
    ccna2(config-if)#no shut

    %LINK-5-CHANGED: Interface Serial1/1/0, changed state to up
    ccna2(config-if)#exit
    ccna2(config)#int s1/1/1
    ccna2(config-if)#ip add 202.119.248.1 255.255.255.0
    ccna2(config-if)#clock rate 56000
    ccna2(config-if)#no shut

    %LINK-5-CHANGED: Interface Serial1/1/1, changed state to down
    ccna2(config-if)#end
    %SYS-5-CONFIG_I: Configured from console by console

    ccna3配置

    Router>en
    Router#conf t
    Enter configuration commands, one per line.  End with CNTL/Z.
    Router(config)#host ccna3
    ccna3(config)#enable password cisco1
    ccna3(config)#enable secret cisco2
    ccna3(config)#line vty 0 4
    ccna3(config-line)#login
    % Login disabled on line 66, until 'password' is set
    % Login disabled on line 67, until 'password' is set
    % Login disabled on line 68, until 'password' is set
    % Login disabled on line 69, until 'password' is set
    % Login disabled on line 70, until 'password' is set
    ccna3(config-line)#pass cisco3
    ccna3(config-line)#exit
    ccna3(config)#service password-encryption
    ccna3(config)#int s1/1/0
    ccna3(config-if)#ip add 202.119.248.2 255.255.255.0
    ccna3(config-if)#no shut

    %LINK-5-CHANGED: Interface Serial1/1/0, changed state to up
    ccna3(config-if)#
    %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/1/0, changed state to upend
    %SYS-5-CONFIG_I: Configured from console by console
    ccna3#

    主要内容ccna2上操作:
    ccna2>en
    Password:
    ccna2#show cdp neighbors
    Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
                      S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone
    Device ID    Local Intrfce   Holdtme    Capability   Platform    Port ID
    ccna1        Ser 1/1/0        167            R       C2800       Ser 1/1/0
    ccna3        Ser 1/1/1        161            R       C2800       Ser 1/1/0
    ccna2#show cdp
    Global CDP information:
        Sending CDP packets every 60 seconds
        Sending a holdtime value of 180 seconds
        Sending CDPv2 advertisements is enabled

    ccna2#show cdp entry *

    Device ID: ccna1
    Entry address(es):
      IP address : 202.119.249.1
    Platform: cisco C2800, Capabilities: Router
    Interface: Serial1/1/0, Port ID (outgoing port): Serial1/1/0
    Holdtime: 158

    Version :
    Cisco IOS Software, 2800 Software (C2800NM-ADVIPSERVICESK9-M), Version 12.4(15)T1, RELEASE SOFTWARE (fc2)
    Technical Support:
    http://www.cisco.com/techsupport
    Copyright (c) 1986-2007 by Cisco Systems, Inc.
    Compiled Wed 18-Jul-07 06:21 by pt_rel_team

    advertisement version: 2
    Duplex: full
    ---------------------------

    Device ID: ccna3
    Entry address(es):
      IP address : 202.119.248.2
    Platform: cisco C2800, Capabilities: Router
    Interface: Serial1/1/1, Port ID (outgoing port): Serial1/1/0
    Holdtime: 152

    Version :
    Cisco IOS Software, 2800 Software (C2800NM-ADVIPSERVICESK9-M), Version 12.4(15)T1, RELEASE SOFTWARE (fc2)
    Technical Support:
    http://www.cisco.com/techsupport
    Copyright (c) 1986-2007 by Cisco Systems, Inc.
    Compiled Wed 18-Jul-07 06:21 by pt_rel_team

    advertisement version: 2
    Duplex: full

    ccna2#show cdp entry ccna1

    Device ID: ccna1
    Entry address(es):
      IP address : 202.119.249.1
    Platform: cisco C2800, Capabilities: Router
    Interface: Serial1/1/0, Port ID (outgoing port): Serial1/1/0
    Holdtime: 139

    Version :
    Cisco IOS Software, 2800 Software (C2800NM-ADVIPSERVICESK9-M), Version 12.4(15)T1, RELEASE SOFTWARE (fc2)
    Technical Support:
    http://www.cisco.com/techsupport
    Copyright (c) 1986-2007 by Cisco Systems, Inc.
    Compiled Wed 18-Jul-07 06:21 by pt_rel_team

    advertisement version: 2
    Duplex: full
    ---------------------------

    ccna2#show cdp entry ccna3

    Device ID: ccna3
    Entry address(es):
      IP address : 202.119.248.2
    Platform: cisco C2800, Capabilities: Router
    Interface: Serial1/1/1, Port ID (outgoing port): Serial1/1/0
    Holdtime: 129

    Version :
    Cisco IOS Software, 2800 Software (C2800NM-ADVIPSERVICESK9-M), Version 12.4(15)T1, RELEASE SOFTWARE (fc2)
    Technical Support:
    http://www.cisco.com/techsupport
    Copyright (c) 1986-2007 by Cisco Systems, Inc.
    Compiled Wed 18-Jul-07 06:21 by pt_rel_team

    advertisement version: 2
    Duplex: full
    ---------------------------

    ccna2#show cdp entry ccna2

    ccna2#un all
    All possible debugging has been turned off

    ccna2#conf t
    Enter configuration commands, one per line.  End with CNTL/Z.
    ccna2(config)#cdp run
    ccna2(config)#exit
    %SYS-5-CONFIG_I: Configured from console by console
    ccna2#show cdp interfac
    Vlan1 is administratively down, line protocol is down
      Sending CDP packets every 60 seconds
      Holdtime is 180 seconds
    FastEthernet0/0 is administratively down, line protocol is down
      Sending CDP packets every 60 seconds
      Holdtime is 180 seconds
    FastEthernet0/1 is administratively down, line protocol is down
      Sending CDP packets every 60 seconds
      Holdtime is 180 seconds
    Serial1/1/0 is up, line protocol is up
      Sending CDP packets every 60 seconds
      Holdtime is 180 seconds
    Serial1/1/1 is up, line protocol is up
      Sending CDP packets every 60 seconds
      Holdtime is 180 seconds
     
    ccna2#debug ?
      eigrp        EIGRP Protocol information
      frame-relay  Frame Relay
      ip           IP information

    搞定。。。。。

关键字

上一篇: python进程间同步

下一篇: 跟我学管理(3)