思科交換機常用命令及配置

  1. 打開思科交換CLI,首先進入的是用戶模式,如果要進行配置操作需要進入特權模式。

    Switch>enable

    Switch#

    思科交換機常用命令及配置

  2. 2

    從特權模式進入全局配置模式

    Switch#configure terminal

    Switch(config)#

    思科交換機常用命令及配置

  3. 3

    在特權模式下可以對交換機進行命名,這樣在配置多臺交換機時,避免將配置寫錯交換機。

    Switch(config)#hostname cisco-sw1

    思科交換機常用命令及配置

  4. 4

    配置交換端口密碼,登錄特權模式時需要輸入該密碼,避免設備被其他人使用。

    cisco-sw1(config)#enable password cisco

    ps:password表示密碼爲明文

    思科交換機常用命令及配置

  5. 5

    給交換機配置使能密碼,進入特權模式時需要輸入密碼才能進入,避免設備可以被其他人員使用。

    cisco-sw1(config)#enable secret ciscoswitch

    ps:secret表示密碼用的密文

    思科交換機常用命令及配置

    思科交換機常用命令及配置

  6. 6

    交換機配置VLAN,並給將端口加入到該VLAN:

    cisco-sw1(config)#vlan 2

    cisco-sw1(config-vlan)#name test

    cisco-sw1(config-vlan)#exit

    cisco-sw1(config)#interface  fastEthernet 0/1

    cisco-sw1(config-if)#switchport mode access

    cisco-sw1(config-if)#switchport access vlan 2

    思科交換機常用命令及配置

    思科交換機常用命令及配置

  7. 7

    進入交換機某一端口

    switch> enable

    switch#configure terminal

    switch(conf)# interface fastehernet 0/1

    switch(conf-if)#

    思科交換機常用命令及配置

  8. 8

    show:查看命令,交換機的所有配置和其它相關信息都需要通過show命令查看。

    switch> enable

    switch# show version 察看系統中的所有版本信息

    switch#show  vlan id 1 查看交換機有關vlan配置信息

    switch#show running-configure 查看交換機當前起作用的配置信息

    switch#show interface fastethernet 0/1 察看交換機1 接口具體配置和統計信息

    switch#show mac-address-table 查看mac地址轉發表

    思科交換機常用命令及配置

    思科交換機常用命令及配置

    思科交換機常用命令及配置

    思科交換機常用命令及配置

    思科交換機常用命令及配置

  9. 9

    交換機恢復出廠

    switch> enable

    switch# erase startup-configure

    switch# reload

    思科交換機常用命令及配置

  10. 10

    telnet 遠程登錄設置:

    switch>en

    switch#configure terminal

    swich(conf)#enable password cisco 以cisco 爲特權模式密碼

    swich(conf)#interface vlan 1 以vlan 1端口作爲遠程登錄的接口,其他端口亦可

    swich(conf-if)#ip address 192.168.1.1 255.255.255.0

    swich(conf-if)#no shut

    swich(conf-if)#exit

    swich(conf)line vty 0 4 設置0-4 個用戶可以telnet 遠程登陸

    swich(conf-line)#password 123456

    swich(conf-line)#login

    思科交換機常用命令及配置

  11. 11

    SSH遠程登錄設置:

    Switch#conf t

    Enter configuration commands, one per line.  End with CNTL/Z.

    Switch(config)#hostname cisco-sw1   交換機重新命名

    cisco-sw1(config)#ip domain-name cisco.com 配置域名

    cisco-sw1(config)#line vty 0 4

    cisco-sw1(config-line)#transport input ssh 登錄方式爲SSH

    cisco-sw1(config-line)#exit

    cisco-sw1(config)#crypto key generate rsa 配置祕鑰

    The name for the keys will be: cisco-sw1.cisco.com

    Choose the size of the key modulus in the range of 360 to 2048 for your

    General Purpose Keys. Choosing a key modulus greater than 512 may take

    a few minutes.

     

    How many bits in the modulus [512]: 1024 思科推薦使用1024

    % Generating 1024 bit RSA keys, keys will be non-exportable...[OK]

    思科交換機常用命令及配置

    思科交換機常用命令及配置

  12. 來源互聯網,轉載請聯繫源作者

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章