2022年cisco交换机配置命令 .pdf

上传人:C****o 文档编号:39885919 上传时间:2022-09-08 格式:PDF 页数:14 大小:141.48KB
返回 下载 相关 举报
2022年cisco交换机配置命令 .pdf_第1页
第1页 / 共14页
2022年cisco交换机配置命令 .pdf_第2页
第2页 / 共14页
点击查看更多>>
资源描述

《2022年cisco交换机配置命令 .pdf》由会员分享,可在线阅读,更多相关《2022年cisco交换机配置命令 .pdf(14页珍藏版)》请在得力文库 - 分享文档赚钱的网站上搜索。

1、1.交换机支持的命令:交换机基本状态:switch:;ROM 状态,路由器是rommon hostname;用户模式hostname#;特权模式hostname(config)#;全局配置模式hostname(config-if)#;接口状态交换机口令设置:switchenable;进入特权模式switch#config terminal;进入全局配置模式switch(config)#hostname ;设置交换机的主机名switch(config)#enable secret xxx;设置特权加密口令switch(config)#enable password xxa;设置特权非密口令swi

2、tch(config)#line console 0;进入控制台口switch(config-line)#line vty 0 4;进入虚拟终端switch(config-line)#login;允许登录switch(config-line)#password xx;设置登录口令xx switch#exit;返回命令交换机 VLAN设置:switch#vlan database;进入 VLAN设置switch(vlan)#vlan 2;建 VLAN 2 switch(vlan)#no vlan 2;删 vlan 2 switch(config)#int f0/1;进入端口1 switch(co

3、nfig-if)#switchport accessvlan 2;当前端口加入vlan 2 switch(config-if)#switchport mode trunk;设置为干线switch(config-if)#switchport trunk allowed vlan 1,2;设置允许的 vlan switch(config-if)#switchport trunk encap dot1q;设置 vlan 中继switch(config)#vtp domain ;设置发 vtp 域名switch(config)#vtp password ;设置发 vtp 密码switch(config

4、)#vtp mode server;设置发 vtp 模式switch(config)#vtp mode client;设置发 vtp 模式交换机设置IP 地址:名师资料总结-精品资料欢迎下载-名师精心整理-第 1 页,共 14 页 -switch(config)#interface vlan 1;进入 vlan 1 switch(config-if)#ip address ;设置 IP 地址switch(config)#ip default-gateway ;设置默认网关switch#dir flash:;查看闪存交换机显示命令:switch#write;保存配置信息switch#show v

5、tp;查看 vtp 配置信息switch#show run;查看当前配置信息switch#show vlan;查看 vlan 配置信息switch#show interface;查看端口信息switch#show int f0/0;查看指定端口信息2.路由器支持的命令:路由器显示命令:router#show run;显示配置信息router#show interface;显示接口信息router#show ip route;显示路由信息router#show cdp nei;显示邻居信息router#reload ;重新起动路由器口令设置:routerenable;进入特权模式router#c

6、onfig terminal;进入全局配置模式router(config)#hostname ;设置交换机的主机名router(config)#enable secret xxx;设置特权加密口令router(config)#enable password xxb;设置特权非密口令router(config)#line console 0;进入控制台口router(config-line)#line vty 0 4;进入虚拟终端router(config-line)#login;要求口令验证router(config-line)#password xx;设置登录口令xx router(conf

7、ig)#(Ctrl+z);返回特权模式router#exit;返回命令路由器配置:名师资料总结-精品资料欢迎下载-名师精心整理-第 2 页,共 14 页 -router(config)#int s0/0;进入 Serail接口router(config-if)#no shutdown;激活当前接口router(config-if)#clock rate 64000;设置同步时钟router(config-if)#ip address ;设置 IP 地址router(config-if)#ip address second;设置第二个IP router(config-if)#int f0/0.1

8、;进入子接口router(config-subif.1)#ip address ;设置子接口IP router(config-subif.1)#encapsulation dot1q ;绑定 vlan中继协议router(config)#config-register 0 x2142;跳过配置文件router(config)#config-register 0 x2102;正常使用配置文件router#reload;重新引导路由器文件操作:router#copy running-config startup-config;保存配置router#copy running-config tftp;

9、保存配置到tftp router#copy startup-config tftp;开机配置存到tftp router#copy tftp flash:;下传文件到flash router#copy tftp startup-config;下载配置文件ROM 状态:Ctrl+Break;进入 ROM 监控状态rommonconfreg 0 x2142;跳过配置文件rommonconfreg 0 x2102;恢复配置文件rommonreset;重新引导rommoncopy xmodem:flash:;从 console 传输文件rommonIP_ADDRESS=10.65.1.2;设置路由器IP

10、 rommonIP_SUBNET_MASK=255.255.0.0;设置路由器掩码rommonTFTP_SERVER=10.65.1.1;指定 TFTP服务器 IP rommonTFTP_FILE=c2600.bin;指定下载的文件rommontftpdnld;从 tftp下载rommondir flash:;查看闪存内容rommonboot;引导 IOS 静态路由:ip route ;命令格式router(config)#ip route 2.0.0.0 255.0.0.0 1.1.1.2;静态路由举例router(config)#ip route 0.0.0.0 0.0.0.0 1.1.1

11、.2;默认路由例名师资料总结-精品资料欢迎下载-名师精心整理-第 3 页,共 14 页 -动态路由:router(config)#ip routing;启动路由转发router(config)#router rip;启动 RIP 路由协议。router(config-router)#network ;设置发布路由router(config-router)#negihbor ;点对点帧中继用。帧中继命令:router(config)#frame-relay switching;使能帧中继交换router(config-s0)#encapsulation frame-relay;使能帧中继rout

12、er(config-s0)#fram-relay lmi-type cisco;设置管理类型router(config-s0)#frame-relay intf-type DCE;设置为DCE router(config-s0)#frame-relay dlci 16;router(config-s0)#frame-relay local-dlci 20;设置虚电路号router(config-s0)#frame-relay interface-dlci 16;router(config)#log-adjacency-changes;记录邻接变化router(config)#int s0/0.

13、1 point-to-point;设置子接口点对点router#show frame pvc;显示永久虚电路router#show frame map;显示映射基本访问控制列表:router(config)#access-list permit|deny router(config)#interface ;default:deny any router(config-if)#ip access-group in|out;default:out 例 1:router(config)#access-list 4 permit 10.8.1.1 router(config)#access-list

14、4 deny 10.8.1.0 0.0.0.255 router(config)#access-list 4 permit 10.8.0.0 0.0.255.255 router(config)#access-list 4 deny 10.0.0.0 0.255.255.255 router(config)#access-list 4 permit any router(config)#int f0/0 router(config-if)#ip access-group 4 in 名师资料总结-精品资料欢迎下载-名师精心整理-第 4 页,共 14 页 -扩展访问控制列表:access-list

15、 permit|deny icmp type access-list permit|deny tcp port 例 3:router(config)#access-list 101 deny icmp any 10.64.0.2 0.0.0.0 echo router(config)#access-list 101 permit ip any any router(config)#int s0/0 router(config-if)#ip access-group 101 in 例 3:router(config)#access-list 102 deny tcp any 10.65.0.2

16、0.0.0.0 eq 80 router(config)#access-list 102 permit ip any any router(config)#interface s0/1 router(config-if)#ip access-group 102 out 删除访问控制例表:router(config)#no access-list 102 router(config-if)#no ip access-group 101 in 路由器的nat 配置Router(config-if)#ip nat inside;当前接口指定为内部接口Router(config-if)#ip nat

17、outside;当前接口指定为外部接口Router(config)#ip nat inside source static p port Router(config)#ip nat inside source static 10.65.1.2 60.1.1.1 名师资料总结-精品资料欢迎下载-名师精心整理-第 5 页,共 14 页 -Router(config)#ip nat inside source static tcp 10.65.1.3 80 60.1.1.1 80 Router(config)#ip nat pool p1 60.1.1.1 60.1.1.20 255.255.255

18、.0 Router(config)#ip nat inside source list 1 pool p1 Router(config)#ip nat inside destination list 2 pool p2 Router(config)#ip nat inside source list 2 interface s0/0 overload Router(config)#ip nat pool p2 10.65.1.2 10.65.1.4 255.255.255.0 type rotary Router#show ip nat translation rotary 参数是轮流的意思,

19、地址池中的IP 轮流与 NAT分配的地址匹配。overload参数用于 PAT 将内部 IP 映射到一个公网IP 不同的端口上。外部网关协议配置:routerA(config)#router bgp 100 routerA(config-router)#network 19.0.0.0 routerA(config-router)#neighbor 8.1.1.2 remote-as 200 配置 PPP验证:RouterA(config)#username password RouterA(config)#int s0 RouterA(config-if)#ppp authenticatio

20、n chap|pap 3PIX 防火墙命令Pix525(config)#nameif ethernet0 outside security0;命名接口和级别Pix525(config)#interface ethernet0 auto;设置接口方式名师资料总结-精品资料欢迎下载-名师精心整理-第 6 页,共 14 页 -Pix525(config)#interface ethernet1 100full;设置接口方式Pix525(config)#interface ethernet1 100full shutdown Pix525(config)#ip address inside 192.1

21、68.0.1 255.255.255.0 Pix525(config)#ip address outside 133.0.0.1 255.255.255.252 Pix525(config)#global(if_name)natid ip-ip;定义公网IP 区间Pix525(config)#global(outside)1 7.0.0.1-7.0.0.15;例句Pix525(config)#global(outside)1 133.0.0.1;例句Pix525(config)#no global(outside)1 133.0.0.1;去掉设置Pix525(config)#nat(if_na

22、me)nat_id local_ip netmark Pix525(config)#nat(inside)1 0 0 内网所有主机(0 代表 0.0.0.0)可以访问 global 1指定的外网。Pix525(config)#nat(inside)1 172.16.5.0 255.255.0.0 内网 172.16.5.0/16网段的主机可以访问global 1指定的外网。Pix525(config)#route if_name 0 0 gateway_ip metric;命令格式Pix525(config)#route outside 0 0 133.0.0.1 1;例句Pix525(con

23、fig)#route inside 10.1.0.0 255.255.0.0 10.8.0.1 1;例句Pix525(config)#static(inside,outside)133.0.0.1 192.168.0.8 表示内部 ip 地址 192.168.0.8,访问外部时被翻译成133.0.0.1全局地址。Pix525(config)#static(dmz,outside)133.0.0.1 172.16.0.8 中间区域 ip 地址 172.16.0.8,访问外部时被翻译成133.0.0.1全局地址。名师资料总结-精品资料欢迎下载-名师精心整理-第 7 页,共 14 页 -Cisco

24、交换机命令清单2006.3.5 设置主机名:switch(config)#hostname hostname 设置登录口令switch(config)#enable password/secret password 配置交换机IP 地址1900(config)#ip address ip_address mask 2950(config)#interface vlan num 2950(config-if)#ip address ip_address mask 配置交换机缺省网关1900(config)#ip default-gateway ip address 2950(config)#ip

25、 default-gateway ip address 设置端口速度:switch(config-if)#speed 10|100|auto 端口描述switch(config-if)#description description-string 显示交换机IP 地址1900#show ip 2950#show interface vlan n 设置以太网的链路模式1900(config)#interface type-module/port 1900(config-if)#duplex auto|full|full-flow-control|half 名师资料总结-精品资料欢迎下载-名师精心

26、整理-第 8 页,共 14 页 -2950(config)#interface type-module/port 2950(config-if)#duplex auto|full|half 设置永久MAC 地址1900(config)#mac-address-table permanent mac-address type module/port 2950(config)#mac-address-table static mac_addr vlan vlan_id interface int1 int2.int15 Catalyst1900设置受限的静态MAC 地址1900(config)#m

27、ac-address-table restricted static mac-address type module/port src-if-list Catalyst 2950设置受限的静态MAC 地址2950(config)#mac-address-table secure mac-addr interface vlan vlan-id 管理 MAC 地址表switch#show mac-address-table switch#clear mac-address-table 配置端口安全性1900(config-if)#port secure 1900(config-if)#port s

28、ecure max-mac-count count 1900(config-if)#port security violation protect/restrict/shutdown 1900(config-if)#port security mac-address mac-address 2950(config-if)#switchport mode access 名师资料总结-精品资料欢迎下载-名师精心整理-第 9 页,共 14 页 -2950(config-if)#switchport port-security 2950(config-if)#switchport port-secur

29、ity max-mac-count count 定义该端口在MAC地址表中对应MAC 地址的最多条数,可以定义1 到 132,缺省为 132 查看 Catalyst 1900/2950端口安全性1900#show mac-address-table security 2950#show mac-address-table secure 清除 NVRAM 1900#delete nvram 2950#erase nvram 删除 flash中全部 vlan 信息 switch#delete flash:vlan.dat 创建 VTP域1900(config)#vtp server|transpa

30、rent|client domain domain-name trap enable|disable password password pruning enable|disable 2950#vlan database 2950(vlan)#vtp server|client|transparent 2950(vlan)#vtp domain domain-name 2950(vlan)#vtp password password 2950(vlan)#vtp pruning 2950(vlan)#snmp-server enable traps vtp 2950(vlan)#exit 确认

31、 Catalyst 2950/1900的 VTP配置名师资料总结-精品资料欢迎下载-名师精心整理-第 10 页,共 14 页 -1900#show vtp 2950#show vtp status 确认生成树1900#show spantree vlan#2950#show spanning-tree vlan vlan#关掉生成树协议1900(config)#no spantree number 注:每个 VLAN都有自己独立的生成树.创建并将端口加入一个VLAN 1900(config)#vlan vlan#name vlan-name 1900(config)#interface typ

32、e-module/port 1900(config-if)#vlan-membership static vlan#|dynamic 2950#vlan database 2950(vlan)#vlan vlan-num name name 2950(vlan)#exit 2950#configure teriminal 2950(config)#interface type module/number 2950(config-if)#switchport mode access 2950(config-if)#switchport access vlan vlan-num 2950(conf

33、ig-if)#end 确认一个VLAN 1900#show vlan vlan#2950#show vlan vlan id#修改一个VLAN的名称名师资料总结-精品资料欢迎下载-名师精心整理-第 11 页,共 14 页 -switch(config)#vlan vlan#name vlan-name 查看 VLAN中的成员1900#show vlan-membership 2950#show vlan brief 2950#show interfaces interface switchport 删除 vlan 1900(config)#no vlan vlan-id 2950(vlan)#

34、no vlan vlan-id 当删除一个VLAN时,原来属于此VLAN的端口将处于非激活的状态,直到将其分配给某一VLAN。所以建议先删除vlan 下的端口再删除vlan.相同类别端口组配置所有在同一组的端口必须是相同类别的。interface range 命令只能配置已经存在的interface vlan Switch#configure terminal Switch(config)#interface range type-mode/port Switch(config-if-range)#no shutdown 将端口 1215 加入到 VLAN 3 中switch(config)#

35、interface range fa0/12 15 switch(config-if-range)#switchport mode access switch(config-if-range)#switchport access VLAN 3 使用逗号来配置不同类型端口的组:Switch#configure terminal 名师资料总结-精品资料欢迎下载-名师精心整理-第 12 页,共 14 页 -Switch(config)#interface range fa0/1-3,gig0/1-2 Switch(config-if-range)#no shutdown 设置端口汇聚将端口 2627

36、 配置成干道端口,并且绑定为一个以太网通道。1900(config)#interface port channel 1(16)(创建通道)1900(config-if)#interface range fa0/26 27 (加入端口)1900(config-if-range)#channelrange 1 mode on (应用通道)查看通道switch#show interface portchannel number(16)对交换机设置域名.Switch(config)#ip domain-name domain_name 指向名称服务器Switch(config)#ip name-ser

37、ver dns-server-ip-address Switch#show ip name server (查看名称服务器)设置老化时间,也就相当于租期Switch(config)#Mac-address-table aging-time 给 FLASH文件重命扩展名Switch(config)#rename flash:config.old flash:config.text 查看 VTP中继流量Switch#show vtp counters(计数器)排除 VLAN2通过此中继Switch(config)#no trunk-vlan 2 名师资料总结-精品资料欢迎下载-名师精心整理-第 1

38、3 页,共 14 页 -switch(config-if)#switchport trunk allowed vlan remove vlan-list 查看端口状态Switch#show interface fa0/24(trunk)switchprot 设置 vlan 中继链路switch(config)#interface interface mod/port switch(config-if)#switchport mode trunk switch(config-if)#switchport trunk allowed vlan remove vlan-list switch(config-if)#switchport trunk allowed vlan add vlan-list 2621(route)用中继链路来建立与VLAN的连接:route(config)#interface module/port.subinterface route(config-sub)#encapsulationisl|dotlq vlan-number route(config-sub)#ip address ip-address subnet-mask 名师资料总结-精品资料欢迎下载-名师精心整理-第 14 页,共 14 页 -

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 教育专区 > 高考资料

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知得利文库网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号-8 |  经营许可证:黑B2-20190332号 |   黑公网安备:91230400333293403D

© 2020-2023 www.deliwenku.com 得利文库. All Rights Reserved 黑龙江转换宝科技有限公司 

黑龙江省互联网违法和不良信息举报
举报电话:0468-3380021 邮箱:hgswwxb@163.com