Cisco部分常用命令

技术分享 Story 118浏览 0评论
摘要

Cisco部分常用命令

减少console的输出,输出后自动换行:
Router#
Router#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#line console 0
Router(config-line)#logging synchronous

设置控制台超时退出时间:
Router#
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#line con 0
Router(config-line)#exec-timeout ?
  <0-35791>  Timeout in minutes
Router(config-line)#exec-timeout 0 ?
  <0-2147483>  Timeout in seconds
  <cr>
Router(config-line)#exec-timeout 0 0

关闭域名自动解析:
Router(config)#no ip domain lookup

更改路由器名字:
Router(config)#hostname R1
R1(config)#

进入控制台要求输入密码:
R1(config)#line con 0
R1(config-line)#login
% Login disabled on line 0, until 'password' is set
R1(config-line)#password ciscoc(只有先设置了密码才能开启控制台登录验证功能)
R1(config-line)#login

设置vty登录密码:
R1(config)#line vty 0 4
R1(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
R1(config-line)#password ciscov(只有先设置了密码才能开启vty登录验证功能)
R1(config-line)#login(如果没有设置密码,则默认不接受telnet登录,除非使用no login)

将所有明文密码加密:
R1(config)#service pas
R1(config)#service password-encryption

 

显示设备的直连邻居:
SW2#show cdp neighbors
Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
                  S - Switch, H - Host, I - IGMP, r - Repeater

Device ID        Local Intrfce        Holdtme    Capability  Platform    Port ID
SW1              Fas 1/1            120        R S I      3640      Fas 1/2
SW1              Fas 1/2            120        R S I      3640      Fas 1/1
SW3              Fas 1/3            169        R S I      3640      Fas 1/2
R2                Fas 1/5            174        R S I      2691      Fas 0/0
SW2#(前提是连接邻居设备的端口必须都是no shut状态)

显示设备的直连邻居的详细信息:
SW2#show cdp neighbors detail (等同于show cdp entry *)
-------------------------
Device ID: SW1
Entry address(es):
Platform: Cisco 3640,  Capabilities: Router Switch IGMP
Interface: FastEthernet1/1,  Port ID (outgoing port): FastEthernet1/2
Holdtime : 136 sec

Version :
Cisco IOS Software, 3600 Software (C3640-JS-M), Version 12.4(10), RELEASE SOFTWARE (fc1)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2006 by Cisco Systems, Inc.
Compiled Wed 16-Aug-06 04:04 by prod_rel_team

advertisement version: 2
VTP Management Domain: ''
Duplex: full

-------------------------
Device ID: SW1
Entry address(es):
Platform: Cisco 3640,  Capabilities: Router Switch IGMP
Interface: FastEthernet1/2,  Port ID (outgoing port): FastEthernet1/1
Holdtime : 136 sec
……略
-------------------------
Device ID: SW3
Entry address(es):
Platform: Cisco 3640,  Capabilities: Router Switch IGMP
Interface: FastEthernet1/3,  Port ID (outgoing port): FastEthernet1/2
Holdtime : 124 sec
……略
-------------------------
Device ID: R2
Entry address(es):
Platform: Cisco 2691,  Capabilities: Router Switch IGMP
Interface: FastEthernet1/5,  Port ID (outgoing port): FastEthernet0/0
Holdtime : 128 sec
……略

查看cdp包的发送时间间隔和老化时间:
SW1#show cdp
Global CDP information:
Sending CDP packets every 60 seconds
Sending a holdtime value of 180 seconds
Sending CDPv2 advertisements is  enabled

关闭/打开接口的cdp发送(接收不关)功能:
R2(config)#intface fastEthernet 0/0
R2(config-if)#cdp enable
R2(config-if)#no cdp enable
关闭后在SW2上查看邻居表:
SW2#show cdp neighbors
Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
                  S - Switch, H - Host, I - IGMP, r - Repeater
Device ID        Local Intrfce     Holdtme    Capability  Platform  Port ID
SW1              Fas 1/1            151        R S I      3640      Fas 1/2
SW1              Fas 1/2            151        R S I      3640      Fas 1/1
SW3              Fas 1/3            136        R S I      3640      Fas 1/2
R2               Fas 1/5             81         R S I      2691      Fas 0/0

Device ID        Local Intrfce     Holdtme    Capability  Platform  Port ID
SW1              Fas 1/1            148        R S I      3640      Fas 1/2
SW1              Fas 1/2            148        R S I      3640      Fas 1/1
SW3              Fas 1/3            134        R S I      3640      Fas 1/2
R2               Fas 1/5             65         R S I      2691      Fas 0/0
图中81会随着时间的变化而减小,归0后R2路由器纪录在邻居表中消失

更改CDP发送和老化的间隔秒数:
R2(config)#cdp timer ?
  <5-254>  Rate at which CDP packets are sent (in  sec)
R2(config)#cdp holdtime ? 
  <10-255>  Length  of time  (in sec) that receiver must keep this packet

查看CDP的发送和接受状态:
SW2#show cdp traffic
CDP counters :
        Total packets output: 155, Input: 95
        Hdr syntax: 0, Chksum error: 0, Encaps failed: 0
        No memory: 0, Invalid packet: 0, Fragmented: 0
        CDP version 1 advertisements output: 0, Input: 0
        CDP version 2 advertisements output: 155, Input: 95

 

 

显示启用CDP的接口(没启用的不显示):
R2#show cdp interface (se/fa 0/0)
FastEthernet0/1 is administratively down, line protocol is down
  Encapsulation ARPA
  Sending CDP packets every 60 seconds
  Holdtime is 180 seconds
Serial1/0 is up, line protocol is up
  Encapsulation HDLC
  Sending CDP packets every 60 seconds
  Holdtime is 180 seconds

查看所有接口IP信息:
R2#show ip interface  (se/fa 0/0)
FastEthernet0/0 is up, line protocol is up (FastEthernet0/0 is administratively down, line protocol is down)
  Internet address is 192.168.1.1/24
  Broadcast address is 255.255.255.255
  Address determined by setup command
  MTU is 1500 bytes
  Helper address is not set
  Directed broadcast forwarding is disabled
  Outgoing access list is not set
  Inbound  access list is not set
  Proxy ARP is enabled
  Local Proxy ARP is disabled
  Security level is default
  Split horizon is enabled
  ICMP redirects are always sent
  ICMP unreachables are always sent
  ICMP mask replies are never sent
  IP fast switching is enabled
  IP fast switching on the same interface is disabled
  IP Flow switching is disabled
  IP CEF switching is enabled
  IP CEF Fast switching turbo vector
  IP multicast fast switching is enabled
  IP multicast distributed fast switching is disabled
  IP route-cache flags are Fast, CEF
  Router Discovery is disabled
  IP output packet accounting is disabled
  IP access violation accounting is disabled
  TCP/IP header compression is disabled
  RTP/IP header compression is disabled
  Policy routing is disabled
  Network address translation is disabled
  BGP Policy Mapping is disabled
  WCCP Redirect outbound is disabled
  WCCP Redirect inbound is disabled
  WCCP Redirect exclude is disabled
FastEthernet0/1 is administratively down, line protocol is down
  Internet protocol processing disabled (如果接口没有配置IP,则显示左边的信息)
查看所有接口的状态、IP等简单信息:
R2#show ip interface brief
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            192.168.1.1     YES manual up                    up     
FastEthernet0/1            unassigned      YES unset  administratively down down   
Serial1/0                  unassigned      YES unset  up                    up     
Serial1/1                  unassigned      YES unset  administratively down down   
Serial1/2                  unassigned      YES unset  administratively down down   

查看接口的类型:
R2#show controllers se 1/0
M4T: show controller:
PAS unit 0, subunit 0, f/w version 1-45, rev ID 0x2800001, version 1
idb = 0x63B6EB94, ds = 0x63B6FC5C, ssb=0x63B70018
Clock mux=0x0, ucmd_ctrl=0x1C, port_status=0x7B
Serial config=0x8, line config=0x200
maxdgram=1608, bufpool=78Kb, 120 particles
     DCD=up  DSR=up  DTR=up  RTS=up  CTS=up
line state: up
cable type : V.11 (X.21) DCE cable, received clockrate 2015232
……略

在接口下设置时钟和带宽:
R2(config-if)#clock rate 64000
R2(config-if)#bandwidth 64

 

 生成树实验:
显示根桥:
SW1#show spanning-tree root
VLAN1           
  Root ID    Priority    32768
             Address     cc02.0bf8.0000
             This bridge is the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
SW2#show spanning-tree root
VLAN1           
  Root ID    Priority    32768
             Address     cc02.0bf8.0000
             Cost        19
             Port        43 (FastEthernet1/2)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

显示交换机端口的状态(冻结或转发):
SW1#show spanning-tree brief
VLAN1
  Spanning tree enabled protocol ieee
  Root ID    Priority    32768
             Address     cc02.0bf8.0000
             This bridge is the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
  Bridge ID  Priority    32768
             Address     cc02.0bf8.0000
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300
Interface                                   Designated
Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/1      128.42   128    19 FWD     0 32768 cc02.0bf8.0000 128.42
FastEthernet1/2      128.43   128    19 FWD     0 32768 cc02.0bf8.0000 128.43
FastEthernet1/3      128.44   128    19 FWD     0 32768 cc02.0bf8.0000 128.44
FastEthernet1/5      128.46   128    19 FWD     0 32768 cc02.0bf8.0000 128.46
FastEthernet1/11     128.52   128    19 FWD     0 32768 cc02.0bf8.0000 128.52
FastEthernet1/12     128.53   128    19 FWD     0 32768 cc02.0bf8.0000 128.53

SW3#show spanning-tree brief
VLAN1
  Spanning tree enabled protocol ieee
  Root ID    Priority    32768
             Address     cc02.0bf8.0000
             Cost        19
             Port        42 (FastEthernet1/1)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
  Bridge ID  Priority    32768
             Address     cc04.0bf8.0000
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300
Interface                                   Designated
Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/1      128.42   128    19 FWD     0 32768 cc02.0bf8.0000 128.44
FastEthernet1/2      128.43   128    19 BLK    19 32768 cc03.0bf8.0000 128.44
FastEthernet1/11     128.52   128    19 FWD    19 32768 cc04.0bf8.0000 128.52
FastEthernet1/12     128.53   128    19 FWD    19 32768 cc04.0bf8.0000 128.53
SW1#show spanning-tree active/(vlan 1) (show spanning-tree interface se/fa 0/0显示单个接口的生成树信息)
 VLAN1 is executing the ieee compatible Spanning Tree protocol
  Bridge Identifier has priority 32768, address cc02.0bf8.0000
  Configured hello time 2, max age 20, forward delay 15
  We are the root of the spanning tree
  Topology change flag not set, detected flag not set
  Number of topology changes 2 last change occurred 00:46:30 ago
          from FastEthernet1/1
  Times:  hold 1, topology change 35, notification 2
          hello 2, max age 20, forward delay 15
  Timers: hello 0, topology change 0, notification 0, aging 300

 Port 42 (FastEthernet1/1) of VLAN1 is forwarding
   Port path cost 19, Port priority 128, Port Identifier 128.42.
   Designated root has priority 32768, address cc02.0bf8.0000
   Designated bridge has priority 32768, address cc02.0bf8.0000
   Designated port id is 128.42, designated path cost 0
   Timers: message age 0, forward delay 0, hold 0
   Number of transitions to forwarding state: 1
   BPDU: sent 1437, received 2

 Port 43 (FastEthernet1/2) of VLAN1 is forwarding
   Port path cost 19, Port priority 128, Port Identifier 128.43.
   Designated root has priority 32768, address cc02.0bf8.0000
   Designated bridge has priority 32768, address cc02.0bf8.0000
   Designated port id is 128.43, designated path cost 0
   Timers: message age 0, forward delay 0, hold 0
   Number of transitions to forwarding state: 1
   BPDU: sent 1437, received 1
SW2#show spanning-tree active
 VLAN1 is executing the ieee compatible Spanning Tree protocol
  Bridge Identifier has priority 32768, address cc03.0bf8.0000
  Configured hello time 2, max age 20, forward delay 15
  Current root has priority 32768, address cc02.0bf8.0000
  Root port is 43 (FastEthernet1/2), cost of root path is 19
  Topology change flag not set, detected flag not set
  Number of topology changes 2 last change occurred 00:46:58 ago
          from FastEthernet1/5
  Times:  hold 1, topology change 35, notification 2
          hello 2, max age 20, forward delay 15
  Timers: hello 0, topology change 0, notification 0, aging 300
 Port 42 (FastEthernet1/1) of VLAN1 is blocking
   Port path cost 19, Port priority 128, Port Identifier 128.42.
   Designated root has priority 32768, address cc02.0bf8.0000
   Designated bridge has priority 32768, address cc02.0bf8.0000
   Designated port id is 128.43, designated path cost 0
   Timers: message age 2, forward delay 0, hold 0
   Number of transitions to forwarding state: 0
   BPDU: sent 1, received 1412

 Port 43 (FastEthernet1/2) of VLAN1 is forwarding
   ……略

修改交换机优先级:
SW2(config)#spanning-tree vlan 1 priority ?
  <0-65535>  bridge priority
SW2(config)#spanning-tree vlan 1 priority 32767
SW2#show spanning-tree bri
VLAN1
  Spanning tree enabled protocol ieee
  Root ID    Priority    32767
             Address     cc03.0bf8.0000
             This bridge is the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
  Bridge ID  Priority    32767
             Address     cc03.0bf8.0000
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300
Interface                                   Designated
Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/1      128.42   128    19 LIS     0 32767 cc03.0bf8.0000 128.42
FastEthernet1/2      128.43   128    19 FWD     0 32767 cc03.0bf8.0000 128.43
FastEthernet1/3      128.44   128    19 FWD     0 32767 cc03.0bf8.0000 128.44
FastEthernet1/5      128.46   128    19 FWD     0 32767 cc03.0bf8.0000 128.46
FastEthernet1/11     128.52   128    19 FWD     0 32767 cc03.0bf8.0000 128.52

Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/1      128.42   128    19 LRN     0 32767 cc03.0bf8.0000 128.42
FastEthernet1/2      128.43   128    19 FWD     0 32767 cc03.0bf8.0000 128.43
FastEthernet1/3      128.44   128    19 FWD     0 32767 cc03.0bf8.0000 128.44
FastEthernet1/5      128.46   128    19 FWD     0 32767 cc03.0bf8.0000 128.46
FastEthernet1/11     128.52   128    19 FWD     0 32767 cc03.0bf8.0000 128.52

Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/1      128.42   128    19 FWD     0 32767 cc03.0bf8.0000 128.42
FastEthernet1/2      128.43   128    19 FWD     0 32767 cc03.0bf8.0000 128.43
FastEthernet1/3      128.44   128    19 FWD     0 32767 cc03.0bf8.0000 128.44
FastEthernet1/5      128.46   128    19 FWD     0 32767 cc03.0bf8.0000 128.46
FastEthernet1/11     128.52   128    19 FWD     0 32767 cc03.0bf8.0000 128.52

SW1#show spanning-tree bri (SW1上,fa1/1立即变为BLK状态,即从F-B为立即,从B-F要经过LIS-LRN-FWD)
VLAN1
  Spanning tree enabled protocol ieee
  Root ID    Priority    32767
             Address     cc03.0bf8.0000
             Cost        19
             Port        43 (FastEthernet1/2)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
  Bridge ID  Priority    32768
             Address     cc02.0bf8.0000
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300
Interface                                   Designated
Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet1/1      128.42   128    19 BLK     0 32767 cc03.0bf8.0000 128.43
FastEthernet1/2      128.43   128    19 FWD     0 32767 cc03.0bf8.0000 128.42
FastEthernet1/3      128.44   128    19 FWD    19 32768 cc02.0bf8.0000 128.44
FastEthernet1/5      128.46   128    19 FWD    19 32768 cc02.0bf8.0000 128.46
FastEthernet1/11     128.52   128    19 FWD    19 32768 cc02.0bf8.0000 128.52
FastEthernet1/12     128.53   128    19 FWD    19 32768 cc02.0bf8.0000 128.53

手动更改某台交换机为根交换机:
SW3(config)#spanning-tree vlan 1 root primary
 VLAN 1 bridge priority set to 8192
 VLAN 1 bridge max aging time unchanged at 20
 VLAN 1 bridge hello time unchanged at 2
 VLAN 1 bridge forward delay unchanged at 15
SW3上的fa1/1口经过LIS-LRN进入FWD状态
SW1(32768)由于优先级高于SW2(32767),故SW1上的fa1/1,fa1/2被BLK

将SW2优先级改回32868:
SW2(config)#spanning-tree vlan 1 priority 32876
经过一段时间后SW2上的fa1/1,fa1/2被BLK,SW1 fa1/1,fa1/2从LIS-LRN进入FWD状态

再次将SW2手动指定为根桥:
SW2(config)#spanning-tree vlan 1 root primary
 VLAN 1 bridge priority set to 8192
 VLAN 1 bridge max aging time unchanged at 20
 VLAN 1 bridge hello time unchanged at 2
 VLAN 1 bridge forward delay unchanged at 15
SW3(8192)由于优先级高于SW1(32868),故SW1上的fa1/1。fa1/3被BLK,SW2 fa1/1,fa1/2从LIS-LRN进入FWD状态,因为SW2和SW3优先级一样,但是SW2 MAC地址比SW3低

又再次将SW3手动指定为根桥:
SW3(config)#spanning-tree vlan 1 root primary
 VLAN 1 bridge priority set to 8191
 VLAN 1 bridge max aging time unchanged at 20
 VLAN 1 bridge hello time unchanged at 2
 VLAN 1 bridge forward delay unchanged at 15
可以看出SW3的优先级被提高到了8191,变为根桥,SW2端口状态保持不变,SW1的fa1/1保持BLK状态,fa1/2立即变为BLK状态,fa1/3从LIS-LRN进入FWD状态

 

进入Vlan配置模式:
SW1#vlan database
SW1(vlan)#?
VLAN database editing buffer manipulation commands:
  abort  Exit mode without applying the changes
  apply  Apply current changes and bump revision number
  exit   Apply changes, bump revision number, and exit mode
  no     Negate a command or set its defaults
  reset  Abandon current changes and reread current database
  show   Show database information
  vlan   Add, delete, or modify values associated with a single VLAN
  vtp    Perform VTP administrative functions.

配置Vlan Vtp domain名称:
SW1(vlan)#vtp domain ciscoIT

将Vtp模式设置为服务器或客户端模式:
SW2(vlan)#vtp server
SW2(vlan)#vtp client

建立新的Vlan:
SW1(vlan)#vlan 10
VLAN 10 added:
    Name: VLAN0010
SW1(vlan)#exit
APPLY completed.
Exiting....
SW1#

将接口模式设置为trunk模式:
SW1(config-if)#switchport mode trunk

将接口模式设置为access模式:
SW1(config-if)#switchport mode access

 

 NAT:
 
R1:
int fa0/0
ip address 192.168.1.1 255.255.255.0
no shut
exit
int fa0/1
ip address 10.1.1.1 255.255.255.0
no shut
exit
router ospf 100
network 10.1.1.1 0.0.0.0 area 0
exit
ip route 192.168.3.0 255.255.255.0 fa0/0
int fa0/0
ip nat inside
exit
int fa0/1
ip nat outside
exit
1.静态NAT
ip nat inside source static 192.168.1.2 10.1.1.3
2.多点NAT
access-list 1 permit 192.168.0.0 0.0.255.255
ip nat inside source list 1 interface fastEthernet 0/1 overload
3.多点到多点NAT
access-list 2 permit 192.168.1.0 0.0.0.255
access-list 2 permit 192.168.3.0 0.0.0.255
ip nat pool test 10.1.1.100 10.1.1.120 netmask 255.255.255.224
ip nat inside source list 2 pool test

R5:
int e1/0
ip address 192.168.1.2 255.255.255.0
no shut
exit
int loopback 0
ip address 192.168.3.1 255.255.255.0
no shut
exit
ip route 0.0.0.0 0.0.0.0 e1/0

R1/R2/R3走ospf,R1/R3不发布192.168网段
其他略

 

 
帧中继:
R1(config-if)#encapsulation ?
  atm-dxi         ATM-DXI encapsulation
  bstun           Block Serial tunneling (BSTUN)
  frame-relay     Frame Relay networks
  hdlc            Serial HDLC synchronous
  lapb            LAPB (X.25 Level 2)
  ppp             Point-to-Point protocol
  sdlc            SDLC
  sdlc-primary    SDLC (primary)
  sdlc-secondary  SDLC (secondary)
  smds            Switched Megabit Data Service (SMDS)
  stun            Serial tunneling (STUN)
  x25             X.25
R1(config-if)#encapsulation frame-relay

使(路由器)能帧中继交换:
FR(config)#frame-relay switching
使用frame-relay intf-type dce这句命令前必须使用上面的命令
配置帧中继交换接口:
FR(config)#interface Serial1/1
FR(config-if)#no ip address
FR(config-if)#no shut
FR(config-if)#encapsulation frame-relay
FR(config-if)#serial restart-delay 0
FR(config-if)#clock rate 64000
FR(config-if)#no dce-terminal-timing-enable
FR(config-if)#frame-relay lmi-type ansi
FR(config-if)#frame-relay intf-type dce
FR(config-if)#frame-relay route 301 interface Serial1/0 103
FR(config-fr-dlci)#exit
FR(config)#interface Serial1/2
FR(config-if)#no ip address
FR(config-if)#no shut
FR(config-if)#encapsulation frame-relay
FR(config-if)#serial restart-delay 0
FR(config-if)#clock rate 64000
FR(config-if)#no dce-terminal-timing-enable
FR(config-if)#frame-relay lmi-type ansi
FR(config-if)#frame-relay intf-type dce
FR(config-if)#frame-relay route 201 interface Serial1/0 102
FR(config-fr-dlci)#exit
FR(config)#interface Serial1/0
FR(config-if)#no ip address
FR(config-if)#no shut
FR(config-if)#encapsulation frame-relay
FR(config-if)#serial restart-delay 0
FR(config-if)#clock rate 64000
FR(config-if)#no dce-terminal-timing-enable
FR(config-if)#frame-relay lmi-type ansi
FR(config-if)#frame-relay intf-type dce
FR(config-if)#frame-relay route 102 interface Serial1/2 201
FR(config-if)#frame-relay route 103 interface Serial1/1 301
------------------------------------------------------------------
FR#show frame-relay pvc 102
PVC Statistics for interface Serial1/0 (Frame Relay DCE)
DLCI = 102, DLCI USAGE = SWITCHED, PVC STATUS = ACTIVE, INTERFACE = Serial1/0
  input pkts 50            output pkts 12           in bytes 11692    
  out bytes 1108           dropped pkts 0           in pkts dropped 0        
  out pkts dropped 0                out bytes dropped 0        
  in FECN pkts 0           in BECN pkts 0           out FECN pkts 0        
  out BECN pkts 0          in DE pkts 0             out DE pkts 0        
  out bcast pkts 0         out bcast bytes 0        
  switched pkts 46       
  Detailed packet drop counters:
  no out intf 0            out intf down 0          no out PVC 0        
  in PVC down 0            out PVC down 0           pkt too big 0        
  shaping Q full 0         pkt above DE 0           policing drop 0        
  pvc create time 01:02:03, last time pvc status changed 00:27:07
------------------------------------------------------------------
FR#show frame-relay route
Input Intf      Input Dlci      Output Intf     Output Dlci         Status
Serial1/0       102             Serial1/2       201             active
Serial1/0       103             Serial1/1       301             active
Serial1/1       301             Serial1/0       103             active
Serial1/2       201             Serial1/0       102             active
------------------------------------------------------------------
FR#show frame-relay lmi interface s1/0
LMI Statistics for interface Serial1/0 (Frame Relay DCE) LMI TYPE = ANSI
  Invalid Unnumbered info 0             Invalid Prot Disc 0
  Invalid dummy Call Ref 0              Invalid Msg Type 0
  Invalid Status Message 0              Invalid Lock Shift 0
  Invalid Information ID 0              Invalid Report IE Len 0
  Invalid Report Request 0              Invalid Keep IE Len 0
  Num Status Enq. Rcvd 325              Num Status msgs Sent 325
  Num Update Status Sent 0              Num St Enq. Timeouts 1
------------------------------------------------------------------

配置路由器子接口:
R1(config)#interface Serial1/1
R1(config-if)#no ip address
R1(config-if)#no shut
R1(config-if)#encapsulation frame-relay
R1(config-if)#exit
R1(config)#interface Serial1/1.1 point-to-point /多点子接口:multipoint
R1(config-subif)#ip address 10.1.1.1 255.255.255.0
点对点:R1(config-subif)#frame-relay interface-dlci 102 (子接口方式下必须打,接口模式下不用打)
多点:R1(config-subif)#frame-relay map ip 10.1.1.2 102 broadcast (子接口方式下必须打,接口模式下不用打)
多点:R1(config-subif)#frame-relay map ip 10.1.1.3 103 broadcast (子接口方式下必须打,接口模式下不用打)
R1(config-fr-dlci)#exit
R1(config-subif)#exit
R1(config)#
点对点:
R1(config)#interface Serial1/1.2 point-to-point
R1(config-subif)#ip address 10.1.2.1 255.255.255.0
点对点:R1(config-subif)#frame-relay interface-dlci 103 (子接口方式下必须打,接口模式下不用打)
多点:……略
……
-----------------------------------------------------------------
点对点:
R1#show frame-relay map
Serial1/1.1 (up): point-to-point dlci, dlci 102(0x66,0x1860), broadcast
          status defined, active
Serial1/1.2 (up): point-to-point dlci, dlci 103(0x67,0x1870), broadcast
          status defined, active
-----------------------------------------------------------------

配置远端路由器:
R3(config)#int s1/0 (s1/0.1)
R3(config)#encapsulation frame-relay
R3(config-if)#ip address 10.1.2.2 255.255.255.0
R3(config-if)#no shut
点对点:R3(config-if)#frame-relay interface-dlci 301  (子接口方式下必须打,接口模式下不用打)
多点:……略
 (多点模式不能ping通自己接口的IP地址)
-----------------------------------------------------------------
R3#show frame-relay pvc 301
PVC Statistics for interface Serial1/0 (Frame Relay DTE)
DLCI = 301, DLCI USAGE = LOCAL, PVC STATUS = ACTIVE, INTERFACE = Serial1/0
  input pkts 67            output pkts 22           in bytes 15671    
  out bytes 2148           dropped pkts 0           in pkts dropped 0        
  out pkts dropped 0        out bytes dropped 0        
  in FECN pkts 0           in BECN pkts 0           out FECN pkts 0        
  out BECN pkts 0          in DE pkts 0             out DE pkts 0        
  out bcast pkts 2         out bcast bytes 68       
  pvc create time 00:44:01, last time pvc status changed 00:43:18

R3#show frame-relay map
Serial1/0 (up): ip 10.1.2.1 dlci 301(0x12D,0x48D0), dynamic,
              broadcast,, status defined, active
-----------------------------------------------------------------

R4(config)#int s1/2  (s1/2.1)
R4(config)#encapsulation frame-relay
R4(config-if)#ip address 10.1.1.2 255.255.255.0
R4(config-if)#no shut
点对点:R4(config-if)#frame-relay interface-dlci 201  (子接口方式下必须打,接口模式下不用打)
多点:……略
(多点模式不能ping通自己接口的IP地址)

 

 问题:
1.怎样看基本mac地址
2.SW1#show spanning-tree active
 VLAN1 is executing the ieee compatible Spanning Tree protocol
  Bridge Identifier has priority 32768, address cc02.0bf8.0000
  Configured hello time 2, max age 20, forward delay 15
  We are the root of the spanning tree
  Topology change flag not set, detected flag not set
  Number of topology changes 2 last change occurred 00:46:30 ago
          from FastEthernet1/1
  Times:  hold 1, topology change 35, notification 2
          hello 2, max age 20, forward delay 15
  Timers: hello 0, topology change 0, notification 0, aging 300

 Port 42 (FastEthernet1/1) of VLAN1 is forwarding
   Port path cost 19, Port priority 128, Port Identifier 128.42.
   Designated root has priority 32768, address cc02.0bf8.0000
   Designated bridge has priority 32768, address cc02.0bf8.0000
   Designated port id is 128.42, designated path cost 0
   Timers: message age 0, forward delay 0, hold 0
   Number of transitions to forwarding state: 1
   BPDU: sent 1437, received 2

 Port 43 (FastEthernet1/2) of VLAN1 is forwarding
   Port path cost 19, Port priority 128, Port Identifier 128.43.
   Designated root has priority 32768, address cc02.0bf8.0000
   Designated bridge has priority 32768, address cc02.0bf8.0000
   Designated port id is 128.43, designated path cost 0
   Timers: message age 0, forward delay 0, hold 0
   Number of transitions to forwarding state: 1
   BPDU: sent 1437, received 1

 Port 44 (FastEthernet1/3) of VLAN1 is forwarding
   Port path cost 19, Port priority 128, Port Identifier 128.44.
   Designated root has priority 32768, address cc02.0bf8.0000
   Designated bridge has priority 32768, address cc02.0bf8.0000
   Designated port id is 128.44, designated path cost 0, Topology change is set
   Timers: message age 0, forward delay 0, hold 0
   Number of transitions to forwarding state: 1
   BPDU: sent 1440, received 3

 Port 46 (FastEthernet1/5) of VLAN1 is forwarding
   Port path cost 19, Port priority 128, Port Identifier 128.46.
   Designated root has priority 32768, address cc02.0bf8.0000
   Designated bridge has priority 32768, address cc02.0bf8.0000
   Designated port id is 128.46, designated path cost 0
   Timers: message age 0, forward delay 0, hold 0
   Number of transitions to forwarding state: 1
   BPDU: sent 1438, received 0

 Port 52 (FastEthernet1/11) of VLAN1 is forwarding
   Port path cost 19, Port priority 128, Port Identifier 128.52.
   Designated root has priority 32768, address cc02.0bf8.0000
   Designated bridge has priority 32768, address cc02.0bf8.0000
   Designated port id is 128.52, designated path cost 0
   Timers: message age 0, forward delay 0, hold 0
   Number of transitions to forwarding state: 1
   BPDU: sent 1439, received 0

 Port 53 (FastEthernet1/12) of VLAN1 is forwarding
   Port path cost 19, Port priority 128, Port Identifier 128.53.
   Designated root has priority 32768, address cc02.0bf8.0000
   Designated bridge has priority 32768, address cc02.0bf8.0000
   Designated port id is 128.53, designated path cost 0
   Timers: message age 0, forward delay 0, hold 0
   Number of transitions to forwarding state: 1
   BPDU: sent 1439, received 0

SW2#show spanning-tree active
 VLAN1 is executing the ieee compatible Spanning Tree protocol
  Bridge Identifier has priority 32768, address cc03.0bf8.0000
  Configured hello time 2, max age 20, forward delay 15
  Current root has priority 32768, address cc02.0bf8.0000
  Root port is 43 (FastEthernet1/2), cost of root path is 19
  Topology change flag not set, detected flag not set
  Number of topology changes 2 last change occurred 00:46:58 ago
          from FastEthernet1/5
  Times:  hold 1, topology change 35, notification 2
          hello 2, max age 20, forward delay 15
  Timers: hello 0, topology change 0, notification 0, aging 300

 Port 42 (FastEthernet1/1) of VLAN1 is blocking
   Port path cost 19, Port priority 128, Port Identifier 128.42.
   Designated root has priority 32768, address cc02.0bf8.0000
   Designated bridge has priority 32768, address cc02.0bf8.0000
   Designated port id is 128.43, designated path cost 0
   Timers: message age 2, forward delay 0, hold 0
   Number of transitions to forwarding state: 0
   BPDU: sent 1, received 1412

 Port 43 (FastEthernet1/2) of VLAN1 is forwarding
   Port path cost 19, Port priority 128, Port Identifier 128.43.
   Designated root has priority 32768, address cc02.0bf8.0000
   Designated bridge has priority 32768, address cc02.0bf8.0000
   Designated port id is 128.42, designated path cost 0
   Timers: message age 2, forward delay 0, hold 0
   Number of transitions to forwarding state: 1
   BPDU: sent 2, received 1418

 Port 44 (FastEthernet1/3) of VLAN1 is forwarding
   Port path cost 19, Port priority 128, Port Identifier 128.44.
   Designated root has priority 32768, address cc02.0bf8.0000
   Designated bridge has priority 32768, address cc03.0bf8.0000
   Designated port id is 128.44, designated path cost 19
   Timers: message age 0, forward delay 0, hold 0
   Number of transitions to forwarding state: 1
   BPDU: sent 1416, received 0

 Port 46 (FastEthernet1/5) of VLAN1 is forwarding
   Port path cost 19, Port priority 128, Port Identifier 128.46.
   Designated root has priority 32768, address cc02.0bf8.0000
   Designated bridge has priority 32768, address cc03.0bf8.0000
   Designated port id is 128.46, designated path cost 19
   Timers: message age 0, forward delay 0, hold 0
   Number of transitions to forwarding state: 1
   BPDU: sent 1416, received 0

 Port 52 (FastEthernet1/11) of VLAN1 is forwarding
   Port path cost 19, Port priority 128, Port Identifier 128.52.
   Designated root has priority 32768, address cc02.0bf8.0000
   Designated bridge has priority 32768, address cc03.0bf8.0000
   Designated port id is 128.52, designated path cost 19
   Timers: message age 0, forward delay 0, hold 0
   Number of transitions to forwarding state: 1
   BPDU: sent 1416, received 0

转载请注明:成长的对话 » Cisco部分常用命令