導航:首頁 > 程序命令 > cisco宏命令

cisco宏命令

發布時間:2023-01-16 04:18:59

A. 思科交換機常用命令匯總1-乙太網和vlan

1. 乙太網

1. 介面MTU和ip MTU

Switch(config-if)#mtu 1500

Switch(config-if)#ip mtu 1500

Switch#sh int s1/0

Switch#sh ip int s1/0

2. 管理MAC表

48位,點分十六進製表示

Switch#show mac address-table

Switch#clear mac address-table

Switch(config)#mac address-table static aaaa.bbbb.cccc vlan 10 interface e0/0

2. 二層交換

1. Protected port

Switch(config-if)#switchport protected

2. Native Vlan

Switch(config-if)#switchport trunk native vlan 10

Switch(config)#vlan dot1q tag native

配置對native vlan也打標簽

Vlan范圍:(dot1q)

3. Trunk配置

ISL:支持1-1005個vlan編號

DOT1Q:支持1-4094個vlan編號

Switch(config-if)#switchport mode access

將介面設置為access模式

Switch(config-if)#switchport trunk encapsulation {dot1q | ISL | negotiate }

Switch(config-if)#switchport mode {auto | desirable |trunk}

Switch#show interface f0/8 switchport

將介面設置為DTP動態協商,可auto或desirable

Switch(config-if)#switchport nonegotiate

將介面設置為nonegotiate,不發送DTP幀,如果配置為非協商,那麼必須手工配置介面模式為access或trunk

Switch(config-if)#switchport mode dynamic [auto | desirable]

配置介面為協商模式

Switch#show interface trunk 查看trunk狀態

Switch#show interfaces fa0/0 switchport 查看介面二層trunk信息

Switch(config-if)#switchport trunk allowed vlan {WORD | add | all | except | none | remove}

Switch1(config-if)#switchport trunk allowed vlan ?

WORD VLAN IDs of the allowed VLANs when this port is in trunking mode

add add VLANs to the current list

all all VLANs

except all VLANs except the following

none no VLANs

remove remove VLANs from the current list

Switch(config-if)#switchport trunk allowed vlan remove 20

Switch#show interface f0/8 switchport

查看介面trunk/vlan/private-vlan信息

4. VTP

1. VTP配置

Switch1(config)#vtp domain cisco

Switch1(config)#vtp mode {server | client |transparent}

Switch1(config)#vtp password 123456

Switch1#sh vtp password

2. VTP pruning

Switch1#sh vtp status

3. 查看trunk及allowed vlan狀態

Switch1#sh int trunk

4. VTP pruning

Switch2(config)#vtp pruning

開啟VTP修剪

Switch1#sh vtp status

查看VTP狀態

5. 私有VLAN(PVLAN)

1. 創建主VLAN:

Vlan 100

Private-vlan primary

2. 創建輔助VLAN

Vlan 101

Private-vlan community

Vlan 102

Private-vlan ioslate

3. 配置主VLAN,將二層輔助VLAN關聯到主VLAN

Vlan 100

Private-vlan association 101,102

4. 將輔助VLAN映射到主VLAN的SVI介面,從而允許PVLAN入口流量的三層交換。

Interface vlan 100

Private-vlan mapping add 101,102

5. 配置介面

Interface f0/1

Switchport mode private-vlan host

Switchport private-vlan host-association 100 101 //關聯主VLAN和輔助VLAN到介面

Interface f0/2

Switchport mode private-vlan host

Switchport mode private-vlan host-association 100 102

主機介面配置

Interface f0/3

Switchport mode private-vlan promiscuous

Switchport private-vlan mapping add 100 101 //將埠映射到PLAN

混雜埠配置

6. 查看及驗證

Show pvlan mapping

PLAN配置示例

Sw(config)#vtp transparent

Sw(config)#vlan 201

Sw(config-vlan)#private-vlan isolated

Sw(config)#vlan 202

Sw(config-vlan)#private-vlan community

Sw(config)#vlan 100

Sw(config-vlan)#private-vlan primary

Sw(config-vlan)#private-vlan association 201,202

!

Sw(config)#interface fa0/24

Sw(config-if)#switchport mode private-vlan promiscuous

Sw(config-if)#switchport mode private-vlan mapping 100 201,202

Sw(config)#interface range fa 0/1 - 2

Sw(config-if)#switchport mode private-vlan host

Sw(config-if)#switchport private-vlan host-association 100 202

Sw(config)#interface range fa 0/3 - 4

Sw(config-if)#switchport mode private-vlan host

Sw(config-if)#switchport private-vlan host-association 100 201

B. cisco基本配置命令

Cisco 的交換機產品以「Catalyst 」為商標,包含1900 、2800 、2900 、3500 、4000 、5000 、5500 、6000 、8500 等十多個系列。

基本配置命令如下:

1、Switch>enable 進入特權模式

2、Switch #config terminal 進入全局配置模式

3、Switch(config)#hostname 設置交換機的主機名

4、Switch(config)#enable password 進入特權模式的密碼(明文形式保存)

5、Switch(config)#enablesecret 加密密碼(加密形式保存) (優先)

6、Switch(config)#ipdefault-gateway 配置交換機網關

7、Switch(config)#showmac-address-table 查看MAC地址

8、Switch(config)loggingsynchronous 阻止控制台信息覆蓋命令行上的輸入

9、Switch(config)no ipdomain-lookup 關閉DNS查找功能

10、Switch(config)exec-timeout 00 阻止會話退出

(2)cisco宏命令擴展閱讀

cisco常用配置命令:

一、使用Telnet遠程式管理

1、Switch(config)#line vty 0 4 進入虛擬終端

2、Switch (config-line)# password 設置登錄口令

3、Switch(config-line)# login 要求口令驗證

二、控制台口令

1、switch(config)#lineconsole 0 進入控制台口

2、switch(config-line)# password xx

3、switch(config-line)#設置登錄口令login 允許登錄

三、恢復出廠配置

Switch(config)#erasestartup-config

Switch(config)delete vlan.dat

C. 思科最技術命令

思科最實用的技術命令大全

本文為大家分享的是CISCO Trouble Shooting的實用命令,希望能幫助到大家!

一、故障處理命令

1、show命令:

1) 全局命令:

show version ;顯示系統硬體和軟體版本、DRAM、Flash

show startup-config ;顯示寫入NVRAM中的配置內容

show running-config ;顯示當前運行的配置內容

show buffers ;詳細輸出buffer的名稱和尺寸

show stacks ;提供路由器進程和處理器利用率信息, 用stack decode

show tech-support ;顯示幾個show命令的輸出

show access-lists ;查看訪問列表配置

show memory ;用於測試內存問題

2) 介面相關命令

show queueing [fair|priority|custom]

show queue e0/1 ;查看介面上隊列的設置和操作

show interface e0/1 ;Cisco預設的Ethernet封裝方法是ARPA

show ip interface e0/1 ;顯示指定介面的TCP/IP配置信息

3) 進程相關命令

show processes cpu ;顯示路由器CPU的使用率和當前的進程

show processes memory ;顯示路由器當前進程的內存使用情況

4) TCP/IP協議相關命令

Show ip access-list ;顯示IP訪問列表(1-199)

Show ip arp ;顯示路由器的ARP緩存(IP、MAC、封裝類型、介面)

Show ip protocols ;顯示運行在路由器上的IP路由協議的信息

Show ip route ;顯示IP路由表中的信息

Show ip traffic ;顯示IP流量統計信息

2、debug命令

DEBUG不應在CPU使用率超過50%的路由器上運行。

1) 限制debug輸出

在使用DEBUG獲得所需數據後,要關閉Debug

使路由器對所有消息都配置使用時間戳:

Router#service timestamps debug datetime msec localtime

Router#service timestamp log datetime msec localtime

預設,error和debug信息僅發送到console,telnet到路由器上看不到debug和log的信息。想在telnet中看到debug和log信息:

Router#terminal monitor

Router#terminal monitor ;關閉信息輸出

Router#undebug all ;關閉debug進程及所有相關信息的輸出

可以應用ACL到debug以限定僅輸出要求的debug信息。

如僅查看從10.0.1.1到10.1.1.1的ICMP包:

Router(config)#access-list 101 permit icmp host 10.0.1.1 host 10.1.1.1

Router#debug ip packet detail 101

2) 全局debug命令:

3) 介面debug

4) 協議debug

5) IP debug

debug ip packets

3、logging命令

輸出error和其它信息到console、terminal、路由器內部buffer或一台syslog伺服器:

Router>show logging

Cisco路由器有8種可能的logging級:0-7

Logging級別 名稱 描述

1 Emergencies 系統不能用的信息

2 Alerts 直接行動

3 Critical 緊急情形

4 Errors 錯誤信息

5 Warnings 警告信息

6 Notifications 正常但重要的情形

7 Informational 信息

8 Debugging 調試

預設地,console、monitor、buffer的logging被設置為debugging級,而trap(syslog)伺服器的logging被設置為informational。

4、執行路由核心復制

core mp包含一份當前系統內存中信息的精確拷貝。捕捉包含在內存中信息的方法有:

1) 配置路由器在崩潰時執行Core Dump,存儲到TFTP、FTP、RCP伺服器:

對TFTP協議,只需指定TFTP伺服器IP,不需要任何附加的配置:

Router(config)#exception mp 192.168.1.1 ;TFTP伺服器的IP地址

對FTP協議的配置:

Router(config)#exception mp 192.168.1.1 ;FTP伺服器的IP地址

Router(config)#ip ftp username Kevin

Router(config)#ip ftp password aloha

Router(config)#ip ftp source-interface e0

Router(config)#exception protocol ftp

對RCP協議的配置:

Router(config)#exception protocol rcp

Router(config)#exception mp 192.168.1.1 ;RCP伺服器的IP地址

Router(config)#ip rcmd remote-username Kevin

Router(config)#ip rcmd rcp-enable

Router(config)#ip rcmd rsh-enable

Router(config)#ip rcmd remote-host Kevin 192.168.1.1 kevin ;

2) 在系統沒有崩潰的情況下,執行Core Dump命令。

Router#write core

Core Dump僅在Cisco工程師測試和解決路由器問題時有用。

5、ping命令

ping用於測試整個網路可達性和連通性。可在用戶EXEC模式和特權EXEC模式下使用。

IP的ping使用ICMP協議提供連通性和可能性信息,預設只發送5個echo信息。

擴展Ping的選項有:源IP地址;服務類型;數據;包頭選項。

Ping的響應字元集

字元 解釋 字元 解釋

! Received an echo-reply message Q Source quench

. Timeout M Unable to fragment

U/H Destination unreachable A Administratively denied

N Network unreachable ? Unknown packet-type

P Protocol unreachable

6、traceroute命令

traceroute用於顯示到達目標的包路徑。可在用戶模式和特權模式下使用。

Traceroute的響應:

字元 解釋 字元 解釋

Xx msec The RTT for each packet * Timeout

H Host unreachable U Port unreachable

N Network unreachable P Protocol unreachable

A Administratively denied Q Source quench

? Unknown packet type

二、LAN連接問題

1、獲得IP地址

主機可以動態或靜態獲得IP地址。

1) DHCP:DHCP比BootP多了地址池和租期。

2) BootP:

3) Helper Addresses:指定集中放置的DHCP伺服器的IP地址

Ip helperaddress ip-address ;

No ip forward-protocol udp 137 ;

4) 路由器上的DHCP服務:配置路由器為一台DHCP伺服器

5) DHCP和BootP故障處理

Show dhcp server ;

Show dhcp lease ;

2、ARP

ARP映射第2層MAC地址到第3層地址。

Show arp ;顯示路由器的ARP表

Debug arp ;

1) ARP代理:預設Cisco路由器的ARP代理是啟用的

在下列情況下,CISCO路由器將用自身的MAC地址響應ARP請求:

? 接收到ARP的介面上的Proxy ARP是啟用的;

? ARP請求的地址不在本地子網;

? 路由器的路由表中包含ARP請求地址的子網;

3、TCP連接示例

三、IP訪問列表

1、標准ACL:基於IP包的源IP地址允許或禁用

2、擴展ACL:提供源地址、目標地址、埠號、會話層協議進行過濾。

3、命名ACL:可以是標准ACL,也可以是擴展ACL。

命名ACL與編號ACL的區別:命名ACL有一個邏輯名,可以刪除命名ACL中單獨一行。

Ip access-list extended Example-Named-ACL

Deny tcp any any eq echo

Deny tcp any any eq 37

Permit udp host 172.16.10.2 any eq snmp

Permit tcp any any

第6章 TCP/IP路由協議故障處理

一、預設網關

當包的目的地址不在路由器的路由表中,如路由器配置了預設網關,則轉發到預設網關,否則就丟棄。

Show ip route ;查看Cisco路由器的預設網關

二、靜態和動態路由

三、處理k_protocal/04937.htm" target="_blank">RIP故障

RIP是距離矢量路由協議,度量值是跳數。RIP最大跳數為15,如果到目標的跳數超過15,則為不可達。

RIP V1是有類別路由協議,RIP V2是非分類路由協議,支持CIDR、路由歸納、VLSM,使用多播(224.0.0.9)發送路由更新。

RIP相關的show命令:

Show ip route rip ;僅顯示RIP路由表

Show ip route ;顯示所有IP路由表

Show ip interface ;顯示IP介面配置

Show running-config

Debug ip rip events ;

常見的RIP故障:RIP版本不一致、RIP使用UDP廣播更新

四、處理IGRP故障

IGRP是Cisco專用路由協議,距離矢量協議。IGRP的度量值可以基於五個要素:帶寬、延時、負載、可靠性、MTU,預設只使用帶寬和延時。

IGRP相關的show命令:

Show ip route igrp ;顯示IGRP路由表

Debug ip igrp events ;

Debug ip igrp transactions ;

常見的IGRP故障:訪問列表、不正確的.配置、到相鄰路由器的line down

五、處理EIGRP故障

EIGRP是鏈路狀態協議和距離矢量混合協議,是CISCO專用路由協議。EIGRP使用多播地址224.0.0.10發送路由更新,使用DUAL演算法計算路由。EIGRP的度量值可以基於帶寬、延時、負載、可靠性、MTU,預設僅使用帶寬和延時。

EIGRP使用3種資料庫:路由資料庫、拓撲資料庫、相鄰路由器資料庫。

EIGRP相關的show命令:

Show running-config

Show ip route

Show ip route eigrp ;僅顯示EIGRP路由

Show ip eigrp interface ;顯示該介面的對等體信息

Show ip eigrp neighbors ;顯示所有的EIGRP鄰居及其信息

Show ip eigrp topology ;顯示EIGRP拓撲結構表的內容

Show ip eigrp traffic ;顯示EIGRP路由統計的歸納

Show ip eigrp events ;顯示最近的EIGRP協議事件記錄

EIGRP相關的debug命令:

Debug ip eigrp as號

Debug ip eigrp neighbor

Debug ip eigrp notifications

Debug ip eigrp summary

Debug ip eigrp

常見的EIGRP故障:相鄰關系、預設網關等的丟失、老版本IOS的路由、stuck in active。

處理EIGRP故障時,先用show ip eigrp neighbors查看所有相鄰路由器,然後再用show ip route gigrp查看路由器的路由表,再用show ip eigrp topology查看路由器的拓撲結構表,也可用show ip eigrp traffic查看路由更新是否被發送。

六、處理OSPF故障

OSPF是鏈路狀態協議,維護3個資料庫:相鄰資料庫、拓撲結構資料庫、路由表。

OSPF相關的show命令:

Show running-config

Show ip route

Show ip route ospf ;僅顯示OSPF路由

Show ip ospf process-id ;顯示與特定進程ID相關的信息

Show ip ospf ;顯示OSPF相關信息

Show ip ospf border-routers ;顯示邊界路由器

Show ip ospf database ;顯示OSPF的歸納資料庫

閱讀全文

與cisco宏命令相關的資料

熱點內容
現在什麼編程語言高薪 瀏覽:548
該文件夾不在桌面 瀏覽:787
程序員入職第一天如何自我介紹 瀏覽:807
江蘇國稅網上認證伺服器地址 瀏覽:515
網站源碼使用教程 瀏覽:413
雲伺服器加機 瀏覽:160
影視後端源碼 瀏覽:747
榮耀8x怎麼升級安卓69 瀏覽:174
伺服器顯示內存溢出來怎麼辦 瀏覽:995
什麼app可以找回貨 瀏覽:732
打tar包命令 瀏覽:581
北京網頁游戲編程培訓 瀏覽:255
5e游戲時間演算法 瀏覽:124
加密電子狗重裝硬碟怎麼設置 瀏覽:194
怎麼在mac上寫python 瀏覽:162
貓盤硬體加密 瀏覽:259
彎鋼玻璃計算器演算法 瀏覽:606
譚浩強第三版pdf 瀏覽:17
revit裡面編程軟體 瀏覽:775
累加的運演算法則 瀏覽:682