1、
https://blog.51cto.com/jschinamobile/1828123
https://www.sohu.com/a/307185023_594016 (cisco交換機常用配置命令 )
2、
DEBUG命令
https://blog.51cto.com/tuwey/1699362
3、
https://blog.51cto.com/2841314881/1727763
思科交換機日志管理
查看日志:
show logging
Cisco交換機 SNMP配置
https://blog.csdn.net/qq_36425244/article/details/78126291
——————————————————————————————————————
基本配置
S> enable 進入特權模式
S# configure terminal 進入全局配置模式
S(config)# hostname name 改變交換機名稱
S(config)# enable password level level_# password 設置用戶口令(level_#=1)或特權口令(level_#=15)
S(config)# line console 0 進入控制台接口
S(config-line)# password console_password 接上一條命令,設置控制台口令
S(config)# line vty 0 15 進入虛擬終端
S(config-line)# password telnet_password 接上一條命令,設置Telnet口令
S(config-line)# login 允許Telnet登錄
S(config)# enable password|secret privilege_password 配置特權口令(加密或不加密)
S(config)# interface ethernet|fastethernet|gigabitethernet slot_#/port_# 進入接口子配置模式
S(config-if)# [no] shutdown 關閉或啟用該接口(默認啟用)
S(config)# ip address IP_address sunbet_mask 指定IP地址
S(config)# ip default-gateway router's_IP_address 指定哪台路由器地址為默認網關
S# show running-config 查看當前的配置
S# copy running-config startup-config 將RAM中的當前配置保存到NVRAM中
S> show interface [type slot_#/port_#] 查看所有或指定接口的信息
S> show ip 顯示交換機的IP配置(只在1900系列上可用)
S> show version 查看設備信息
S# show ip interface brief 驗證IP配置
S(config-if)# speed 10|100|auto 設置接口速率
S(config-if)# duplex auto|full|half 設置接口雙工模式
S> show mac-address-table 查看CAM表
S# clear mac-address-table 清除CAM表中的動態條目
1900(config)# mac-address-table permanent MAC_address type [slot_#/]port_# 在CAM表中創建靜態條目
2950(config)# mac-address-table static MAC_address vlan VLAN_# interface type [slot_#/] port_# 在CAM表中創建靜態條目
1900(config)# mac-address-table restricted static MAC_address source_port list_of_allowed_interface 設置靜態端口安全措施
1900(config-if)# port secure 啟用粘性學習
1900(config-if)# port secure max-mac-count value 設置粘性學習特性能夠學到的地址數量(默認132,取值范圍是1-132)
1900(config)# address-violation suspend|ignore|disable 改變安全選項
1900> show mac-address-table security 驗證端口安全措施
2950(config)# switchport mode access 定義接口為主機端口而不是中繼端口
2950(config)# switchport port-security 啟用端口安全措施
2950(config)# switchport port-security maximum value 指定可與此接口相關的設備的最大數量
2950(config)# switchport port-security violation protect|restrict|shutdown 指定出現安全違規時應該發生的事
2950(config)# switchport port-security mac-address MAC_address 指定允許與此接口相關的確切的MAC地址
2950(config)# switchport port-security mac-address sticky 啟用粘性學習特性
2950(config)# show port interface type [slot_#/] port_# 驗證接口配置
2950(config-if) description name 設置接口描述信息
2950# show buffers 查看系統緩存的大小
1900# copy nvram tftp:// IP_address_of_TFTP_server/ file_name 將配置文件備份到TFTP服務器上
1900# copy tftp:// IP_address_of_TFTP_server/ file_name nvram 從TFTP服務器上恢復配置到NVRAM
1900# delete nvram 刪除配置文件
2950# erase startup-config 刪除配置文件
3550# show tcam qos TCAM_ID statistics 查看TCAM剩余容量
4000> enable 進入特權模式
4000>(enable) set password 設置用戶模式密碼
4000>(enable) set enablepass 設置授權密碼
4000>(enable) set interface sc0 IP_address mask 配置IP地址
4000>(enable) set port enable|disable slot_#/port_# 啟用/禁用接口
4000>(enable) show port [slot_#/port_#] 顯示接口信息
4000>(enable) set port name slot_#/port_# name 設置交換機接口描述信息
4000>(enable) set port speed slot_#/port_# 4|10|16|100|auto 設置交換機接口速率
4000>(enable) set port duplex slot_#/port_# full|half 設置交換機接口雙工模式
4000>(enable) clear config all 刪除NVRAM中的配置信息
4000>(enable) erase all 刪除FLASH中的內容
4000>(enable) show flash 顯示FLASH中的內容
4000>(enable) show cam [count] dynamic|static|permanent|system [vlan_#] 顯示CAM表
VLAN 1900(config)# vtp domain VTP_domain_name 定義交換機域名
1900(config)# vtp server|client|transparent 定義交換機VTP模式(默認服務器)
1900(config)# vtp password VTP_password 配置VTP口令
1900(config)# vtp pruning enable|disable 啟用/禁用修剪(默認啟用)
1900(config)# vtp trap enable 啟用SNMP陷阱(默認啟用)
1900# show vtp 驗證VTP配置
2950# vtp database 訪問VLAN和VTP配置(以下均是在IOS12.1前用,12.1后全是在全局配置模式下)
2950(vlan)# vtp domain VTP_domain_name 定義交換機域名
2950(vlan)# vtp server|client|transparent 定義交換機VTP模式(默認服務器)
2950(vlan)# vtp password VTP_password 配置VTP口令
2950(vlan)# vtp pruning 啟用/禁用修剪(默認啟用)
2950(config)# snmp-server enable traps vtp 啟用SNMP陷阱(默認啟用)
2950# show vtp status 檢查VTP配置
2950# show vtp counters 顯示與VTP消息發送與接收相關的VTP統計信息
1900(config-if)# trunk on|off|desirable|auto 指定中繼類型
1900# show trunk A|B 驗證接口中繼(A是fa0/26,B是fa0/27)
2950(config-if)# switchport mode trunk|dynamic desirable|dynamic auto|nonegotiate 指定中繼類型(默認自動協商)
2950(config-if)# switchport trunk native|allowed|pruning vlan VLAN_# 配置中繼
2950(config-if)# switchport trunk pruning vlan remove VLAN_# 清除不希望消減的VLAN
2950# show interfaces [type 0/port_#] switchport|trunk 驗證接口中繼
1900(config)# vlan VLAN_# [name VLAN_name] 創建VLAN
1900(config-if)# vlan-membership static VLAN_# 將該接口靜態地分配給一個VLAN
1900# show vlan 驗證VLAN
1900# show vlan-membership 查看VLAN成員關系
1900# show spantree [VLAN_#] 查看VLAN的STP信息
2950# vlan database 進入VLAN數據庫(ISO12.1前用)
2950(vlan)# vlan VLAN_# [name VLAN_name] 創建VLAN
2950(config)# vlan VLAN_# 進入VLAN數據庫(ISO12.1后用)
2950(config-vlan)# name VLAN_name 創建VLAN
2950(config-if)# switchport mode access 指定連接是接入鏈路連接
2950(config-if)# switchport access vlan VLAN_# 指定VLAN是接入鏈路連接
4000>(enable) set vlan VLAN_# name VLAN_name 配置VLAN
4000>(enable) set vlan VLAN_# slot_#/port_#-port_# 為VLAN分配端口
4000>(enable) set trunk slot_#/port_# [on|off|desirable|auto|nonegotiate] [VLAN_#] [isl|dot1q|dot10|lane|negotiate] 配置中繼
4000>(enable) clear trunk slot_#/port_# VLAN_# 刪除VLAN
4000>(enable) show trunk slot_#/port_# 驗證中繼端口
4000>(enable) set vtp v2 enable 配置VTPv2
4000>(enable) set vtp [domain name] [mode client|server|transparent] [passwd password] [pruning enable|disable] [v2 enable|disable] 設置VTP
4000>(enable) show vtp domain 驗證VTP域的信息
4000>(enable) show vtp statistics 顯示發出或收到的VTP通告信息的摘要內容
4000>(enable) set vtp pruneeligible VLAN_# 設置VTP消減
4000>(enable) clear vtp pruneeligible VLAN_# 清除不希望消減的VLAN
STP 4000>(enable) set spantree enable|disable VLAN_# 啟用/禁用STP(默認啟用)
2950(config)# [no] spanning-tree vlan VLAN_# 啟用/禁用STP(默認啟用)
4000>(enable) show spantree [VLAN_#] 驗證STP狀態
2950# show spanning-tree 驗證STP狀態
4000>(enable) set spantree root [secondary] VLAN_# [dia network_diameter] [hello hello_time] 設置主根節點橋、備份節點橋、最大橋數量(2-7)、持續時間(1-10,默認2)
4000>(enable) set spantree portcost slot_#/port_# cost_# 設置端口開銷
2950(config-if)# spanning-tree cost cost_# 設置端口開銷
4000>(enable) set spantree portpri slot_#/port_# priority_# 設置端口優先級
4000>(enable) set spantree portvlanpri slot_#/port_# priority_# [VLAN_#] 改變VLAN的優先級設置
2950(config-if)# spanning-tree vlan VLAN_# port-priority priority_# 設置端口優先級
4000>(enable) set spantree fwddelay delay_# [VLAN_#] 設置從偵聽狀態到學習狀態再到轉發狀態的時間間隔(默認15秒,取值范圍是4-30秒)
4000>(enable) set spantree hello interval_time [VLAN_#] 設置根節點交換機發送BPDU的時間間隔(默認2秒,取值范圍是1-10秒)
4000>(enable) set spantree maxage agingtime [VLAN_#] 設置交換機持有BPDU的時間(默認20秒,取值范圍是6-40秒)
2950(config)# spanning-tree vlan VLAN_# forward-time forward_time 設置從偵聽狀態到學習狀態再到轉發狀態的時間間隔(默認15秒,取值范圍是4-30秒)
2950(config)# spanning-tree vlan VLAN_# hello-time hello_time 設置根節點交換機發送BPDU的時間間隔(默認2秒,取值范圍是1-10秒)
2950(config)# spanning-tree vlan VLAN_# max-age maxage 設置交換機持有BPDU的時間(默認20秒,取值范圍是6-40秒)
4000>(enable) set port channel slot_#/port_# on 建立以太通道集合
4000>(enable) show port capabilities slot_#/port_# 查看端口的配置
4000>(enable) show port channel 驗證以太通道集合的配置
2950(config-if)# channel-group group_number mode auto|desirable|on 建立以太通道集合
2950# show etherchannel group_number|brief|detail|load-balance|port|port-channel|summary 驗證以太通道集合的配置
4000>(enable) set spantree portfast slot_#/port_# enable 配置PortFast
2950(config-if)# spanning-tree portfast 配置PortFast
4000>(enable) set spantree uplinkfast enable|disable [rate station_update_rate] [all-protocols off|on] 啟用/禁用UplinkFast
4000>(enable) show spantree uplinkfast 驗證UplinkFast配置
2950(config)# spanning-tree uplinkfast [max_update_rate] 啟用/禁用UplinkFast
2950# show spanning-tree uplinkfast 驗證UplinkFast配置
4000>(enable) set spantree backbonefast enable|disable 啟用/禁用BackboneFast
4000>(enable) show spantree backbonefast 驗證BackboneFast配置
2950(config)# spanning-tree backbonefast 啟用BackboneFast
虛擬網間路由
2600(config)# interface type slot_#/port_#.subint_number 配置子接口
2600(config-subif)# encapsulation dot1q|isl|sde|tr-isl VLAN_# 配置封裝類型
4000>(enable) show module 查看交換機的硬件配置
4000>(enable) session module_# 訪問L3SM
L3SM(config-if)# mac-address mac_address 分配MAC地址
MLS 2600(config)# mls rp ip 啟動MLS
2600(config-if)# mls rp vtp-domain domain_name 分配路由器接口到VTP域中
2600(config-if)# mls rp vlan-id VLAN_# 向接口分配VLAN
2600(config-if)# mls rp management-interface 指定該接口為管理接口
2600# show mls rp 提供全局MLS信息
2600# show mls rp interface type slot_#/port_# 提供指定接口的MLS信息
2600# show mls rp vtp-domain domain_name 提供VTP域的MLS信息
6500>(enable) set mls enable 在MLS-SE上啟動MLS
6500>(enable) set mls include rp_ip_address 告訴交換機哪一個IP地址是正確的
6500>(enable) show mls include 顯示外部路由處理器的IP地址列表
6500>(enable) set mls flow [destination|destination-source|full] 告訴MLS交換機要緩存候選數據包的哪些信息
6500>(enable) show mls entry 顯示第三層緩存表
6500>(enable) set mls agingtime aging_time 改變緩存的衰老時間(默認256秒,取值范圍是8-2032秒中的8的倍數值)
6500>(enable) set mls agingtime fast fast_aging_time pkt_threshold 改變快速衰老周期和數據包門限值
6500>(enable) show mls ip 驗證MLS-SE的配置
6500>(enable) clear mls entry [destination IP_address] [source IP_address] [flow protocol] [source_port] [destination_port] [all] 刪除所有或指定MLS緩存記錄
3550(config)# ip routing 啟動IP路由
3550(config)# ip cef 啟動CEF
3550(config-if)# no switchport 將第二層接口轉換為第三層接口
3550(config-if)# ip route-cache cef 在接口上啟動CEF
3550# show ip cef 驗證CEF
組播
3640(config)# ip multicast-routing 啟動路由器上的組播服務
3640(config-if)# ip pim dense-mode 將接口設置為PIM密集模式
3640(config-if)# ip pim sparse-mode 將接口設置為PIM稀疏模式
3640(config-if)# ip pim sparsed-dense-mode 將接口設置為PIM稀疏-密集模式
3640(config)# ip pim rp-address IP_address group_ACL_# [override] 手工配置RP
3640(config)# ip pim send-rp-announce type slot_#/port_# scope ttl_value group-list ACL_# 通告RP組的分配
3640(config)# ip pim send-rp-discovery scope ttl_value 配置RP映射代理
3640(config-if)# ip multicast ttl-threshold ttl_value 設置TTL門限值
3640(config-if)# ip igmp join-group group_address 加入組播組
3640# show ip mroute 查看組播信息
3640# ping 驗證RP之間或其他組播路由器之間的連接
3640# mtrace source_IP_address [destination_IP_address] [group] 組播traceroute
3640(config-if)# ip cgmp 配置CGMP路由器
4000>(enable) set cgmp enable 啟動CGMP
4000>(enable) show cgmp statistics 查看CGMP統計信息
4000>(enable) show multicast group cgmp 查看交換機了解到的組播組信息
4000>(enable) set cgmp leave enable 檢查由客戶端產生的IGMPv2的離開信息
4000>(enable) set igmp enable 啟動IGMP
4000>(enable) ip igmp snooping 啟動IGMP探聽
4000>(enable) set igmp fastleave enable 啟動快速離開過程
4000>(enable) show igmp statistics 顯示交換機上IGMP探聽的狀態信息
QoS 2950(config)# wrr-queue cos-map queue_ID cos_value 建立隊列
2950(config)# wrr-queue bandwidth bandwidth_value 設置隊列門限
2950(config)# class-maps name 定義對信息傳輸分類時的匹配標准
2950(config-cmap)# match access-group ACL_# 識別被分類的信息傳輸
2950(config)# policy-map name 確定為接入信息傳輸所設置的分類標准
2950(config-pmap)# class name
2950(config-pmap-c)# set ip dscp number
2950(config-if)# service-policy input name 對該接口應用策略
3550(config)# mls qos 啟動QoS
3550(config-if)# auto qos voip 在接口上啟動自動服務質量
3550(config)# priority-list priority_queue_# protocol protocol high|medium|normal|low [list ACL_#] 為優先級隊列定義信息流
3550(config)# priority-list priority_queue_# queue-limit limit_# 定義特定優先級隊列的最大隊列空間
3550(config-if)# priority-group priority_queue_# 向特定輸出接口分配優先級隊列
3550(config)# queue-list queue_list_# interface type slot_#/port_# queue_number 為一個特定的定制隊列定義信息流
3550(config)# queue-list queue_list_# queue queue_number byte-count size_in_bytes [limit number_of_queue] 為特定的定制隊列定義隊列的最大空間
3550(config-if)# custom-queue-list custom_queue_number 為特定的輸出接口分配優先級隊列
4840(config)# ip slb serverfarm serverfarm_name 配置SLB冗余
4840(config-slb-sfarm)# real IP_address [port_#] 指定虛擬IP地址
4840(config-slb-sfarm)# inservice 啟動服務器
4840(config)# virtual IP_address [network_mask] tcp|udp [port_number|wsp|wsp-wtp|wsp-wtls|wsp-wtp-wtls] [service service_name] 建立虛擬服務器IP地址
本文出自 “夢想照進現實” 博客,請務必保留此出處http://lookingdream.blog.51cto.com/5177800/1825296
h