A. CISCO的交换机,进行配置后如何保存
1、首先打开思科交换CLI,从特权模式进入全局配置模式,如下图所示。
B. 思科交换机里面的配置怎么保存
1、在接口配置模式下使用 do wr 或者是 do running-config startup-config
2、在全局配置模式下使用不带do的命令(以上两个)
3、导出的话,可以用TFTP,或者FTP直接下载。 你也可以用软件CRT中执行show start-config,显示初始配置信息。执行show running-config 来显示当前运行信息。然后直接复制黏贴到文档就行了。
C. 思科交换机保存设置的命令
(1) Switch# running-config startup-config 这个命令的意思是把当前设备的运行配置保存到flash中去,以便下一次重启后系统能够还原到当前配置。
(2) switch#write 保存配置信息。
D. 思科交换机常用的100个命令
思科交换机常用的100个命令
在思科交换机上的命令有哪些?哪些命令最实用,你知道吗?下面我为大家分享最常用的思科交换机基本命令,希望能帮助到大家!
1:进入特权模式enable
switch> enable
switch#
2:进入全局配置模式configure terminal
switch> enable
switch#c onfigure terminal
switch(conf)#
3:交换机命名hostname aptech2950 以aptech2950 为例
switch> enable
switch#c onfigure terminal
switch(conf)#hostname aptch-2950
aptech2950(conf)#
4:配置使能口令enable password cisco 以cisco 为例
switch> enable
switch#c onfigure terminal
switch(conf)#hostname aptch2950
aptech2950(conf)# enable password cisco
5:配置使能密码enable secret ciscolab 以cicsolab 为例
switch> enable
switch#c onfigure terminal
switch(conf)#hostname aptch2950
aptech2950(conf)# enable secret ciscolab
6:设置虚拟局域网vlan 1 interface vlan 1
switch> enable
switch#c onfigure terminal
switch(conf)#hostname aptch2950
aptech2950(conf)# interface vlan 1
aptech2950(conf-if)#ip address 192.168.1.1 255.255.255.0 配置交换机端口ip 和子网掩
码
aptech2950(conf-if)#no shut 是配置处于运行中
aptech2950(conf-if)#exit
aptech2950(conf)#ip default-gateway 192.168.254 设置网关地址
7:进入交换机某一端口interface fastehernet 0/17 以17 端口为例
switch> enable
switch#c onfigure terminal
switch(conf)#hostname aptch2950
aptech2950(conf)# interface fastehernet 0/17
aptech2950(conf-if)#
8:查看命令show
switch> enable
switch# show version 察看系统中的所有版本信息
show interface vlan 1 查看交换机有关ip 协议的配置信息
show running-configure 查看交换机当前起作用的配置信息
show interface fastethernet 0/1 察看交换机1 接口具体配置和统计信息
show mac-address-table 查看mac 地址表
show mac-address-table aging-time 查看mac 地址表自动老化时间
9:交换机恢复出厂默认恢复命令
switch> enable
switch# erase startup-configure
switch# reload
10:双工模式设置
switch> enable
switch#c onfigure terminal
switch2950(conf)#hostname aptch-2950
aptech2950(conf)# interface fastehernet 0/17 以17 端口为例
aptech2950(conf-if)#plex full/half/auto 有full , half, auto 三个可选
项
11:cdp 相关命令
switch> enable
switch# show cdp 查看设备的cdp 全局配置信息
show cdp interface fastethernet 0/17 查看17 端口的cdp 配置信息
show cdp traffic 查看有关cdp 包的统计信息
show cdp nerghbors 列出与设备相连的cisco 设备
12:csico2950 的密码恢复
拔下交换机电源线。
用手按着交换机的MODE 键,插上电源线
在switch:后执行flash_ini 命令:switch: flash_ini
查看flash 中的文件: switch: dir flash:
把“config.text”文件改名为“config.old”: switch: rename flash: config.text flash: config.old
执行boot: switch: boot
交换机进入是否进入配置的对话,执行no :
进入特权模式察看flash 里的文件: show flash :
把“config.old”文件改名为“config.text”: switch: rename flash: config.old flash: config.text
把“ config.text ” 拷入系统的“ running-configure ”: flash: config.text system :
running-configure
把配置模式重新设置密码存盘,密码恢复成功。
13:交换机telnet 远程登录设置:
switch>en
switch#c onfigure terminal
switch(conf)#hostname aptech-2950
aptech2950(conf)#enable password cisco 以cisco 为特权模式密码
aptech2950(conf)#interface fastethernet 0/1 以17 端口为telnet 远程登录端口
aptech2950(conf-if)#ip address 192.168.1.1 255.255.255.0
aptech2950(conf-if)#no shut
aptech2950(conf-if)#exit
aptech2950(conf)line vty 0 4 设置0-4 个用户可以telnet 远程登陆
aptech2950(conf-line)#login
aptech2950(conf-line)#password edge 以edge 为远程登录的用户密码
主机设置:
ip 192.168.1.2 主机的ip 必须和交换机端口的地址在同一网络
段
netmask 255.255.255.0
gate-way 192.168.1.1 网关地址是交换机端口地址
运行:
telnet 192.168.1.1
进入telnet 远程登录界面
password : edge
aptech2950>en
password: cisco
aptech#
14:交换机配置的重新载入和保存
设置完成交换机的配置后:
aptech2950(conf)#reload
是否保存(y/n) y: 保存设置信息n:不保存设置信息
1.在基于IOS 的.交换机上设置主机名/系统名:
switch(config)# hostname hostname
在基于CLI 的交换机上设置主机名/系统名:
switch(enable) set system name name-string
2.在基于IOS 的交换机上设置登录口令:
switch(config)# enable password level 1 password
在基于CLI 的交换机上设置登录口令:
switch(enable) set password
switch(enable) set enalbepass
3.在基于IOS 的交换机上设置远程访问:
switch(config)# interface vlan 1
switch(config-if)# ip address ip-address netmask
switch(config-if)# ip default-gateway ip-address
在基于CLI 的交换机上设置远程访问:
switch(enable) set interface sc0 ip-address netmask broadcast-address
switch(enable) set interface sc0 vlan
switch(enable) set ip route default gateway
4.在基于IOS 的交换机上启用和浏览CDP 信息:
switch(config-if)# cdp enable
switch(config-if)# no cdp enable
为了查看Cisco 邻接设备的CDP 通告信息:
switch# show cdp interface [type modle/port]
switch# show cdp neighbors [type mole/port] [detail]
在基于CLI 的交换机上启用和浏览CDP 信息:
switch(enable) set cdp {enable|disable} mole/port
为了查看Cisco 邻接设备的CDP 通告信息:
switch(enable) show cdp neighbors[mole/port] [vlan|plex|capabilities|detail]
5.基于IOS 的交换机的端口描述:
switch(config-if)# description description-string
基于CLI 的交换机的端口描述:
switch(enable)set port name mole/number description-string
6.在基于IOS 的交换机上设置端口速度:
E. 思科交换机常用命令汇总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
F. 知道思科路由器上保存命令的帮下忙
1、首先交换机连接电源线。
G. 如何备份cisco交换机配置文件
CISCO交换机备份和恢复配置文件的方法
CISCO交换机备份和恢复配置文件的方法
1、保存配置
将当前运行配置从DRAM存储到启动配置所在的NVRAM中,有两种命令:
(1)规范版本:
Sw1# system:running-config
flash:startup-config
Destination filename [startup-config]?(确认目的文件名)
(2)简略版本:
Sw1# running-config startup-config
Destination filename [startup-config]?
(3)其他版本
Sw1# run start
run start是 running-config startup-config的简写。
Sw1#wr
wr是write的简写。
2、将启动配置备份到存储在闪存NVRAM的文件中
比如将启动配置备份为文件名config.bak1的文件,并存储在NVRAM中:
Sw1# startup-config
flash:config.bak1
Destination filename [config.bak1]?
3、恢复配置
比如将备份的启动配置config.bak1恢复为目前想用的启动配置:
Sw1# flash:config.bak1 startup-config
Destination filename [startup-config]?
当配置恢复到startup-config中后,可在特权模式下使用reload命令重启交换机,使其重新加载新的启动配置:
Sw1#reload
System configuration has been modified.
Save?[yes/no]:n
Proceed with reload?[confirm]
发出reload命令后,系统将提示您是否要保存配置,此处不需要保存,所以选择no。如果此处选择yes,则刚刚恢复的文件将被当前运行的配置覆盖。
H. 思科交换机的配置保存命令
1、首先打开思科交换CLI,从特权模式进入全局配置模式,如下图所示。
I. 思科路由器及交换机的基本管理
思科路由器及交换机的基本管理
设备的管理是维护设备正常运行的基本条件,所以这里就跟我就来了解一下思科路由器和交换机的一些基本管理命令和方法,管理路由器和交换机的方法以及命令主要分为一下几个方面:
1、了解命令行的模式。
2、配置接口的IP地址以及相关的路由条目。
3、路由器、交换机密码的管理。
4、远程管理路由器、交换机。
5、系统IOS的备份与恢复。
一、了解命令行的模式
1)用户模式
默认进入的是用户模式,在该模式下用户受到极大的限制,只能用来查看一些统计信息。
route>#路由器的用户模式
switch>#交换机的用户模式
2)特权模式
在用户模式输入"enable"(可简写为"en")命令就可以进入特权模式,在特权模式下可以查看并修改路由器或交换机的配置。
route>enable#也可以输入en进入特权模式
route#
switch>en
switch#
在特权模式下常用的命令解释如下:
showversion:查看系统IOS版本
showrunning-config:查看当前的配置信息
running-configstartup-config:保存当前的配置或者使用write
erasestartup-config:删除以保存的配置
showstartup-config:查看保存好的配置
showmac-address-table:查看交换机的mac地址表
showint接口名称:查看接口的信息
showarp:查看ARP缓存表
showiproute:查看路由表信息
showipintbrief:查看所有接口的IP地址信息。
noipdomain-lookup:禁用DNS查询
linecon0
exec-timeout00:不超时连接
loggingsynchronous:不启用时间同步,信息不打断输入命令
3)全局模式
在特权模式下输入"configterminal"(可简写为conft)命令就可以进入全局模式,用户在该模式下可以修改路由器或交换机的全局配置。
route#configterminal
route(config)#
注意:交换机和路由器的命令都是一样的,所以后面就只拿路由器做演示了
在全局模式可以配置路由器的静态条目等
iproute目标网络子网掩码下一跳地址:配置静态路由
iproute0.0.0.00.0.0.0下一跳地址:配置默认路由
reload:重启路由器
4)接口模式
在全局模式下输入"interfastethernet接口名称"(可简写为"intf接口名称")就可以进入到接口模式了,在接口模式下可以配置此接口的名称,所做的配置也只对这个接口有效。
route(config)#interfastethernet0/1
route(config-if)#
在接口模式主要是给接口配置IP地址以及开启接口等配置。
ipaddressIP地址子网掩码:给接口配置地址
noshutdown:开启接口
注意:在这些命令模式下,如果想要进入上层模式,可以使用以上命令,如果是想要返回下次模式呢?这时可以使用"exit"命令,逐层返回。
二、配置接口的IP地址以及配静态路由
上面我们已经知道了路由器和交换机的命令模式了,知道,要想给接口配置IP地址就必须进入到接口模式,所以我先要进入接口模式。
配置接口IP地址的命令如下:
route(config)#intf0/0
route(config-if)#ipadd192.168.1.1255.255.255.0#列如配置一个192.168.1.1的ip地址
noshutdown:开启该接口
配置静态路由
iproute10.10.10.0255.255.255.0192.168.1.1
由于交换机不用设置IP地址,但是需要开启端口。
switch(config)#intrangef0/1-24
switch(config-if)#noshutdown
开启交换机的0-24个接口。
三、路由器、交换机密码的管理
1、配置的console口密码
route(config)#lineconsole0
route(config-line)#password密码
route(config-line)#login
2、配置特权模式密码
route(config)#enablepassword密码
3、配置密文密码
上述配置的密码都是以明文显示,查看当前配置即可以查看到密码,这样很不安全,所以我们来使用以下方法来配置密码。
route(config)#enablesecret密码
上述是配置加密的特权密码,在同时使password和secret设置特权密码时,后者生效。
route(config)#servicepassword-encryption
上述方法可以将明文设置的密码进行加密。
4、恢复路由器密码
由于路由器的密码是保存在startup-config中,所以我们启动路由器时,必须绕过startup-config配置,然后重新设置密码。如果要绕过startup-config配置只有修改寄存器的值,默认是0x2102(十六进制的`),将其改为0x2142即可。下面总结一些路由器破解密码的步骤。
1)重启路由器,并同时按下Ctrl+Break键中断IOS的加载,路由器将进入ROMMonitor模式。
2)将配置寄存器的值改为0x2142,并重新启动路由器。
rommom>confreg0x2142
rommom>reset
3)路由器再次重启,由于更改了配置寄存器的值,路由器无法加载配置文件,因此不需要密码验证,进入配置模式后,手动将配置文件加载回来。
Route#startup-configrunning-config
4)这时可以使用showrunning-config查看路由器配置了那些密码,逐一更改密码即可。
5)将配置寄存器的值更改回来,并将所做的配置保存,重启路由即可生效。
Router(config)#config-register0x2012
Router(config)#exit
Router#running-configstartup-config
Router#reload
5、交换机密码的恢复
Cisco交换机的密码被保存在flash中的配置文件config.text里,可以通过命令"dir"查看,恢复密码和路由器的原理是一样的,都是绕过配置文件启动交换机即可,路由器我们知道是修改寄存器的值,那么交换机呢?我们改怎么做呢?
原理很简单,将config.text文件改个名字,让系统在加载配置文件时找不到它,这样交换机在启动后就回到了出厂设置,登录交换机也就不需要密码了。但是需要注意的是,进入IOS后,要不原来的配置恢复回来,在把密码改成自己的。
交换机密码恢复步骤如下:
1)拔掉交换机的电源线,因为交换机没有开关机的按键,所以需要把电源重启交换机,在重新接上交换机后,立刻按住交换机上的"mode"键,当看到配置界面显示"swith:"命令提示,便可松开"mode"键。表示已近进入到一个专门用来中故障恢复的简单IOS.
2)使用提示的命令"flash_init"初始化flash.
switch:flash_init
3)将config.text文件改名,并重启交换机。
switch:renameflash:config.textflash:config.txt
switch:boot
4)现在就可正常进入IOS了,但是还需要做相关的配置才可以修改密码,先要把配置文件的名字改回来,然后手动加载配置文件,最后就可以查看设置了那些密码,逐一更改即可。
switch#renameflash:config.txtflash:config.text
switch#flash:config.textsystem:running-config
switch#showrunning-config
5)最后保存配置即可。
switch#running-configflash:config.text
四、远程管理路由器,交换机
1、配置管理IP
由于路由器是三层设备,可以直接在器接口上配置IP地址,所以直接使用接口地址作为管理IP即可。二交换机是二层设备,必须配置管理IP地址。我们可以通过给交换的虚拟接口配置IP,列如:交换机的管理IP为192.168.10.1
switch(config)#intvlan1
switch(config)#ipadd192.168.10.1255.255.255.0
switch(config)#noshutdown
2、配置VTY密码远程登录一台设备时,可以通过VTY(虚拟类型终端)密码做验证,基于安全考虑,没有配置VTY密码是无法实现远程登录的。
switch(config)#linevty04#表示同时允许VTY0-VTY4等5个虚拟终端连接
switch(config-line)#password123#VTYmima
switch(config-line)#login
3、需要注意的是,如果仅仅是配置上述内容,还是无法达到远程管理的程度,应远程用户只有看,而没有修改的权限,所以需要设置一个特权密码即可。
switch(config)#enablesecret123
4、如果远程的交换机与管理员的主机不在同一个网段,就必须给交换机指定默认网关,否则无法实现远程登录。
switch(config)#ipdefault-gateway192.168.10.254
五、路由器,交换机的IOS备份与恢复
路由器,交换机的IOS备份与恢复工作,主要是使用TFTP,但是现在新型的路由器,交换机已近支持TCP协议传输了。在此我就以TFTP描述备份和还原IOS的过程。
IOS备份工作如下:
1、下载CiscoTFTPServer工具,并创建TFTP服务器根目录。
2、在路由器上使用一下命令备份IOS.
Route#flashtftp
Addressornameofremotehost[]?192.168.10.2#tftp服务器的地址
Sourcefilename[]?c2800nm-ipbase-mz.123-6e.bin#系统ios的名称,可以使用dir命令查看
Destinaonfilename[c2800nm-ipbase-mz.123-6e.bin]?#这里回车确认。
这时可以查看tftp的根目录,就会发现已近有一个备份好的iso了。
如果要实现恢复工作则将Route#tftpflash即可!
;