Tag: cisco

  • cisco 2960s常用命令

    查看运行中的配置

    show running-config

    设备的型号,运行时间,固件

    show version

    其中

    Processor board ID 或 System serial number 为设备出厂时候的序列号

    show version | in uptime
    uptime is 12 weeks, 3 days, 20 hours, 17 minutes

    查看mac地址表

    show mac address-table

    查看具体的mac地址

    show mac address-table address 0008.00ff.fc04

    设置交换机的vlan ip信息,在configure terminal模式下

    ip address 192.168.8.222 255.255.255.0
    ip default-gateway 192.168.8.1

    查看当前路由器的时间

    show clock

    查看日志信息

    show log

    查看接口的信息,很全,后面可以接具体的项

    show interfaces
    show interfaces description查看接口up or down
    show interfaces status 快速查看接口

    查看cdp邻居

    show cdp neighbors

    查看vlan信息

    show vlan

    设置时间

    clock set 16:51:00 20 Aug 2013

    查看学习到的arp表

    show ip arp

    过滤,类似于grep

    show arp | include 0010.d1aa.0224

    查看内存情况,可以看到内存有70MB

    show processes memory
    
    Processor Pool Total:   73922040 Used:   26257284 Free:   47664756
    
    I/O Pool Total:   14680064 Used:   12235212 Free:    2444852
    
    Driver te Pool Total:    1048576 Used:         40 Free:    1048536
    

    查看 cpu 使用情况

    show processes cpu sorted
    CPU utilization for five seconds: 9%/0%; one minute: 9%; five minutes: 9%

    输出过多时,可以不折叠

    terminal length 0

    清理单条arp信息

    clear arp 10.10.0.249
    #clear arp ?
     A.B.C.D IP address             # 清理单条记录
     counters Clear ARP counters         #重置计数器
     interface Clear the entire ARP cache on the interface  # 清空整个arp缓存
     vrf Clear entries for a VPN Routing/Forwarding instance

    配置Telnet密码的过程如下.copy自:http://network.51cto.com/art/201007/212927.htm

    第1步,进入全局配置模式.

    Cisco# configure terminal

    第2步,输入Telnet进程号,进入Line配置模式.在一台交换机和路由器上,最多可以实现16个Telnet进程,方便多个用户同时查看和管理.”0 15″表明配置所有可能的16个进程.

    Cisco(config)# line vty 0 15

    第3步,指定Telnet密码.Telnet密码设置要求与Enable相同.

    Cisco(config)# password password

    第4步,返回特权模式.

    Cisco(config)# end

    第5步,保存配置Telnet密码最后的修改.

    Cisco# copy running-config startup-config

    改主机名也在configure terminal里

    hostname yourhostname
  • C2960S交换机汇聚

    这里的汇聚要达到的目的:交换机之间可以扩展带宽,同时增强可用性。C2960S是二层交换机。实现汇聚的两个协议

    Link Aggregation Control Protocol (LACP) 和 Port Aggregation Protocol (PAgP)

    LACP是IEEE 802.3ad中规定的协议,所以具有通用性,所以linux又网卡绑定时,需要选择Mode 4 (802.3ad),这样交换机与服务器之间就能增加带宽。

    而PAgP是思科自己的汇聚协议,它适用于思科产品之间的连接。

    一句话,服务器与交换机,只能用LACP才有汇聚效果,而交换机与交换机既可以是LACP,也可以是PAgP,同时要注意,互相连接的端口之间协议要统一。不管是LACP还是PAgP,组成的新的虚拟通道在思科里叫做etherchannel。

    下面是将1/0/1与1/0/2汇聚,前提进入enable模式,

    配置LACP

    Switch#configure terminal
    Switch(config)#interface range gigabitEthernet 1/0/1 - 2
    Switch(config-if-range)#switchport mode trunk
    Switch(config-if-range)#channel-group 1 mode active
    Switch(config-if-range)#end

    配置PAgP

    Switch#configure terminal
    Switch(config)#interface range gigabitEthernet 1/0/1 - 2
    Switch(config-if-range)#switchport mode trunk
    Switch(config-if-range)#channel-group 1 mode desirable
    Switch(config-if-range)#end

    几个有用的查看命令

    show running-config查看当前配置信息

    interface GigabitEthernet1/0/1
     switchport mode trunk
     spanning-tree portfast
     channel-group 1 mode active
     !
     interface GigabitEthernet1/0/2
     switchport mode trunk
     spanning-tree portfast
     channel-group 1 mode active

    show ip interfaces brief 显示interfaces的状态

    Port-channel1          unassigned      YES unset  up               up

    show spanning-tree 查看生成树,如果汇聚成功会只显示

    Po1                 Desg FWD 3         128.224  P2p

    更改port-channel的负载均衡的方式为src-mac

    Switch#configure terminal
    Switch(config)#port-channel load-balance src-mac

    可选的方式有:

    dst-ip Dst IP Addr
    dst-mac Dst Mac Addr
    src-dst-ip Src XOR Dst IP Addr
    src-dst-mac Src XOR Dst Mac Addr
    src-ip Src IP Addr
    src-mac Src Mac Addr

    查看etherchannel负载均衡的方式:

    Switch#show etherchannel load-balance
    EtherChannel Load-Balancing Configuration:
    src-mac

    查看interfaces的trunk状态

    Switch#show interfaces trunk

    Port Mode Encapsulation Status Native vlan
     Po1 on 802.1q trunking 1
     Po3 on 802.1q trunking 1
     Po4 on 802.1q trunking 1
    Port Vlans allowed on trunk
     Po1 1-4094
     Po3 1-4094
     Po4 1-4094
    Port Vlans allowed and active in management domain
     Po1 1
     Po3 1
     Po4 1
    Port Vlans in spanning tree forwarding state and not pruned
     Po1 1
     Po3 1
     Po4 1

    查看ether channel状态

    Switch#show etherchannel summary
    
    Flags: D - down P - bundled in port-channel
    I - stand-alone s - suspended
    H - Hot-standby (LACP only)
    R - Layer3 S - Layer2
    U - in use f - failed to allocate aggregator
    
    M - not in use, minimum links not met
    u - unsuitable for bundling
    w - waiting to be aggregated
    d - default port
    Number of channel-groups in use: 4
    Number of aggregators: 4
    
    Group Port-channel Protocol Ports
    ------+-------------+-----------+--------------------------------------------
    1 Po1(SU) PAgP Gi1/0/1(P) Gi1/0/2(P)
    2 Po2(SD) LACP Gi1/0/3(D) Gi1/0/4(D)
    3 Po3(SU) LACP Gi1/0/5(P) Gi1/0/6(P)
    4 Po4(SD) LACP Gi1/0/7(D) Gi1/0/8(D)

    可以看到正在运行的是第一个PAgP,第3LACP

    参考:

    http://www.cisco.com/en/US/docs/switches/lan/catalyst2960/software/release/12.2_55_se/configuration/guide/swethchl.html#wpxref12539

    服务器 bond0  mode0 交换机做 etherchannel 使交换机 show logging 没有 flapping.

    在 configure terminal 下,做好 port-channel

    switch(config)#interface port-channel 2
    switch(config-if)#switchport mode access
    switch(config-if)#switchport access vlan 6

    将 gi 口加入到 port-channel,这里用的 mode 是 on

    switch(config-if)#int range gi 1/0/10 - 13
    switch(config-if-range)#channel-group 2 mode on

    默认是 no shutdown ,这样以后会有几十秒的中断,然后查看 etherchannel

    2 Po2(SU) - Gi1/0/10(P) Gi1/0/11(P) Gi1/0/12(P)
     Gi1/0/13(P)