华为Cisco路由器交换机配置命令大全_第1页
华为Cisco路由器交换机配置命令大全_第2页
华为Cisco路由器交换机配置命令大全_第3页
华为Cisco路由器交换机配置命令大全_第4页
华为Cisco路由器交换机配置命令大全_第5页
已阅读5页,还剩22页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、Cisco路由器交换机配置命令大全1. switch配置命令(1)模式转换命令用户模式-特权模式,使用命令"enable"特权模式-全局配置模式,使用命令"config t"全局配置模式-接口模式,使用命令"interface+接口类型+接口号"全局配置模式-线控模式,使用命令"line+接口类型+接口号"注:用户模式:查看初始化的信息.特权模式:查看所有信息、调试、保存配置信息全局模式:配置所有信息、针对整个路由器或交换机的所有接口接口模式:针对某一个接口的配置线控模式:对路由器进行控制的接口配置(2)配置命令s

2、how running config 显示所有的配置show versin 显示版本号和寄存器值shut down 关闭接口no shutdown 打开接口ip add +ip地址 配置IP地址secondary+IP地址 为接口配置第二个IP地址show interface+接口类型+接口号 查看接口管理性show controllers interface 查看接口是否有DCE电缆show history 查看历史记录show terminal 查看终端记录大小hostname+主机名 配置路由器或交换机的标识config memory 修改保存在NVRAM中的启动配置exec timeo

3、ut 0 0 设置控制台会话超时为0service password-encryptin 手工加密所有密码enable password +密码 配置明文密码ena sec +密码 配置密文密码line vty 0 4/15 进入telnet接口password +密码 配置telnet密码line aux 0 进入AUX接口password +密码 配置密码line con 0 进入CON接口password +密码 配置密码bandwidth+数字 配置带宽no ip address 删除已配置的IP地址show startup config 查看NVRAM中的配置信息copy run-c

4、onfig atartup config 保存信息到NVRAMwrite 保存信息到NVRAMerase startup-config 清除NVRAM中的配置信息show ip interface brief 查看接口的谪要信息banner motd # +信息 + # 配置路由器或交换机的描素信息description+信息 配置接口听描素信息vlan database 进入VLAN数据库模式vlan +vlan号+ 名称 创建VLANswitchport access vlan +vlan号 为VLAN为配接口interface vlan +vlan号 进入VLAN接口模式ip add +

5、ip地址 为VLAN配置管理IP地址vtp+service/tracsparent/client 配置SW的VTP工作模式vtp +domain+域名 配置SW的VTP域名vtp +password +密码 配置SW的密码switchport mode trunk 启用中继no vlan +vlan号 删除VLANshow spamming-tree vlan +vlan号 查看VLA怕生成树议2. 路由器配置命令ip route+非直连网段+子网掩码+下一跳地址 配置静态/默认路由show ip route 查看路由表show protocols 显示出所有的被动路由协议和接口上哪些协议被设

6、置show ip protocols 显示了被配置在路由器上的路由选择协议,同时给出了在路由选择协议中使用的定时器 等信息router rip 激活RIP协议network +直连网段 发布直连网段interface lookback 0 激活逻辑接口passive-interface +接口类型+接口号 配置接口为被动模式 debug ip +协议 动态查看路由更新信息undebug all 关闭所有DEBUG信息router eigrp +as号 激活EIGRP路由协议network +网段+子网掩码 发布直连网段show ip eigrp neighbors 查看邻居表show ip e

7、igrp topology 查看拓扑表show ip eigrp traffic 查看发送包数量router ospf +process-ID 激活OSPF协议network+直连网段+area+区域号 发布直连网段show ip ospf 显示OSPF的进程号和ROUTER-IDencapsulation+封装格式 更改封装格式no ip admain-lookup 关闭路由器的域名查找ip routing 在三层交换机上启用路由功能 show user 查看SW的在线用户clear line +线路号 清除线路3. 三层交换机配置命令配置一组二层端口configure terminal 进

8、入配置状态nterface range port-range 进入组配置状态配置三层端口configure terminal 进入配置状态interface fastethernet | gigabitethernet interface-id | vlan vlan-id | port-channel port-channel-number 进入端口配置状态no switchport 把物理端口变成三层口ip address ip_address subnet_mask 配置IP地址和掩码no shutdown 激活端口     例: 

9、60;   Switch(config)# interface gigabitethernet0/2     Switch(config-if)# no switchport     Switch(config-if)# no shutdown配置VLANconfigure terminal 进入配置状态vlan vlan-id 输入一个VLAN号, 然后进入vlan配态,可以输入一个新的VLAN号或旧的来进行修改。name vlan-name 可选)输入一个VLAN名,如果没有配置VLAN名,

10、缺省的名字是VLAN号前面用0填满的4位数,如VLAN0004是VLAN4的缺省名字mtu mtu-size (可选) 改变MTU大小     例     Switch# configure terminal     Switch(config)# vlan 20     Switch(config-vlan)# name test20     Switch(config-vlan)# end&#

11、160;    或     Switch# vlan database     Switch(vlan)# vlan 20 name test20     Switch(vlan)# exit将端口分配给一个VLANconfigure terminal 进入配置状态interface interface-id 进入要分配的端口switchport mode access 定义二层口switchport access vlan vlan-id 把端

12、口分配给某一VLAN     例     Switch# configure terminal      Enter configuration commands, one per line. End with CNTL/Z.     Switch(config)# interface fastethernet0/1      Switch(config-if)# switchport mode

13、access      Switch(config-if)# switchport access vlan 2     Switch(config-if)# end      Switch#配置VLAN trunkconfigure terminal 进入配置状态interface interface-Id 进入端口配置状态switchport trunk encapsulation isl | dot1q | negotiate配置trunk封装ISL 或 802.1Q 或

14、自动协商switchport mode dynamic auto | desirable | trunk 配置二层trunk模式。dynamic auto自动协商是否成为trunkdynamic desirable把端口设置为trunk如果对方端口是trunk, desirable, 配置Native VLAN(802.1q)或自动模式,trunk设置端口为强制的trunk方式,而不理会对方端口是否为trunkswitchport access vlan vlan-id 可选) 指定一个缺省VLAN, 如果此端口不再是trunkswitchport trunk native vlan vlan

15、-id 指定802.1Q native VLAN号     例:     Switch# configure terminal      Enter configuration commands, one per line. End with CNTL/Z.     Switch(config)# interface fastethernet0/4      Switch(config-if)#

16、switchport mode trunk      Switch(config-if)# switchport trunk encapsulation dot1q      Switch(config-if)# end 定义TRUNK允许的VLANconfigure terminal子 进入配置状态interface interface-id 进入端口配置switchport mode trunk 配置二层口为trunkswitchport trunk allowed vlan add | all | excep

17、t | remove vlan-list可选) 配置trunk允许的VLAN.使用add, all, except, remove关健字no switchport trunk allowed vlan 允许所有VLAN通过     例     Switch(config)# interface fastethernet0/1     Switch(config-if)# switchport trunk allowed vlan remove 2  

18、60;  Switch(config-if)# end配置Native VLAN(802.1q)configure terminal 进入配置状态interface interface-id 进入配置成802.1qtrunk的端口switchport trunk native vlan vlan-Id 配置native VLAN号no switchport trunk native vlan 端口配置命令回到缺省的状态配置基于端口权值的负载均衡configure terminal 进入Switch 1配置状态vtp domain domain-name 配置VTP域vtp mode

19、server 将Switch 1配置成VTP server.show vtp status 验证VTP的配置show vlan 验证VLANconfigure terminal 进入配置状态interface fastethernet 0/1 进入F0/1端口switchport trunk encapsulation isl | dot1q | negotiate配置trunk封装switchport mode trunk 配置成trunkshow interfaces fastethernet0/1 switchport 验证VLAN配置按以上步骤对想要负载均衡的接口进行配置在另一个交换机

20、上进行此配置show vlan 当trunk已经起来,在switch2上验证已经学到相的vlan配置configure terminal 在Switch 1上进入配置状态interface fastethernet0/1 进入要配置的端口spanning-tree vlan 8 port-priority 10 将端口权值10赋与VLAN 8.spanning-tree vlan 9 port-priority 10 将端口权值10赋与VLAN 9.spanning-tree vlan 10 port-priority 10 将端口权值10赋与VLAN 10.interface fasteth

21、ernet0/2 进入F0/2spanning-tree vlan 3 port-priority 10 将端口权值10赋与VLAN 3.spanning-tree vlan 4 port-priority 10 将端口权值10赋与VLAN 4spanning-tree vlan 5 port-priority 10 将端口权值10赋与VLAN 5spanning-tree vlan 6 port-priority 10 将端口权值10赋与VLAN 10end 退出show running-config 验证配置copy running-config startup-config 保存配置配置

22、STP路径值的负载均衡Trunk1走VLAN810,Trunk2走VLAN24configure terminal 进入 Switch 1配置状态interface fastethernet 0/1 进入F0/1switchport trunk encapsulation isl | dot1q | negotiate配置封装switchport mode trunk 配置Trunk,缺省是ISL封装exit 退回在F0/2口上重复24步骤exit 退回show running-config 验证配置show vlan验证switch1 已经学到Vlanconfigure terminal 进

23、入配置状态interface fastethernet 0/1 进入F0/1spanning-tree vlan 2 cost 30 设置Vlan2生成树路径值为30spanning-tree vlan 3 cost 30 设置Vlan3生成树路径值为30spanning-tree vlan 4 cost 30 设置Vlan4生成树路径值为30end 退出在switch1的F0/2上重复911步骤设置VLAN8,9,10生成树路径值为30end 退出show running-config 验证配置copy running-config startup-config 保存配置补充:CISCO命令

24、集路由选择协议及排障     *ip route命令Router(config)# ip route <目录网络或子网号> 子网掩码 <下一路由器IP地址 | 从本地出口的地址> 管理距离0255,默认为1     (注:静态地址配置)     *ip default-network命令Router(config)# ip default-network <目标网络号>     (注:配合路由协使用,

25、用其中的一个动态路由号作默认路由配置)Router(config)# ip route <下一路由器IP地址 | 从本地出口的地址>     (注:只有一个公网地址时,在出口路由器上的配置)     *内部路由选择协议     *使用router和network命令Router(config)# router <路由协议rip | igrp | eigrp | ospf | is-is等> 自主系统号Router(con

26、fig-router)# network <直接相连的要用此路由协议的网络号>Router(config-router)# network <直接相连的要用此路由协议的网络号>     *路由信息协议RIPRouter(config)# router ripRouter(config-router)# network <直接相连的要用rip协议的有类别网络号>Router# show ip protocolsRouter# show ip routeRouter# debug ip rip  

27、60;  *内部网关路由协议IGRPRouter(config)# router igrp <自主系统号>Router(config-router)# network <直接相连的要用igrp协议的有类别网络号>Router# show ip interfaceRouter# show ip protocolsRouter# show ip routeRouter# debug ip rip     *排除网络故障     排除网络故障的一个总体模型Router# ping <

28、;有故障的主机 | 有故障的IP地址>Router# show ip routeRouter# show interface <有故障的接口>Router# show run     *IP的故故障排除     检查可用的路由Router# show ip route <有故障的IP地址>27.4.4 跟踪路由(Tracing the Route)SUN-A> traceroute <有故障的主机 | 有故障的IP地址>C:windows> winipcfgC:

29、windows> ipconfigC:windows> ipconfig / allC:windows> tracert <有故障的主机 | 有故障的IP地址>     使用扩展的ping来跟踪连接性Router# ping     *其它可能的故障     一个地址解析(ARP)的故障Router# show arpRouter# show interface <有故障的接口>C:windows> arp -aSUN-A>

30、; arp a     验证终端系统的路由表C:windows> netstat rnC:windows> route f add mask <需要添加入的网关地址>C:windows> route f print | add | delete | change destination masknetmask gatewayC:windows> route add mask <网络掩码> <网关ip地址>C:windows> route delete mas

31、k <网络掩码> <网关ip地址>C:windows> nbtstat <相应的参数>SUN-A> netstat -rn路由器 CISCO交换机配置命令大全2009-08-13 21:131.在基于IOS的交换机上设置主机名/系统名: switch(config)# hostname hostname 在基于CLI的交换机上设置主机名/系统名: switch(enable) set system name name-string2.在基于IOS的交换机上设置登录口令: switch(config)# enable password l

32、evel 1 password 在基于CLI的交换机上设置登录口令: switch(enable) set password switch(enable) set enalbepass3.在基于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-a

33、ddress netmask broadcast-address switch(enable) set interface sc0 vlan switch(enable) set ip route default gateway4.在基于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

34、module/port detail 在基于CLI的交换机上启用和浏览CDP信息: switch(enable) set cdp enable|disable module/port 为了查看Cisco邻接设备的CDP通告信息: switch(enable) show cdp neighborsmodule/port vlan|duplex|capabilities|detail5.基于IOS的交换机的端口描述: switch(config-if)# description description-string 基于CLI的交换机的端口描述: switch(enable)set port na

35、me module/number description-string6.在基于IOS的交换机上设置端口速度: switch(config-if)# speed10|100|auto 在基于CLI的交换机上设置端口速度: switch(enable) set port speed moudle/number 10|100|auto switch(enable) set port speed moudle/number 4|16|auto7.在基于IOS的交换机上设置以太网的链路模式: switch(config-if)# duplex auto|full|half 在基于CLI的交换机上设置以

36、太网的链路模式: switch(enable) set port duplex module/number full|half8.在基于IOS的交换机上配置静态VLAN: switch# vlan database switch(vlan)# vlan vlan-num name vlaswitch(vlan)# exit switch# configure teriminal switch(config)# interface interface module/number switch(config-if)# switchport mode access switch(config-if)

37、# switchport access vlan vlan-num switch(config-if)# end 在基于CLI的交换机上配置静态VLAN: switch(enable) set vlan vlan-num name name switch(enable) set vlan vlan-num mod-num/port-list9. 在基于IOS的交换机上配置VLAN中继线: switch(config)# interface interface mod/port switch(config-if)# switchport mode trunk switch(config-if)#

38、 switchport trunk encapsulation isl|dotlq switch(config-if)# switchport trunk allowed vlan remove vlan-list switch(config-if)# switchport trunk allowed vlan add vlan-list 在基于CLI的交换机上配置VLAN中继线: switch(enable) set trunk module/port on|off|desirable|auto|nonegotiate Vlan-range isl|dotlq|dotl0|lane|nego

39、tiate10.在基于IOS的交换机上配置VTP管理域: switch# vlan database switch(vlan)# vtp domain domain-name 在基于CLI的交换机上配置VTP管理域: switch(enable) set vtp domain domain-name华为路由器交换机配置命令大全华为路由器交换机配置命令:计算机命令PCAlogin:root;使用root用户password:linux;口令是linux#shutdown-hnow;关机#init0;关机#logout;用户注销#login;用户登录#ifconfig;显示IP地址#ifconfi

40、geth0netmask;设置IP地址#ifconfigeht0netmaskdown;禁用IP地址#routeaddgw;设置网关#routedelgw;删除网关#routeadddefaultgw;设置网关#routedeldefaultgw;删除网关#route;显示网关#ping;发ECHO包#telnet;远程登录华为路由器交换机配置命令:交换机命令Quidwaydiscur;显示当前配置Quidwaydisplaycurrent-configuration;显示当前配置Quidwaydisplayinterfaces;显示接口信息Quidwaydispl

41、ayvlanall;显示路由信息Quidwaydisplayversion;显示版本信息Quidwaysuperpassword;修改特权用户密码Quidwaysysname;交换机命名Quidwayinterfaceethernet0/1;进入接口视图Quidwayinterfacevlanx;进入接口视图Quidway-Vlan-interfacexipaddress;配置VLAN的IP地址Quidwayiproute-static;静态路由网关Quidwayrip;三层交换支持Quidwaylocal-

42、userftpQuidwayuser-interfacevty04;进入虚拟终端S3026-ui-vty0-4authentication-modepassword;设置口令模式S3026-ui-vty0-4setauthentication-modepasswordsimple222;设置口令S3026-ui-vty0-4userprivilegelevel3;用户级别Quidwayinterfaceethernet0/1;进入端口模式Quidwayinte0/1;进入端口模式Quidway-Ethernet0/1duplexhalf|full|auto;配置端口工作状态Quidway-Et

43、hernet0/1speed10|100|auto;配置端口工作速率Quidway-Ethernet0/1flow-control;配置端口流控Quidway-Ethernet0/1mdiacross|auto|normal;配置端口平接扭接Quidway-Ethernet0/1portlink-typetrunk|access|hybrid;设置端口工作模式Quidway-Ethernet0/1portaccessvlan3;当前端口加入到VLANQuidway-Ethernet0/2porttrunkpermitvlanID|All;设trunk允许的VLANQuidway-Etherne

44、t0/3porttrunkpvidvlan3;设置trunk端口的PVIDQuidway-Ethernet0/1undoshutdown;激活端口Quidway-Ethernet0/1shutdown;关闭端口Quidway-Ethernet0/1quit;返回Quidwayvlan3;创建VLANQuidway-vlan3portethernet0/1;在VLAN中增加端口Quidway-vlan3porte0/1;简写方式Quidway-vlan3portethernet0/1toethernet0/4;在VLAN中增加端口Quidway-vlan3porte0/1toe0/4;简写方式Q

45、uidwaymonitor-port;指定镜像端口Quidwayportmirror;指定被镜像端口Quidwayportmirrorint_listobserving-portint_typeint_num;指定镜像和被镜像Quidwaydescriptionstring;指定VLAN描述字符Quidwaydescription;删除VLAN描述字符Quidwaydisplayvlanvlan_id;查看VLAN设置Quidwaystpenable|disable;设置生成树,默认关闭Quidwaystppriority4096;设置交换机的优先级Quidwaystprootprimary|

46、secondary;设置为根或根的备份Quidway-Ethernet0/1stpcost200;设置交换机端口的花费Quidwaylink-aggregatione0/1toe0/4ingress|both;端口的聚合Quidwayundolink-aggregatione0/1|all;始端口为通道号SwitchA-vlanxisolate-user-vlanenable;设置主vlanSwitchAisolate-user-vlansecondary;设置主vlan包括的子vlanQuidway-Ethernet0/2porthybridpvidvlan;设置vlan的pvidQuidw

47、ay-Ethernet0/2porthybridpvid;删除vlan的pvidQuidway-Ethernet0/2porthybridvlanvlan_id_listuntagged;设置无标识的vlan如果包的vlanid与PVId一致,则去掉vlan信息.默认PVID=1。所以设置PVID为所属vlanid,设置可以互通的vlan为untagged.华为路由器交换机配置命令:路由器命令Quidwaydisplayversion;显示版本信息Quidwaydisplaycurrent-configuration;显示当前配置Quidwaydisplayinterfaces;显示接口信息Q

48、uidwaydisplayiproute;显示路由信息Quidwaysysnameaabbcc;更改主机名Quidwaysuperpasswrod123456;设置口令Quidwayinterfaceserial0;进入接口Quidway-serial0ipaddress;配置端口IP地址Quidway-serial0undoshutdown;激活端口Quidwaylink-protocolhdlc;绑定hdlc协议Quidwayuser-interfacevty04Quidway-ui-vty0-4authentication-modepasswordQuidway-ui-vty0-4set

49、authentication-modepasswordsimple222Quidway-ui-vty0-4userprivilegelevel3Quidway-ui-vty0-4quitQuidwaydebugginghdlcallserial0;显示所有信息Quidwaydebugginghdlceventserial0;调试事件信息Quidwaydebugginghdlcpacketserial0;显示包的信息华为路由器交换机配置命令:静态路由:Quidwayiproute-staticinterfacenumber|nexthopvaluereject|blackhole华为路由器交换机

50、配置命令:动态路由:Quidwayrip;设置动态路由Quidwayripwork;设置工作允许Quidwayripinput;设置入口允许Quidwayripoutput;设置出口允许Quidway-ripnetwork;设置交换路由网络Quidway-ripnetworkall;设置与所有网络交换Quidway-rippeerip-address;Quidway-ripsummary;路由聚合Quidwayripversion1;设置工作在版本1Quidwayripversion2multicast;设版本2,多播方式Quidway-Ethernet0ripsplit-hor

51、izon;水平分隔QuidwayrouteridA.B.C.D;配置路由器的IDQuidwayospfenable;启动OSPF协议Quidway-ospfimport-routedirect;引入直联路由Quidway-Serial0ospfenablearea;配置OSPF区域华为路由器交换机配置命令:标准访问列表命令格式如下:aclmatch-orderconfig|auto;默认前者顺序匹配。rulenormal|specialpermit|denysourcesource-addrsource-wildcard|any例:Quidwayacl10Quidway-acl-10rulen

52、ormaldenysourceany华为路由器交换机配置命令:扩展访问控制列表配置命令配置TCP/UDP协议的扩展访问列表:rulenormal|specialpermit|denytcp|udpsource|anydestination|anyoperate配置ICMP协议的扩展访问列表:rulenormal|specialpermit|denyicmpsource|anydestination|anyicmp-codelogging华为路由器交换机配置命令:扩展访问控制列表操作符的含义equalportnumber;等于greater-thanportnumber;大于less-thanp

53、ortnumber;小于not-equalportnumber;不等rangeportnumber1portnumber2;区间华为路由器交换机配置命令:扩展访问控制列表举例Quidwayacl101Quidway-acl-101ruledenysouceanydestinationanyQuidway-acl-101rulepermiticmpsourceanydestinationanyicmp-typeechoQuidway-acl-101rulepermiticmpsourceanydestinationanyicmp-typeecho-replyQuidwayacl102Quidwa

54、y-acl-102ruledenyipsourceanydestinationanyQuidwayacl103QuidwayfirewallenableQuidwayfirewalldefaultpermit|denyQuidwayinte0Quidway-Ethernet0firewallpacket-filter101inbound|outbound华为路由器交换机配置命令:地址转换配置举例QuidwayfirewallenableQuidwayfirewalldefaultpermitQuidwayacl101;内部指定主机可以进入e0Quidway-acl-101ruledenyipsourceanydestinationanyQuidway-acl-101quitQuidwayinte0Quidway-Ethernet0firewallpacket-filter101inboundQuid

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论