學(xué)習(xí)啦>學(xué)習(xí)電腦>選購(gòu)與維護(hù)>電腦組裝教程>

思科交換機(jī)常用命令及配置

時(shí)間: 林澤1002 分享

  思科發(fā)布一個(gè)安全公告,詳細(xì)介紹了其2個(gè)關(guān)鍵的交換機(jī)和路由器產(chǎn)品線的防火墻服務(wù)模塊中存在的多個(gè)安全漏洞。下面是學(xué)習(xí)啦小編收集整理的思科交換機(jī)常用命令及配置,希望對(duì)大家有幫助~~

  思科交換機(jī)常用命令及配置

  switch> 用戶模式

  1:進(jìn)入特權(quán)模式enable

  switch> enable

  switch#

  2:進(jìn)入全局配置模式configure terminal

  switch> enable

  switch#configure terminal

  switch(conf)#

  3:交換機(jī)命名hostname name 以cisco001 為例

  switch> enable

  switch#c onfigure terminal

  switch(conf)#hostname cisco001

  cisco001(conf)#

  4:配置使能口令(未加密)enable password cisco 以cisco 為例

  switch> enable

  switch#configure terminal

  cisco001(conf)# enable password cisco

  5:配置使能密碼(加密)enable secret ciscolab 以cicsolab 為例

  switch> enable

  switch#configure terminal

  switch(conf)# enable secret ciscolab

  6:設(shè)置虛擬局域網(wǎng)vlan 1 interface vlan 1

  switch> enable

  switch#configure terminal

  switch(conf)# interface vlan 1

  switch(conf)# ip address 192.168.1.1 255.255.255.0 配置交換機(jī)端口ip 和子網(wǎng)掩碼

  switch (conf-if)#no shut 激活端口

  switch (conf-if)#exit

  switch (conf)#ip default-gateway 192.168.254 設(shè)置網(wǎng)關(guān)地址

  7:進(jìn)入交換機(jī)某一端口interface fastehernet 0/17 以17 端口為例

  switch> enable

  switch#configure terminal

  switch(conf)# interface fastehernet 0/17

  switch(conf-if)#

  8:查看命令show

  switch> enable

  switch# show version 察看系統(tǒng)中的所有版本信息

  show interface vlan 1 查看交換機(jī)有關(guān)ip 協(xié)議的配置信息

  show running-configure 查看交換機(jī)當(dāng)前起作用的配置信息

  show interface fastethernet 0/1 察看交換機(jī)1 接口具體配置和統(tǒng)計(jì)信息

  show mac-address-table 查看mac 地址表

  9:交換機(jī)恢復(fù)出廠默認(rèn)恢復(fù)命令

  switch> enable

  switch# erase startup-configure

  switch# reload

  10:交換機(jī)的密碼恢復(fù)

  拔下交換機(jī)電源線。

  用手按著交換機(jī)的MODE 鍵,插上電源線

  在switch:后執(zhí)行flash_ini 命令:switch: flash_ini

  查看flash 中的文件: switch: dir flash:

  把“config.text”文件改名為“config.old”: switch: rename flash: config.text flash: config.old

  執(zhí)行boot: switch: boot

  交換機(jī)進(jìn)入是否進(jìn)入配置的對(duì)話,執(zhí)行no :

  進(jìn)入特權(quán)模式察看flash 里的文件: show flash :

  把“config.old”文件改名為“config.text”: switch: rename flash: config.old flash: config.text

  把“ config.text ” 拷入系統(tǒng)的“ running-configure ”: copy flash: config.text system :

  running-configure

  重新設(shè)置密碼并保存。

  11.交換機(jī)telnet 遠(yuǎn)程登錄設(shè)置:

  switch>en

  switch#configure terminal

  swich(conf)#enable password cisco 以cisco 為特權(quán)模式密碼

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

  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 設(shè)置0-4 個(gè)用戶可以telnet 遠(yuǎn)程登陸

  swich(conf-line)#login

  swich(conf-line)#password 123456

  12.交換機(jī)ssh遠(yuǎn)程登錄設(shè)置:

  a.設(shè)定一個(gè)非默認(rèn)的hostname

  Switch(config)#hostname cisco

  b.配置域名:

  cisco(config)#ip domain-name test

  c.指定加密長(zhǎng)度:

  cisco(config)#crypto key generate rsa

  How many bits in the modulus [512]: 1024

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

  d.將vty線路下的登錄方式改為 ssh

  cisco(config)#line vty 0 4

  cisco(config-line)#transport in ssh

  13.配置vtp同步

  說(shuō)明:VTP(VLAN Trunking Protocol):是VLAN中繼協(xié)議,它是思科私有協(xié)議。作用是同步各個(gè)交換機(jī)之間的VLAN信息。

  要使用VTP,首先必須建立一個(gè)VTP管理域,在同一個(gè)管理域中交換機(jī)共享vlan信息,并且一個(gè)交換機(jī)只能參加一個(gè)管理域,交換機(jī)之間使用trunk口連接。

  方法/步驟

  配置實(shí)例:

  要求配置switch0、switch1、switch2實(shí)現(xiàn)vlan共享,并在switch0上添加、刪除vlan,查看switch1、switch2是否同步

  配置命令參考:

  Switch0:

  switch0(config)#vtp domain test 配置vtp 管理域

  switch0(config)#vtp password 123 配置vtp密碼

  Switch0(config)#interface fa0/1 配置接口模式為trunk

  Switch0(config-if)#switchport mode trunk

  switch0(config)#int fa0/2

  switch0(config-if)#switchport mode trunk

  switch1:

  switch1(config)#vtp domain test 配置vtp 管理域

  switch1(config)#vtp password 123 配置vtp密碼

  Switch1(config)#interface fa0/1 配置接口模式為trunk

  Switch1(config-if)#switchport mode trunk

  switch2:

  switch2(config)#vtp domain test 配置vtp 管理域

  switch2(config)#vtp password 123 配置vtp密碼

  Switch2(config)#interface fa0/1 配置接口模式為trunk

  Switch2(config-if)#switchport mode trunk

  在switch0 上添加vlan2,vlan3 :

  switch0(config)#vlan 2

  switch0(config-vlan)#exit

  switch0(config)#vlan 3

  switch0(config-vlan)#exit

  switch0(config)#

思科交換機(jī)常用命令及配置相關(guān)文章:

1.Cisco交換機(jī)常用配置命令總結(jié)

2.關(guān)于Cisco交換機(jī)常用的配置命令

3.Cisco常用的路由器交換機(jī)配置命令

4.思科常用配置命令及參數(shù)

5.思科交換機(jī)路由器常規(guī)配置命令大全

6.思科交換機(jī)配置命令教程

7.思科2960交換機(jī)的配置命令

2866878