交换机配置命令.docx
- 文档编号:30642042
- 上传时间:2023-08-18
- 格式:DOCX
- 页数:25
- 大小:22.41KB
交换机配置命令.docx
《交换机配置命令.docx》由会员分享,可在线阅读,更多相关《交换机配置命令.docx(25页珍藏版)》请在冰豆网上搜索。
交换机配置命令
一。
交换机配置试验
000.实验1交换机的启动及基本配置:
1924交换机上配置:
sw1924_b#deletenvram----------全部清除交换机的所有配置
sw1924_b#reload----------------重新启动交换机(初始提示符为>)
sw1924_b#hostnamesw1924---------------------------设置交换机的主机名
sw1924_b#enablesecretcisco-----------------------设置加密密码
sw1924_b#enablepasswordlevel1cisco1-----------设置等级密码(1最低)
sw1924_b#enablepasswordlevel15cisco15----------设置等级密码(15最高)
sw1924_b#ipaddress192.168.14.1255.255.255.0-----设置交换机的管理IP地址
sw1924_b#ipdefault-gateway192.168.198.2----------设置交换机的网关地址
sw1924_b#ipdomain-name----------------设置交换机所连域的域名
sw1924_b#ipname-server218.87.18.230--------------设置交换机所连域的域名服务器IP
sw1924_b#showip-------------------------------------------查看上述设置环境
sw1924_b#showversion--------------------------------------查看交换机的版本等信息
sw1924_b#showrunning-config-------------------------查看交换机的当前运行配置等全部信息
sw1924_b#showinte0/1-------------------------------------查看交换机的第1个端口信息
111.实验2交换机的端口和MAC地址表的设置:
1924交换机配置端口属性:
sw1924_b#conft------------------------------------进入全局配置模式
sw1924_b#interfaceethernet0/1-------------------------进入第1个端口
sw1924_b#descriptionsw1924_b-e0/1-pc1---------------给端口写入注释信息
sw1924_b#duplexauto/full/full-flow-control/half-----设置端口的工作模式
sw1924_b#portsecure---------------------------------启用端口安全性
sw1924_b#portsecuremax-mac-count1---------设置该端口允许对应的MAC地址数(默认132个)
sw1924_b#shmac-address-tablesecurity------------------查看端口安全性
配置和查看MAC地址表:
1924交换机配置MAC地址表:
sw1924_b#mac-address-tableaging-time600-----------------设置动态地址超时时间
sw1924_b#mac-address-tablepermanent0000.0cdd.5a4de0/3---定义永久MAC地址(绑定MAC地址)
sw1924_b#mac-address-tablerestrictedstatic0000.0cdd.aaede0/6e0/7--定义受限MAC地址
sw1924_b#address-violationdisable/ignore/suspend----------------------定义地址安全违规
sw1924_b#showmac-address-table------------------查看上述配置
sw1924_b#clearmac-addrrestricstatic-----------清除受限MAC地址表项
222.实验3配置VTP、VLAN、VLANTrunk和STP:
配置VTP:
sw1924_a#conft
sw1924_a#vtpserver-------------------定义VTP的工作模式
sw1924_a#vtpdomaincisco-------------定义VTP的域名
sw1924_a#trunkon---------------------启用干道
sw1924_b#vtpdomaincisco-------------加入VTP域
sw1924_b#vtpclient-------------------定义VTP的工作模式
sw1924_b#trunkon---------------------启用干道
sw1924_a#showtrunkb
sw1924_a#showtrunkballowed-vlans-----------查看干道信息
配置VLAN:
sw1924_a#vlan10dept1
sw1924_a#vlan20dept2
sw1924_a#vlan30dept3
sw1924_a#vlan40dept4----------------定义所需VLAN
sw1924_a#showvlan----------------------------查看VLAN信息
sw1924_b#showvlan
sw1924_b#showvtp-----------------------------查看VTP的信息
sw1924_b#inte0/1
sw1924_b#vlan-membershipstatic10
sw1924_b#inte0/2
sw1924_b#vlan-membershipstatic20
sw1924_b#inte0/3
sw1924_b#vlan-membershipstatic30
sw1924_b#inte0/4
sw1924_b#vlan-membershipstatic40----把接口划入各自VLAN
配置spanningtree:
sw1924_b#spantree1------------启用生成树协议
sw1924_b#shspantree1-----------------查看生成树信息
sw1924_b#nospantree1---------关闭生成树协议
sw1924_b#shspantree1---------查看生成树信息
二.cisco路由/交换机命令大全
switch>用户模式
1:
进入特权模式enable
switch>enable
switch#
2:
进入全局配置模式configureterminal
switch>enable
switch#configureterminal
switch(conf)#
3:
交换机命名hostnameaptech2950以aptech2950为例
switch>enable
switch#configureterminal
switch(conf)#hostnameaptch-2950
aptech2950(conf)#
4:
配置使能口令enablepasswordcisco以cisco为例
switch>enable
switch#configureterminal
switch(conf)#hostnameaptch2950
aptech2950(conf)#enablepasswordcisco
5:
配置使能密码enablesecretciscolab以cicsolab为例
switch>enable
switch#configureterminal
switch(conf)#hostnameaptch2950
aptech2950(conf)#enablesecretciscolab
6:
设置虚拟局域网vlan1interfacevlan1
switch>enable
switch#configureterminal
switch(conf)#hostnameaptch2950
aptech2950(conf)#interfacevlan1
aptech2950(conf-if)#ipaddress192.168.1.1255.255.255.0配置交换机端口ip和子网掩码
aptech2950(conf-if)#noshut是配置处于运行中
aptech2950(conf-if)#exit
aptech2950(conf)#ipdefault-gateway192.168.254设置网关地址
7:
进入交换机某一端口interfacefastehernet0/17以17端口为例
switch>enable
switch#configureterminal
switch(conf)#hostnameaptch2950
aptech2950(conf)#interfacefastehernet0/17
aptech2950(conf-if)#
8:
查看命令show
switch>enable
switch#showversion察看系统中的所有版本信息
showinterfacevlan1查看交换机有关ip
showrunning-configure查看交换机
showinterfacefastethernet0/1察看交换机1接口具体配置和统计信息
showmac-address-table查看mac地址表
showmac-address-tableaging-time查看mac地址表自动老化时间
9:
交换机恢复出厂默认恢复命令
switch>enable
switch#erasestartup-configure
switch#reload
10:
双工模式设置
switch>enable
switch#configureterminal
switch2950(conf)#hostnameaptch-2950
aptech2950(conf)#interfacefastehernet0/17以17端口为例
aptech2950(conf-if)#duplexfull/half/auto有full,half,auto三个可选项
11:
cdp相关命令
switch>enable
switch#showcdp查看设备的cdp全局配置信息
showcdpinterfacefastethernet0/17查看17端口的cdp配置信息
showcdptraffic查看有关cdp包的统计信息
showcdpnerghbors列出与设备相连的cisco设备
12:
csico2950的密码恢复
拔下交换机电源线。
用手按着交换机的MODE键,插上电源线
在switch:
后执行flash_ini命令:
switch:
flash_ini
查看flash中的文件:
switch:
dirflash:
把“config.text”文件改名为“config.old”:
switch:
renameflash:
config.textflash:
config.old
执行boot:
switch:
boot
交换机进入是否进入配置的对话,执行no:
进入特权模式察看flash里的文件:
showflash:
把“config.old”文件改名为“config.text”:
switch:
renameflash:
config.oldflash:
config.text
把“config.text”拷入系统的“running-configure”:
copyflash:
config.textsystem:
running-configure
把配置模式重新设置密码存盘,密码恢复成功。
13:
交换机telnet远程登录设置:
switch>en
switch#configureterminal
switch(conf)#hostnameaptech-2950
aptech2950(conf)#enablepasswordcisco以cisco为特权模式密码
aptech2950(conf)#interfacefastethernet0/1以17端口为telnet远程登录端口
aptech2950(conf-if)#ipaddress192.168.1.1255.255.255.0
aptech2950(conf-if)#noshut
aptech2950(conf-if)#exit
aptech2950(conf)linevty04设置0-4个用户可以telnet远程登陆
aptech2950(conf-line)#login
aptech2950(conf-line)#passwordedge以edge为远程登录的用户密码
主机设置:
ip192.168.1.2主机的ip必须和交换机端口的地址在同一网络段
netmask255.255.255.0
gate-way192.168.1.1网关地址是交换机端口地址
运行:
telnet192.168.1.1
进入telnet远程登录界面
password:
edge
aptech2950>en
password:
cisco
aptech#
14:
交换机配置的重新载入和保存
设置完成交换机的配置后:
aptech2950(conf)#reload是否保存(y/n)y:
保存设置信息n:
不保存设置信息
路由器命令
router>用户模式
1:
进入特权模式enable
router>enable
router#
2:
进入全局配置模式configureterminal
router>enable
router#configureterminal
router(conf)#
3:
路由器命名hostnameroutera以routerA为例
router>enable
router#configureterminal
router(conf)#hostnamerouterA
routera(conf)#
4:
配置使能口令enablepasswordcisco以cisco为例
router>enable
router#configureterminal
router(conf)#hostnamerouterA
routerA(conf)#enablepasswordcisco
5:
配置使能密码enablesecretciscolab以cicsolab为例
router>enable
router#configureterminal
router(conf)#hostnamerouterA
routerA(conf)#enablesecretciscolab
6:
进入路由器某一端口interfacefastehernet0/17以17端口为例
router>enable
router#configureterminal
router(conf)#hostnamerouterA
routerA(conf)#interfacefastehernet0/17
routerA(conf-if)#
进入路由器的某一子端口interfacefastethernet0/17.1以17端口的1子端口为例
router>enable
router#configureterminal
router(conf)#hostnamerouterA
routerA(conf)#interfacefastehernet0/17.1
7:
设置端口ip地址信息
router>enable
router#configureterminal
router(conf)#hostnamerouterA
routerA(conf)#interfacefastehernet0/17以17端口为例
routerA(conf-if)#ipaddress192.168.1.1255.255.255.0配置交换机端口ip和子网掩码
routerA(conf-if)#noshut是配置处于运行中
routerA(conf-if)#exit
8:
查看命令show
router>enable
router#showversion察看系统中的所有版本信息
showinterfacevlan1查看交换机有关ip协议的配置信息
showrunning-configure查看交换机当前起作用的配置信息
showinterfacefastethernet0/1察看交换机1接口具体配置和统计信息
showmac-address-table查看mac地址表
showmac-address-tableaging-time查看mac地址表自动老化时间
showcontrollersserial+编号查看串口类型
showiprouter查看路由器的路由表
9:
cdp相关命令
router>enable
router#showcdp查看设备的cdp全局配置信息
showcdpinterfacefastethernet0/17查看17端口的cdp配置信息
showcdptraffic查看有关cdp包的统计信息
showcdpnerghbors列出与设备相连的cisco设备
10:
csico2600的密码恢复
重新启动路由器,在启动过程中按下win+break键,使路由器进入rommonitor
在提示符下输入命令修改配置寄存器的值,然后重新启动路由器
remmon1>confreg0x2142
remmon2>reset
重新启动路由器后进入setup模式,选择“no”,退回到exec模式,此时路由器原有的配置仍然保存在startup-config中,为使路由器恢复密码后配置不变把startup-config中配置保存到running-config中,然后重新设置enable密码,并把配置寄存器改回0x2102:
router>enable
router#copystartup-configrunning-config
router#configureterminal
router(conf)#enablepasswordcisco
router(conf)#config-register0x2102
保存当前配置到startup-config,重新启动路由器。
router#copyrunning-configstartup-config
router#reload
11:
路由器telnet远程登录设置:
router>en
router#configureterminal
router(conf)#hostnamerouterA
routerA(conf)#enablepasswordcisco以cisco为特权模式密码
routerA(conf)#interfacefastethernet0/1以17端口为telnet远程登录端口
routerA(conf-if)#ipaddress192.168.1.1255.255.255.0
routerA(conf-if)#noshut
routerA(conf-if)#exit
routerA(conf)linevty04设置0-4个用户可以telnet远程登陆
routerA(conf-line)#login
routerA(conf-line)#passwordedge以edge为远程登录的用户密码
主机设置:
ip192.168.1.2主机的ip必须和交换机端口的地址在同一网络段
netmask255.255.255.0
gate-way192.168.1.1网关地址是交换机端口地址
运行:
telnet192.168.1.1
进入telnet远程登录界面
password:
edge
routera>en
password:
cisco
routera#
12:
配置路由器的标识banner$……………$
在全局配置的模式下利用“banner”命令可以配置路由器的提示信息,所有连接到路由器的终端都会收到。
router>en
router#configureterminal
router(conf)#hostnamerouterA
routerA(conf)#bannermotd$Thisisaptechcompany’router!
Pleasedon’tchangetheconfigurationwithoutpermission!
$
13:
配置接口标识description………
接口标识用于区分路由器的各个接口。
router>en
router#configureterminal
router(conf)#hostnamerouterA
routerA(conf)#interfacefastethernet0/1以0/1接口为例
routerA(conf-if)#descriptionthisisafastEthernetportusedtoconnectingthe
company’sintranet!
14:
配置超时
超时适用于设置在多长时间没有对console进行配置,自动返回exec会话时间。
默认为10分钟。
router>en
router#configureterminal
router(conf)#hostnamerouterA
routerA(conf)#lineconsole0
routerA(conf-if)#exec-timeout00第一个“0”代表分钟,第二个“0”代表秒
15:
配置串口参数
两台路由器通过串口连接需要一个做为DTE,一个做为DCE。
DCE设备要向DTE设备提供时钟频率和带宽
DCE配置:
router>en
router#configureterminal
rout
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 交换机 配置 命令
![提示](https://static.bdocx.com/images/bang_tan.gif)